/
Why doesn't my header show up in the lexer as well as the parser?

Why doesn't my header show up in the lexer as well as the parser?

Actions are specific to one grammar. When using a combined parser/lexer grammar, use

// applies only to the parser:
@header {package foo;}

// applies only to the lexer:
@lexer::header {package foo;}

not just the @header.

When using a separate (non-combined) parser, @header applies to the parser. Likewise, when using a separate (non-combined) lexer, @header applies to the lexer (it is not necessary to use @lexer::header in this case).