[antlr-interest] Tree parser tree building bug and workaround
Micheal J
open.zone at virgin.net
Wed Nov 29 06:46:53 PST 2006
Hi Monty,
> I just found a bug in 2.7.7 (and 2.7.4). I have a tree
> parser rule that builds a tree (just adding a new parent
> node), like this:
>
> rule1:
> #( T1 T2 T3
> { ##=#(#[NEWROOT],##); }
> )
> ;
Shouldn't that be:
Rule1
: #( T1 T2 T3
)
{ ##=#(#[NEWROOT],##); }
;
With the action block following the tree pattern matching specification.
> >From inside the action, I see that the tree is built properly. But
> for some reason, upon exit of the rule the AST for rule1 is
> replaced by the original. (You can see it in the generated code).
This resonates with my preposition that action block placement might be the
issue here.
[...]
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
More information about the antlr-interest
mailing list