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

Niall Gormley ngormley at hotmail.com
Thu Jun 13 10:30:01 PDT 2002


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

>From: "jsrs701" <jsrs701 at yahoo.com>
>Reply-To: antlr-interest at yahoogroups.com
>To: antlr-interest at yahoogroups.com
>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