[antlr-interest] Can I embed the Antlr version number in my generated code using some kind of macro?
Tony.Gray at ca.schneider-electric.com
Tony.Gray at ca.schneider-electric.com
Thu Jul 8 11:08:58 PDT 2010
The ANTLR generated code has lots of nice identifier comments in it with
the file, line number and grammar file contents that generated the code.
Are there anything like preprocessor macros I can use to get direct access
to that info?
I'm using the C# target and what I'm really after is the ability to add a
custom code attribute to my generated classes to instruct code analysis
tools that this is generated code. It It should be easy to just embed
that as hard-coded output in the @parser::header { } stuff like so:
[GeneratedCodeAttribute("ANTLR","3.2")]
but I'd really like to have the generator drop the version number in for
that string the way it does in the automatically generated comments, like
// $ANTLR 3.2 Sep 23, 2009 12:02:23
I spent 20 minutes googling and came up dry - any suggestions?
Tony Gray
Schneider Electric
More information about the antlr-interest
mailing list