[antlr-interest] Re: How to add the initial code into the Lexer/Parser's constructor

antlrlist antlrlist at yahoo.com
Wed Apr 2 03:34:09 PST 2003


If you want to initialize non-static variables, you'll probably need 
to override the default constructor. See the noconstructor option in 
the docs.


--- In antlr-interest at yahoogroups.com, Matt Benson <gudnabrsam at y...> 
wrote:
> I only use Java, but you can include custom Java code
> in a set of curly/french braces {} after the
> declaration of your class:
> 
> class P extends Parser;
> 
> options {}
> 
> {
> //custom parser code
> }
> 
> class L extends Lexer;
> options {}
> 
> {
> //custom lexer code
> }
> 
> -Matt
> 
> 
> --- zai-qiang.leng at s... wrote:
> > Hi, all,
> > 
> > I want to init some variables in the Lexer/Parser's
> > constructor and deinit
> > it in their destructor.  How can I achieve this?  I
> > mean whether there
> > exists some special sections or keywords that allow
> > me to write the
> > init/deinit code in the grammar file.
> > 
> > Thanks
> > Zaiqiang
> > 
> > 
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/ 
> > 
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your 
desktop!
> http://platinum.yahoo.com


 

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




More information about the antlr-interest mailing list