[antlr-interest] Doc-comments in generated Java

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Fri Mar 13 10:44:34 PDT 2009


Gerald Rosenberg wrote:
> 
> There is a related problem concerning annotations.  Like class comments,
> they need to be positioned below all imports.  Perhaps Antlr should not
> insert any import statements of its own if the grammar contains a header
> block.  Don't know how difficult it would be for Antlr to split the
> header block immediately after the package statement and insert its
> import statements there.

I hadn't even thought of annotations... that's quite possibly even worse.

Of course, ANTLR not inserting any includes would be very annoying as
well - having to keep track of what it needs and including them
yourself. Of course, that would avoid the spurious includes that keep
causing me warnings, but one almost expects them in generated code.

What would be great would be a separate @package as well as @header -
the generated code would then be:

contents-of- at package

AUTO-INSERTS

contents-of- at header

GENERATED CLASS

Sam


More information about the antlr-interest mailing list