[antlr-interest] Context-sensitive Lexer

Arcadio Rubio García arcadiorubiogarcia at gmail.com
Fri Sep 19 07:41:47 PDT 2008


Hi everyone,

I've recently migrated to ANTLR from Yacc, and I don't find the way to  
do context-sensitive scanning (lexing) with ANTLR.

Can anyone point how to define an identifier token so that it's not  
recognized when it's adjacent to an integer for instance, 1a is not  
recognized as an integer + identifier?

I used to do this with regular expressions, e.g.:

identifier = /\b[a-zA-Z_][a-zA-Z0-9_]*\b/

Thanks in advance.


- A. Rubio




More information about the antlr-interest mailing list