I'm making a Brainfuck (programming language) IDE, and I'm stuck with the syntax coloring.
I want to predefine a NSDictionary with substrings, and loop through them and 
return an array with (or loop through) the ranges of the substrings in a given string.
Example:
NSMutableDictionary* keywords = [[NSMutableDictionary alloc] init];
[keywords setObject:[self colorForSymbol:0] forKey:@"<"];
[keywords setObject:[self colorForSymbol:0] forKey:@">"];
[keywords setObject:[self colorForSymbol:1] forKey:@"+"];
[keywords setObject:[self colorForSymbol:1] forKey:@"-"];
And then for each symbol, I would color all the matching NSRanges using the NSTextStorage of an NSTextView.
What I need to know is how to use NSScanner or something similar for this purpose.