Hi there, Somebody has written a complete thesis about this and other common tasks required for developing IDEs: twagner-lexing.pdf<http://www.cs.berkeley.edu/Research/Projects/harmonia/papers/twagner-lexing.pdf> .
<http://www.cs.berkeley.edu/Research/Projects/harmonia/papers/twagner-lexing.pdf>In short, after parsing each token a lexer will be in one of the states of its automaton. You have to record these states and whenever the text is modified, you have to go back only as many characters as necessary to arrive at a token where it is known that which state the lexer's been in after parsing that token. You reset the lexer to that state and continue lexing the rest of the document, if I remember correctly, I think till you arrive at a token where the lexer's new state is equal to its old state and then you stop lexing the rest of the document. Cheers, Behrang Saeedzadeh ------------------------------- http://my.opera.com/behrangsa http://twitter.com/behrangsa On Sat, Aug 22, 2009 at 10:33 PM, Keitaroh Kobayashi <kthem...@gmail.com>wrote: > Hello, I'm writing a code editor and so far, i've been using Flex for > regex-matching the whole document every time the text is changed and > coloring appropriately... I got this idea from some CocoaBuilders or > CocoaDev forum/mailing list awhile ago, but it's terribly inefficient and > slow, especially with large documents. > Just wondering if you guys have any suggestions in the direction I should > go > in... I just found NSPredicate, but I'm not sure if I should use it... > > Anyways, any suggestions are greatly appreciated, > Keita > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/behrangsa%40gmail.com > > This email sent to behran...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com