[antlr-interest] Help with tree walker in antlr 3

Terence Parr parrt at cs.usfca.edu
Wed Jul 5 10:28:32 PDT 2006


On Jul 5, 2006, at 4:53 AM, Jose Ventura wrote:

> Hi all,
>
>
> with a tree like this:
>
>    PROGRAMA (SET (...) EXECUTE (...))
>
> I'm need to walk trought se subnodes o SET node, but not trought  
> the EXECUTE subnodes.
>
> For this, i put this rule:
>
>
> programa: ^(PROGRAMA set EXECUTE);
> set: ^(SET ...);
>
> the result is : [programa]: line 0:0 mismatched tree node: DOWN;  
> expecting type <UP>
>
> In antlr 2 I could do  #(PROGRAMA set EXECUTE), Can i do it in  
> antlr 3?
>

Yeah, no antlr wants exact matches.  Can you try .* or something?  I  
have a note to myself to find an idiom to "skip subtree".  I may have  
to tell the tree node stream to skip rather than matching a bunch of  
junk.

Ter



More information about the antlr-interest mailing list