[antlr-interest] label for many alternatives?
jean.morissette666 at videotron.ca
jean.morissette666 at videotron.ca
Sun Feb 27 21:31:00 PST 2005
Hi,
I would prefer to have only one lexer rule by token, and I'm wondering if it's
possible to write something like
rule :
expr ( op:( GT | GE | LT | LE ) expr { anAction(op.getText()); } )*
MyLexer...
GT : '>' ;
GE : ">=" ;
LT : '<' ;
LE : "<=" ;
...instead of...
expr ( op:OP expr { anAction(op.getText()); } )*
MyLexer...
OP : '>' | ">=" | '<' | "<=" ;
Thank
-Jean
More information about the antlr-interest
mailing list