[antlr-interest] header/footer

ronald.petty at milliman.com ronald.petty at milliman.com
Mon Apr 5 15:13:01 PDT 2004


I  was wondering is there a way to do the following

header
{
        //stuff
}

that adds code to the top of the class file(s) that is different, is there 
a way to

1)  Add code that is different to a parser/lexer
        header { //stuff for parser}
        parser class
        header { //stuff to lexer }
        lexer class

 
As far as I know, this wont work because Antrl uses the "lexer class" to 
show when to stop for the "parser class".

In case you want to know what I am trying,  I want to be able to add the 
public static void main().... for each class, that way I can test them 
seperatly.  I know I can make a seperate test class, but just wondering if 
this can be done.  I did it for one of them, but the other issue is header 
places it at the header, and personally I like to stick main at the 
bottom.  So that also leads me to think "is there a footer"?

Thanks for the onlist and offlist help everyone.  Antlr is a cool tool.

Ron

**************************************************************************************
This communication is intended solely for the addressee and is
confidential. If you are not the intended recipient, any disclosure, 
copying, distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. Unless indicated
to the contrary: it does not constitute professional advice or 
opinions upon which reliance may be made by the addressee or any
other party, and it should be considered to be a work in progress.
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040405/12fe7578/attachment.html


More information about the antlr-interest mailing list