[antlr-interest] Antlr v3.0ea8 : @header not taken into account in automatically generated lexer java code...

David CROSSON david.crosson at wanadoo.fr
Tue May 2 05:24:03 PDT 2006


Hello,

The @header content information, such as package declaration, is included
in the generated grammar java source code but not in the automatically
generated lexer java source code.

// ----------------------------
grammar BeaStackDumpParser;
options {
    filter=true;
    output=AST;
}

@header {
  package stackdumpparser.parsers;
  import stackdumpparser.model.*;
}
... my rules, no lexer declaration ...
// ----------------------------

The following files are generated :
- BeaStackDumpParser.java
- BeaStackDumpParser.lexer.g
- BeaStackDumpParser.tokens
- BeaStackDumpParserLexer.java
- BeaStackDumpParserLexer.token

BeaStackDumpParser.java contains header information but
not the BeaStackDumpParserLexer file.


Any idea ? May be the generated "BeaStackDumpParser.lexer.g"
should include the same header section ?

Best regards,
David Crosson.

ps : thanks Terence, for your response to my previous mail, you were right
I forgot to add the "output=AST;" option to my grammar file.





More information about the antlr-interest mailing list