[antlr-interest] Variable visibility problem with ANTLR 3 code
generation
David Holroyd
dave at badgers-in-foil.co.uk
Tue Aug 15 08:08:19 PDT 2006
On Tue, Aug 15, 2006 at 04:32:00PM +0200, Denis Washington wrote:
> Hi,
> My ANTLR 3 grammar contains following rule:
>
> multiplicativeExpression returns [Expression expr]
> scope { ArithmeticOperator op; }
> : e=unaryExpression { expr = e; }
> (
> ( '*' { $multiplicativeExpression::op =
> ArithmeticOperator.MULTIPLY; }
> | '/' { $multiplicativeExpression::op =
> ArithmeticOperator.DIVIDE; }
> )
>
> e2=multiplicativeExpression
> {
> expr = new ArithmeticExpression(expr, e2,
> $multiplicativeExpression::op);
> expr.setSource(e);
> }
> )*
> ;
>
> If I generate code for it and try to compile that code, I get errors
> about non-existing variables e and e2 in the part in parenthes.
I'm not sure, but don't such label references require a '$' prefix?
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list