[antlr-interest] Saving Lexer State?

Tom Davies tom at atlassian.com
Wed Sep 26 15:52:57 PDT 2007


I'm trying to use an ANTLR 2.x lexer fir syntax highlighting in  
Intellij IDEA.

The lexer interface it assumes can save the state of the lexer (which  
is just a single int) and later restore it. This allows incremental  
re-lexing as you type.

Is there any way to do that with an ANTLR lexer? Obviously I can  
record the input string leading up to the state and simply re-lex it,  
but I'm wondering if there's a cheaper approach?

Thanks,
   Tom


More information about the antlr-interest mailing list