Is it possible to make Ragel work over NSMutableString?
I would like to use Ragel to generate DFA to tokenize an NSMutableString. That "mutable" part means that I cannot use cStringUsingEncoding:
whenever single one character changes. As far as I can see, there are two problems:
The examples included with Ragel seem to use
char *
to get a character even in Objective C. But I don't know how to get a pointer to the ever changing NSMutableString. Is it perhaps possible to force Ragel to usecharacterAtIndex:
instead? Wouldn't that be slow?If I understand correctly, NSString might change its internal representation at runtime, i.e. it is not always UTF-16. For example, when it contains ASCII only, it uses single-byte encoding. But as soon as there appears a character outside the valid range, it switches to multi-byte encoding. Is it somehow possible to account for that in Ragel?