[antlr-interest] Ambiguous reference
Sam Harwell
sharwell at pixelminegames.com
Thu Nov 18 09:48:02 PST 2010
IIRC, it actually fails to compile the grammar with an error. At worst it
should be a warning, but given the clear difference between "$expression"
and "expression", the behavior is clear enough that no warning should be
needed. In C# for example, the following does not result in a warning. I
don't see how this is any different. If a $$ token was added for referencing
the enclosing rule, then the warning could be brought back suggesting the
use of $$ instead of $expression.
class Test {
int field;
void Foo() {
int field = 3;
Console.Write(field);
}
}
Sam
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Thursday, November 18, 2010 11:23 AM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Ambiguous reference
It is a little overzealous in its warning but it isn't failing ;-)
The warning is telling you that it is picking the correct interpretation,
but the label of the rule reference should of course suppress the warning.
<snip>
Jim
More information about the antlr-interest
mailing list