[antlr-interest] Filtering peer nodes in a tree

J. Stephen Riley Silber jsrs701 at yahoo.com
Sat Jul 18 17:06:30 PDT 2009


Hi gang,

I'm having a bit of trouble with a tree filter.  I'm trying to take ASSIGN trees like this:

^( ASSIGN ID expr )

and merge them together whenever they are adjacent to each other in a tree under a BLOCK node.  So, bigger example:

^( BLOCK
    ^( foo ... )
    ^( ASSIGN ID expr )
    ^( ASSIGN ID expr )
    ^( bar ... )
 )

would become

^( BLOCK
    ^( foo ... )
    ^( ASSIGN ID expr ID expr )
    ^( bar ... )
 )

I tried using a rule like ^( BLOCK .* ASSIGN ASSIGN .* ), but that didn't seem to work.

Any suggestions?

--S
    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090718/520f4663/attachment.html 


More information about the antlr-interest mailing list