Re: Syntax Coloring?
Re: Syntax Coloring?
- Subject: Re: Syntax Coloring?
- From: Behrang Saeedzadeh <email@hidden>
- Date: Mon, 24 Aug 2009 18:09:16 +1000
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 <email@hidden>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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden