[antlr-interest] CSharp GeneratedCode attribute
packadal
packadal at gmail.com
Fri Jun 12 12:18:41 PDT 2009
Hi,
For the current project I am working on, we need to use a parser.
I convinced everybody here that writing your own parser is evil, because it
takes much longer to write than using a tool conceived for this exact
purpose.
Now we use C# and have some strict coding conventions, enforced using the
Microsoft tools (FxCop and StyleCop).
The problem being the antlr-generated code does not comply with these rules.
But Microsoft thought about the possibility of using generated code with
these tools, and the [GeneratedCode(name, version)] attribute is here for
this purpose. Hurray !
The only problem remaining now is that this attribute cannot be placed
correctly using the C# 2 template.
So I added a line in the C# 2 template (dunno if I done it "The Right Way"
though) :
...
75 <docComment>
*76 <if(actions.(actionScope).generatedVersion)>
77 [GeneratedCode("antlr", @"<actions.(actionScope).generatedVersion>")]
78
79 <endif>
*80 <recognizer>
...
Obviously in bold is what I added.
>From what I have seen this can also be added in the C# 3 template.
BTW, when will there be a release of antlrworks including version 3.1.3 of
antlr ?
I have tried it by myself but must have done something wrong as I get loads
of errors when trying to compile.
Keep up the good work,
Regards.
--
- Always keep in mind that you may be wrong -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090612/6944964d/attachment.html
More information about the antlr-interest
mailing list