[antlr-interest] syntactic predicates and Kleene star...
Alan Lehotsky
qsmgmt at earthlink.net
Fri Feb 4 12:55:02 PST 2011
In retrospect, this is probably obvious, but maybe someone else is puzzling over this situation.
I have a SQL grammar with a rule
dotted_name :
ID ( DOT^ ID)*
;
which works correctly, but ANTLR produced the error message
warning(200): plsql.g:1014:8: Decision can match input such as "DOT ID" using multiple alternatives: 1,2
As a result, alternative(s) 2 were disabled for that input
I tried following the advice of using a syntactic predicate, changing the rule to
ID (DOT)=>(DOT^ ID)*
but that didn't stifle the warning. I finally realized that I wanted zero-or-more predicted DOT ID's, and rewrote it as
ID ( (DOT)=>(DOT ^ ID ))*
and the warning went away.
More information about the antlr-interest
mailing list