[antlr-interest] How to have consistently named lexer/parser in a package?
John Woods
jqwoods at gmail.com
Mon Mar 17 20:02:09 PDT 2008
I would like to end up with the java classes:
foo.bar.FoobarLexer
foo.bar.FoobarParser
I start with a combined grammar file Foobar.g3 which includes a package
statement:
@header {
package foo.bar;
}
But the package statement only gets copied into FoobarParser.java and
not FoobarLexer.java which then won't compile.
So it seems I need separate lexer and parser grammar files rather than a
combined one. Obviously the files need to be named differently, and
since antlr requires the filename to match the grammar name, it seems
the best I can do is have java classes like so:
foo.bar.FoobarXXXLexer
foo.bar.FoobarParser
I guess that's kinda trivial to worry about, but out of curiousity, I
was wondering if there's another way?
Thanks for any tips.
More information about the antlr-interest
mailing list