Sorry, the subject is not very informational but I cannot
get the hang of the problem, so I cannot devise a better
subject. I have this small grammar:
grammar Gr3;
options { output=AST; }
stat : fun1 | fun2 ;
fun1 : 'fun1(' ID1 ')' ;
fun2 : 'fun2(' ID2 ')' ;
fragment DIGIT : '0'..'9' ;
fragment LETTER : ('a'..'z' | 'A'..'Z') ;
ID1 : (DIGIT | LETTER)+ ;
ID2 : (DIGIT | LETTER | '_' | '-' | '.')+ ;
WS : (' '|'\t')+ { skip(); } ;
It can recognize, say, fun1(AB) and fun2(AB_CD) as expected
but not fun2(AB), which should also be valid since AB matches
both ID1 or ID2. Rewriting fun2 as
fun2 : 'fun2(' (ID1 | ID2) ')' ;
works but is not satisfactory because I want an ID2 as fun2
argument, not an ID1. So, how can I force ANTLR to "consider"
ID1 in this position?
Thanks,
-- O.L.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/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.