Hello,
why such grammar doesn't work properly:
--------------------------------------------------------------------------------------
expr    :
        operand ((oper) operand)*
        ;
//Correct operands
operand :
        INT
        ;
OPER: ('+'|'-'|'*'|'/')
        ;
INT     :       
        ('0'..'9')+
        ;
--------------------------------------------------------------------------------------
> t+1
line 0:3 mismatched input '+' expecting EOF

But if I replace the Lexer rule by Parser rule:

oper: ('+'|'-'|'*'|'/');

All work as it should. Why I should't use Lexer rule with alternatives ?

Thank you

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to