[antlr-interest] Turning off harmless warnings
Wincent Colaiuta
win at wincent.com
Fri Jun 15 02:29:46 PDT 2007
In the book (p 285) Ter writes:
"At some point ANTLR will let you silence warnings for decisions that
ANTLR properly resolves."
Just wanted to post this to the list and ask that someone with write
access to the bug tracker put an entry for this in there, so it
doesn't get forgotten.
Brain-dead example rules:
FOO : 'foo' ;
section : element* EOF ;
element : FOO+ ;
Here in rule "element" ANTLR doesn't know whether to match input like
"foofoo" as a single element containing two "foo" tokens or as two
separate elements containing just one "foo" token each. It warns
"Decision can match input such as "FOO" using multiple alternatives:
1, 2" and automatically resolves the ambiguity by favoring a greedy
match in rule "element" (ie. it matches it as a single "element"
containing two "foo" tokens).
Knowing this, you might want to be able to turn off that ambiguity
warning so that other, more important warnings don't get overlooked
amid the noise. I understand that ANTLR 2 had this option (either
warnWhenFollowAmbig or generateAmbigWarnings, I don't know which). So
like I said, it would be good if someone with write access could get
this into the tracker, as it is not always possible to rewrite the
rules in such a way as to eliminate all such warnings!
Cheers,
Wincent
More information about the antlr-interest
mailing list