[antlr-interest] Visual Studio syntax highlighting for an Antlrgrammar

Pete Gonzalez pgonzalez at bluel.com
Tue Dec 6 19:27:09 PST 2005


Micheal J wrote:
> An ANTLR v2 lexer's state is encapsulated in the LexerShareInputState(+ the
> InputBuffer). You also need to track the Stream's state of course. Assuming
> you can seek forwards and backwards at will in your stream, won't copying
> the state object(s) and storing in an array give you a single state integer
> (the array index)?.

I don't see how this is possible.  For example, the Antlr lexer contains 
loops that read all the characters in a comment, with no way to exit or 
resume the loop.

>>I looked at the code for another high-quality 
>>text editor, 
>>and they use hand-coded lexers for each language, with a 
>>global integer 
>>state just like Flex.
> Is this an open-source editor?. Id like to see the code you refer to.

Sure, take a look at the LexCPP.cxx here:
http://cvs.sourceforge.net/viewcvs.py/scintilla/scintilla/src/

The state is called "initStyle".

Cheers,
-Pete



More information about the antlr-interest mailing list