[antlr-interest] ANTLR 3.1, headers in imported grammars
Terence Parr
parrt at cs.usfca.edu
Wed Jun 18 12:09:53 PDT 2008
added bug to fix for 3.1
http://www.antlr.org:8888/browse/ANTLR-301
Actually, wait. So we are saying that the header in root grammar
should override any in subgrammars? In this case, there are none so
it inserts it? That will be special case. @members are not
overridden for example.
Ter
On Jun 18, 2008, at 5:12 PM, Dimitrios Kolovos wrote:
> In the composite-java example that demonstrates the new "import"
> feature of 3.1 none of the parsers/lexers define @header or
> @lexer::header and as a result all generated classes do not contain
> a package declaration. Now, if I add
>
> @header{package demo;}
>
> and
>
> @lexer::header{package demo;}
>
> in Java.g, the JavaLexer and JavaParser contain the "package demo;"
> declaration but all the other files that are generated from sub-
> grammars (e.g. Java_JavaAnnotations, Java_JavaDecl) do not contain
> a package declaration. To add a package declaration to them I need
> to go in each sub-grammar and add a @header{package demo;}.
>
> Is there a way to get package declarations in files generated by
> sub-grammars only by setting @header{}/@lexer::header{} in the top-
> level grammar?
>
> Cheers,
> Dimitrios
More information about the antlr-interest
mailing list