[antlr-interest] Bug using scopes, rule parameters, java code gen
Joseph Gentle
josephg at cse.unsw.edu.au
Thu Nov 8 23:06:44 PST 2007
If I have a simple parser:
grammar test;
foo
scope
{
Object x;
}
: bar;
bar : confabulate[$foo::x.toString()];
confabulate[String y]:'y';
... when it actually calls confabulate there it generates this
incorrect code:
confabulate(((foo_scope)foo_stack.peek()).x, .toString());
instead of:
confabulate(((foo_scope)foo_stack.peek()).x.toString());
The problem has something to do with the '.' in the parameter list
being parsed incorrectly.
There's a work-around using temporary variables, but its ugly.
-J
More information about the antlr-interest
mailing list