[antlr-interest] How to have consistently named lexer/parser in a package?
Thomas Brandon
tbrandonau at gmail.com
Tue Mar 18 00:41:57 PDT 2008
On Tue, Mar 18, 2008 at 2:02 PM, John Woods <jqwoods at gmail.com> wrote:
> 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.
Such blocks are scoped. The default scope in combined grammars is the
parser Add:
@lexer::header { package foo.bar; }
Tom.
More information about the antlr-interest
mailing list