[antlr-interest] Context-sensitive Lexer

Arcadio Rubio García arcadiorubiogarcia at gmail.com
Mon Sep 22 11:06:14 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?

In Lex+Yacc, I used to do this with regular expressions, e.g.:

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

Thanks in advance.


More information about the antlr-interest mailing list