[antlr-interest] How to have consistently named lexer/parser in a package?

John Woods jqwoods at gmail.com
Tue Mar 18 07:15:02 PDT 2008


Thanks!

-----Original Message-----
From: Thomas Brandon
Sent: 03/18/2008 12:41 AM
> 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