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

Johannes Luber JALuber at gmx.de
Fri Mar 6 07:24:40 PST 2009


> Hi,
> 
> Is there any way to supress ANTLR comments in the Generated Lexer and
> Parser
> code.

Currently this isn't possible. The upcoming C# port of the ANTLR tool will probably include such an option and I think that this can be easily ported back.

Johannes
> 
> 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.
> 
>    // $ANTLR start "document"
>     // D:\\dev\\workspace\\workspace_contivo\\TranslatorType3Rpt.g:231:1:
> document : translationType inputSection outputSection ;
> 
> 
> Similary I want to give the grammar file location in the resource file
> name
> and read it from there, instead of having the absolute path like below
> in the generated Parser code.
> 
> public String getGrammarFileName() { return
> "D:\\dev\\workspace\\workspace_contivo\\Conversion
> Utility\\TranslatorType3RptStd.g"; }
> 
> I searched in the ANTLR book and couldnt find anything.
> 
> Any help would be great.
> 
> Thanks in advance.
> 
> Regards,
> Mani

-- 
Computer Bild Tarifsieger! GMX FreeDSL - Telefonanschluss + DSL
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a


More information about the antlr-interest mailing list