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

Matt Benson gudnabrsam at yahoo.com
Mon Mar 31 06:57:11 PST 2003


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 sybase.com 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