[antlr-interest] supress ANTLR comments in the Generated Lexer and Parser code

Gavin Lambert antlr at mirality.co.nz
Fri Mar 6 13:11:02 PST 2009


At 03:33 7/03/2009, Manikandan Subramanian wrote:
>Is there any way to supress ANTLR comments in the Generated Lexer 
>and Parser code.
>
>Every where it says, // $ANTLR 3.1.1 
>D:\\dev\\workspace\\workspace_contivo\\TranslatorType3Rpt.g 
>2009-03-06 19:55:09
>
>in all the rules, it includes comments like below, it is 
>referring physical location, the generated java files has checked 
>in to the CVS repository and doesnt make sense to have local 
>machine's foldernames.

I don't think it does any harm.  And it's a hint to people looking 
at the code that it was the result of a codegen, so they shouldn't 
be trying to modify it directly.  And it makes it obvious where to 
find the corresponding grammar file :)

Normally though you probably wouldn't check generated code into 
source control (since it can usually be regenerated at will), 
although it's useful in cases where you don't think people will be 
modifying the original source (the grammar) and you don't want to 
require them to install ANTLR.



More information about the antlr-interest mailing list