[antlr-interest] Suppressing spurious warnings

Steve Bennett stevagewp at gmail.com
Wed Feb 27 05:31:25 PST 2008


In the current ANTLR 3, there are lots of warnings generated that are
basically meaningless. Is there a way to suppress them?

For example:
#1
[00:15:28] warning(105): C:\antlr\mediawiki12.g:996:12: no lexer rule
corresponding to token: PRE_OPEN

There is no lexer rule but I'm setting it explicitly:
...
    | (PRE_OPEN_ACTUAL) => PRE_OPEN_ACTUAL { $type=PRE_OPEN;
in_pre=true; in_noparse=true;}
...

I don't expect ANTLR to detect that, but it'd be nice if I could
suppress the warning.

#2
"Ambiguous" rules.
[00:27:43] warning(200): mediawiki12.g:346:4: Decision can match input
such as "HYPHEN" using multiple alternatives: 1, 2

It's generally acknowledged that ANTLR does the right thing in these
ambiguous situations, consuming input and matching rules immediately.
Any reason we couldn't explicitly accept that behaviour and scrap the
warnings?

#3
Left-recursive rules
[00:27:45] warning(205): mediawiki12.g:356:4: ANTLR could not analyze
this decision in rule table_multiline_header_cell; often this is
because of recursive rule references visible from the left edge of
alternatives.  ANTLR will re-analyze the decision with a fixed
lookahead of k=1.  Consider using "options {k=1;}" for that decision
and possibly adding a syntactic predicate.

As I've reported earlier, in my situation adding the option *and* a
syntactic predicate didn't even help, so the warning isn't much use.

Thanks,
Steve


More information about the antlr-interest mailing list