[antlr-interest] Generated declaration?

Chris Recoskie recoskie at ca.ibm.com
Mon Oct 30 06:32:39 PST 2006


The type of cs depends on the return type of your classSpec rule.  If it
currently doesn't return anything then it's expected that ANTLR won't put a
declaration of your variable in there as there is nothing to store

===========================

Chris Recoskie
Team Lead, IBM CDT Team
IBM Toronto
http://www.eclipse.org/cdt



                                                                           
             Rick Morgan                                                   
             <rikmorgan at gmail.                                             
             com>                                                       To 
             Sent by:                  antlr-interest at antlr.org            
             antlr-interest-bo                                          cc 
             unces at antlr.org                                               
                                                                   Subject 
                                       [antlr-interest] Generated          
             29/10/2006 07:15          declaration?                        
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             rikmorgan at gmail.c                                             
                    om                                                     
                                                                           
                                                                           




Hi, just discovered antlr 2 days ago, so pretty new at this... I'm
trying to discover how actions I specify are placed in the generated
code so I wrote the following inside a rule:
( cs:classSpec { initEntity( cs.getText() ); } )*

As expected, the generated code contained initEntity( cs.getText() );

Problem is there is no declaration of cs.  I could declare it myself
somewhere if I new what type it was but I doubt that is the correct
solution.  I ran this test using both the command line tool (java
antlr.Tool verbTest.g) and using an Eclipse plugin, both do not generate
a declaration for cs.

I reread the wiki entries for labels several times, but it doesn't go
into these details.  I'm using antlr version 2.7.7rc1.

thanks for any advice,
Rick




More information about the antlr-interest mailing list