[antlr-interest] ANTLR 3.1, headers in imported grammars

Terence Parr parrt at cs.usfca.edu
Thu Jun 19 01:43:39 PDT 2008


true.  so

@header {...}
@lexer::header

and then

@import::header {...}

???

Makes sense to me...
Ter
On Jun 18, 2008, at 9:21 PM, Gavin Lambert wrote:

> At 07:09 19/06/2008, Terence Parr wrote:
> >added bug to fix for 3.1
> >
> >http://www.antlr.org:8888/browse/ANTLR-301
> >
> >Actually, wait.  So we are saying that the header in root
> >grammar should override any in subgrammars?  In this case,
> >there are none so it inserts it?  That will be special case.
> >@members are not overridden for example.
>
> That might be convenient for things like the package declaration,  
> but probably very little else.  Maybe the Java target should adopt  
> something similar to C#'s @namespace section specifically for the  
> package specification, so it can replicate that and nothing else?
>
> Also: it probably ought to be possible to put the sub-grammars in  
> one package and the main grammar in a different one.
>



More information about the antlr-interest mailing list