[antlr-interest] Walking an AST with a TreeParser
mzukowski at yci.com
mzukowski at yci.com
Wed Jul 31 07:46:07 PDT 2002
A grammar is the wrong way to do what you want. You would need a syntactic
predicate in the rule below, and also have to handle the case where the node
has both a child and a sibling.
Instead try using the findAll() or findAllPartial() methods defined in
AST.java and implemented in BaseAST.java.
Monty
> -----Original Message-----
> From: Remi [mailto:remi.koutcherawy at wanadoo.fr]
> Sent: Wednesday, July 31, 2002 6:18 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Walking an AST with a TreeParser
>
>
> I am looking for a way to traverse completely an AST with a
> TreeParser.
> How can you visit all the leafs with a simple rule ?
>
> sibling : #( . sibling) | . sibling ;
>
> doesn't work, it ends with a "<AST>: unexpected end of subtree"
>
> My intent is to look only for special nodes without
> either handcode in java or import a whole grammar.
>
> Rémi
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list