[antlr-interest] Unable to omit comment generation in target file

Benjamin Niemann pink at odahoda.de
Wed Oct 3 10:32:22 PDT 2007


Hi,

Goh, Huan Yong wrote:
> I can't find a way to omit comment generation in targeted file (C#) for
> ANTRL 3.0.X. I tried to set "genHashLines=false" in OPTION block but it
> doesn't work. As far as I know this keyword is no longer supported in
> ANTRL 3.0.X, so I wonder if there any alternative way for this.
>  
> The reason of doing this is I don't want my target file be modified due
> to the timestamp changed, or file location changed.
>  
> Appreciate if someone can help on this :>

You could postprocess the generated files using a sed oneliner or whatever.
Or you could use your own version of the codegen template with

// $ANTLR <ANTLRVersion> <fileName> <generatedTimestamp>

changed

// $ANTLR <ANTLRVersion> <fileName>


But you will probably stumble upon another problem, because the output will
still not be deterministic. Some lists are probably generated from
hashtables or some other data structure without an explicit order of items,
so the items jump around without changing the semantics. At least this
happened once to me...

HTH




More information about the antlr-interest mailing list