[antlr-interest] rule, that consider token, follow the match token

Andrei Plet andrei.plet at empolis.com
Thu Jun 28 04:20:19 PDT 2012

Hi all,

I'm new to antlr and try fix follow problem.

I need a rule that match characters, depend on token, follow the 'main' token.

OP_AND : ('A'|'a') ('N'|'n') ('D'|'d');
TEXT   : ('a'..'z'|'A'..'Z')+;
PLUS   : '+';

The rule OP_AND should match only, if after the input 'and' isn't a '+', so

'and'  --> should match rule OP_AND
'and+' --> should match 2 rules: the rule TEXT 'and' and rule PLUS '+'

Thanks in advance

More information about the antlr-interest mailing list