Hello developers,
I cannot figure out how to disambiguate the following grammar using syntactic
predicate, so the range rule takes precedence over the offset rule.
Could anyone advice? I prefer to keep separate range and offset rules because
of the custom AST tree construction.
Thanks for any pointers,
Thomas
grammar test;
program : (expression)* ;
expression
:
Identifier ((range) => range)?
| offset
;
range : Integer ('-' Integer)? ;
offset : ('+' | '-') Integer ;
Identifier : ('a'..'z')+ ;
Integer : ('0'..'0')+ ;
WhiteSpace : (' ' | '\t' | '\r\n' | '\r')+ { $channel=HIDDEN; };
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address