[antlr-interest] Doc-comments in generated Java

Jim Idle jimi at temporal-wave.com
Fri Mar 13 09:01:42 PDT 2009


Sam Barnett-Cormack wrote:
> Hi all,
>
> I seem to recall posting about this back in the ANTLR 2 days, but now I
> found myself running into it again.
>
> I'd like there to be some vague documentation generated by Javadoc for
> my parser/lexer/etc. I've got a combined grammar, with a doc-comment on
> the grammar itself. This gets attached to the generated parser class,
> and not to the generated lexer class. 
@lexer::header {

/** This is a javadoc comment that goes in the lexer java file at the top.
 */
}

@parser::header {

/** Javadoc for parser
 */
}

> Doc-comments on rules don't get
> passed anywhere, and really, it probably wouldn't make sense for them to.
>   
I thought that they did in fact get passed through, but in fact they do not.
> Is there any way to (easily, without me learning StringTemplate) 
No, you would have to change the templates to change what is generated.

Jim



More information about the antlr-interest mailing list