[antlr-interest] Comments and questions on a recent project

Tiller, Michael (M.M.) mtiller at ford.com
Mon Aug 26 10:46:08 PDT 2002


> From: mzukowski at yci.com [mailto:mzukowski at yci.com]
> Subject: RE: [antlr-interest] Comments and questions on a recent project
> 
> > Sorry, I wasn't clear about that.  The "class_definition" 
> > rule is used in
> > other places.  I suppose I could move the imaginary node 
> > creation up one
> > level.  The drawback would be that I would end up creating 
> > DEFINITION nodes
> > in several places rather than just one.  Is there a way to 
> > add a child to an
> > existing node?!?  I wasn't able to get this out of the tree 
> > construction
> > documentation.  In other words, isn't there an easy way to do 
> > this in a
> > language neutral way:
> > 
> > stored_definition
> >   : (fn:"final")? cd:class_definition
> >     { #cd->addChild(#fn); }
> > 
> 
> Yes:
> 
> {#cd=#[#cd,#fn];}


This does not seem to do what I want.  Let's say I have a tree for "cd"
already and it looks like this:

#(DECLARATION IDENT long_def)

I want to add #fn (if it is not pointing to nullAST) to this so that I get:

#(DECLARATION IDENT long_def "final")

When I do as you suggest, I get:

#(DECLARATION "final")

In other words, it creates a whole new tree and discards the previous
children.  I want to add a child to an existing tree, not create a new tree
from scratch.  Is there a language neutral way to accomplish that?

--
Mike

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list