[antlr-interest] Comments and questions on a recent project
mzukowski at yci.com
mzukowski at yci.com
Mon Aug 26 11:05:13 PDT 2002
Oops. Yes, it is:
{#cd=#[,#cd,#fn];}
The rule is:
1. The first node gets the second as a child (if null nothing
happens to first)
2. The rest of the nodes are added as siblings in order.
Monty
> -----Original Message-----
> From: Tiller, Michael (M.M.) [mailto:mtiller at ford.com]
> Sent: Monday, August 26, 2002 10:46 AM
> To: 'antlr-interest at yahoogroups.com'
> Subject: RE: [antlr-interest] Comments and questions on a
> recent project
>
>
> > 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/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list