[antlr-interest] bug in tree parser code gen related to rule scopes?
Mark Volkmann
r.mark.volkmann at gmail.com
Wed Dec 5 14:18:12 PST 2007
On Dec 5, 2007 3:50 PM, Tom Smith <yotommy at gmail.com> wrote:
> On Dec 5, 2007 4:45 PM, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> > I have the following in my tree grammar MathTree.g.
> >
> > polynomial returns [Polynomial result]
> > scope {
> > Polynomial current;
> > }
> > : ^(POLYNOMIAL term*) {
> > $result = $polynomial.current = new Polynomial();
> > }
> > ;
>
> I *think* you should express this as $polynomial::current.
Thanks! That fixed it. I also had to move where I was assigning to
current like this.
polynomial returns [Polynomial result]
scope {
Polynomial current = new Polynomial();
}
: ^(POLYNOMIAL term*) {
$result = $polynomial::current;
}
;
--
R. Mark Volkmann
Object Computing, Inc.
More information about the antlr-interest
mailing list