[antlr-interest] weird ambiguity / bug
Randall R Schulz
rschulz at sonic.net
Fri Jul 13 21:31:52 PDT 2007
On Friday 13 July 2007 21:14, Lloyd Dupont wrote:
> I have a rule like below which works OK:
> ====
> dotidlist
>
> : ( DOT^ ID ) +
>
> ;
> ====
>
> however if I make it a fragment, as in:
> =====
Fragments are for shared portions of lexer rules only. You "dotidlist"
is a parser rule ('cause its name starts with a lower-case letter; only
rules whose names start with an upper-case letter are lexer rules). You
can't have fragmentary parser rules.
Probably ANTLR should chastise you explicitly about combining "fragment"
with a parser rule.
> fragment
> dotidlist
> : ( DOT^ ID ) +
> ;
> =====
>
> I get the following warning:
> ==
> [14:12:36] warning(200): G:\Dev\ANTLR\tests\ExpTest.g:170:14:
> Decision can match input such as "DOT" using multiple alternatives:
> 1, 2 As a result, alternative(s) 2 were disabled for that input
> ==
Randall Schulz
More information about the antlr-interest
mailing list