[antlr-interest] AST children being lost
mzukowski at bco.com
mzukowski at bco.com
Wed Feb 20 10:00:09 PST 2002
Try printing toStringTree() instead of toStringList.
Also, tree grammars will stop if they see something they don't know--for
instance if the EXTENDS_CLAUSE has children which are not part of the
identifier rule, then it will simply stop traversing even though other nodes
may be in there.
Monty
> -----Original Message-----
> From: Seth Delackner [mailto:seth at jtan.com]
> Sent: Wednesday, February 20, 2002 9:55 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] AST children being lost
>
>
> First, thanks for this list and for ANTLR.
>
> With the following production in a java grammar based on java.g:
>
> extendsClause: #(EXTENDS_CLAUSE (identifier)* )
> {
> System.out.println ("ExtendsClause= "+
> #EXTENDS_CLAUSE.toStringList());
> }
>
> I get this:
>
> ExtendsClause= ( EXTENDS_CLAUSE
> testAbstract-IdentNode(testAbstract) ) IMPLEMENTS_CLAUSE ( ....
>
> Which shows that the node has a child 'testAbstract', an IdentNode.
>
> But in the rule that matches extendsClause, the node ends up having
> no children and just the 'IMPLEMENTS_CLAUSE' sibling.
>
> What do I have to change to propogate the children of extendsClause?
>
>
>
> 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