[antlr-interest] nesting rules, getting rule text

mzukowski at yci.com mzukowski at yci.com
Thu Mar 4 09:25:00 PST 2004


Yeah, typically you wouldn't nest at each DOT, you would have one root and
then all the DOT WHATEVERs as children.  The java grammar or C grammar
should have examples of this.

Monty

-----Original Message-----
From: Robin Debreuil [mailto:robin at debreuil.com] 
Sent: Thursday, March 04, 2004 2:30 AM
To: antlr-interest at yahoogroups.com
Subject: Re: [antlr-interest] nesting rules, getting rule text

Hmm, I got it to work like:

primary_expression!
{ AST curAst = null;}
 :    ps:primary_start
      {curAst = ps_AST;}
     (
         ma:member_access
            {     curAst.setFirstChild(ma_AST);
                   curAst=ma_AST;
            }
     )*
    {#primary_expression = #ps;}
 ;

Maybe there is an easier way? Maybe I 'dont want' this in the first
place...?

Cheers,
Robin



 
Yahoo! Groups Links



 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list