[antlr-interest] Saving Lexer State?

Gavin Lambert antlr at mirality.co.nz
Thu Sep 27 00:48:48 PDT 2007


At 10:52 27/09/2007, Tom Davies wrote:
 >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?

I forget the exact syntax, but ANTLR lexers provide mark and 
rewind functions that may do what you want.



More information about the antlr-interest mailing list