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

Manikandan Subramanian vsmani.chrome at gmail.com
Sat Mar 7 09:14:38 PST 2009


Hi,

Thanks for the information. In our case, some people works on ANTLR directly
and others just use the generated java files to integrate with the
application, so as you said we don't always need to have the ANTLR to be
installed on every one's machine.

Yes, the information in the comments are useful if every one follows the
same directory structure, but that is not the case. For our case, I am just
wondering, is there any way to tweak the comments to just include the
grammar file name and ANTLR version and remove the folder path.

Thank you,
Mani

On 3/7/09, Gavin Lambert <antlr at mirality.co.nz> wrote:
>
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090307/32daf611/attachment.html 


More information about the antlr-interest mailing list