Hi David,

The snippet:

@header {
package parser;
import java.util.HashMap;
}


is short for:

@parser::header {
package parser;
import java.util.HashMap;
}


You'll need to do the following as well:

@lexer::header {
package parser;
import java.util.HashMap;
}



Regards,

Bart.


On Fri, May 13, 2011 at 3:08 PM, David Smith <david.sm...@cc.gatech.edu>wrote:

> I'm using ANTLRWorks to generate java code form a grammar with the
> front-end listed below.  The code generation works flawlessly
> producing XXXLexer.java and XXXParser.java as expected with one minor
> annoyance.  The "package parser;" line makes it into XXXParser.java,
> but not into XXXLexer.java.  I therefore have to manually edit
> XXXLexer.java.  Not really a big issue, but is there an easy cure?
>
> ______________________
> grammar XXX;
> options {
>     output=AST;
>     ASTLabelType=CommonTree;
> }
> tokens{ STATLIST; }
>
> @header {
> package parser;
> import java.util.HashMap;
> }
>
>
>
> David M. Smith http://www.cc.gatech.edu/fac/David.Smith
> Georgia Institute of Technology, College of Computing
> Sent from my ASR-33 Teletype
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to