dcsimg
Problem with header section of grammar file
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ulrich_Hobelmann
Posted On:   Tuesday, March 14, 2006 10:18 AM

I have a Antlr grammar (plus a tree grammar) and want to encapsulate it in a Java subpackage, i.e. I want the generated Java files to start with "package foo.bar;". Problem is: when I write a header section in my grammar file (either before or after the "class" section, I get an error. The Antlr documentation says that the header should come after the class definition, before the options section, but that doesn't work. Antlr is version 2.7.6. The error message is: unexpected token: header { package foo.bar; import bla.quux; } expecting "class", found ... even though the "class" comes BEFORE the header... Did anyt   More>>

I have a Antlr grammar (plus a tree grammar) and want to encapsulate it in a Java subpackage, i.e. I want the generated Java files to start with "package foo.bar;".


Problem is: when I write a header section in my grammar file (either before or after the "class" section, I get an error. The Antlr documentation says that the header should come after the class definition, before the options section, but that doesn't work.


Antlr is version 2.7.6. The error message is:

			
unexpected token: header {
package foo.bar; import bla.quux;
}
expecting "class", found ...


even though the "class" comes BEFORE the header... Did anything change in recent Antlr versions and isn't yet documented?

   <<Less
About | Sitemap | Contact