I want to build a simple rule engine using ANTLR's visitor mode, but when it comes with alternative tokens, I get confused how to get which alternative is. Can anyone help me with that?(sorry of my poor English)
grammar RuleExpression;
expression: '(' Operator arg* ')';
arg: STRING|INTEGER|BOOLEAN|expression;
STRING: '"' .+ '"';
INTEGER: [0-9]+;
BOOLEAN: 'true'|'false';
Operator: [a-zA-Z]+[0-9]*;
WS : [ \t\r\n]+ -> skip;
How do know an arg is a STRING or INTEGER or BOOLEAN or expression?