[antlr-interest] Re: Modification of Node Attributes using Tree Grammar

jsrs701 jsrs701 at yahoo.com
Thu Jun 13 12:00:33 PDT 2002


--- In antlr-interest at y..., "Niall Gormley" <ngormley at h...> wrote:
> Thanks,
> 
> I tried that and ...... it was still the same!!!!
> 
> I have buildAST = true; in the options section of the TreeParser.
> 
> This produces an AST for each input Variable.
> 
> Is it possible to turn this off for the dims transformation?
> 
> Regards,
> Niall

You already did turn it off, with the ! after the rule declaration.

I just checked my code, and indeed, we're doing it exactly the same 
way.  So I think there's some other problem going on in here.


> 
> >From: "jsrs701" <jsrs701 at y...>
> >Reply-To: antlr-interest at y...
> >To: antlr-interest at y...
> >Subject: [antlr-interest] Re: Modification of Node Attributes 
using Tree 
> >Grammar
> >Date: Thu, 13 Jun 2002 16:55:24 -0000
> >
> >--- In antlr-interest at y..., "Niall Gormley" <ngormley at h...> wrote:
> > > Hi,
> > >
> > > Is it possible to use a Tree Grammar to modify Node attributes?
> > >
> > > The node "i" is getting modified buy the call 
to "setVariantType"
> >but I
> > > can't seem to get it copied to the output AST for the dims
> >expression. So
> > > the real question might be, how can I get source node "i" to 
end up
> >in the
> > > output expression?
> > >
> > > dims!
> > >   : #( LITERAL_DIM i:IDENT )
> > >     {
> > >     i.setVariantType(0);
> > >     #dims = #( #[LITERAL_DIM], #(i));
> > >     }
> > >   ;
> > >
> >
> >That's odd.  I pull this stunt all the time.  The only thing i can
> >think of is to remove the parens in the expression #(i), and just
> >leave it as #i.
> >
> >#dims = #( [LITERAL_DIM], #i );
> >
> >(I usually eschew the optional # in the [type] expressions, too.)
> >
> >That should work like a charm.
> >
> >
> >
> >
> >Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/
> >
> >
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: 
http://messenger.msn.com


 

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



More information about the antlr-interest mailing list