[antlr-interest] Generated classes - annotations
Sam Barnett-Cormack
s.barnett-cormack at lancaster.ac.uk
Sun Aug 2 03:39:34 PDT 2009
Terence Parr wrote:
> Don't tell anybody I told you this, but you can do this:
>
> @annotatemethod { @SuppressWarnings("all") }
>
> and then alter Java.stg so that it references
>
> <actions.annotatemethod>
>
> right before the method definition. Bob's your uncle, and you have
> annotations.
>
> ANTLR's output template mechanism allows you to name any action you want
> and then reference it from the output templates.
So you can literrally do
@foo {blah}
and reference
<actions.foo>
?
Sam
> On Aug 1, 2009, at 1:32 PM, Sam Barnett-Cormack wrote:
>
>> Hey all,
>>
>> similar to previous discussions of doc-comments reaching the generated
>> classes, it'd be *really* nice if it were possible to annotate the
>> generated classes. Specifically, adding @SuppressWarnings("all") would
>> be lovely, as the generated code produces so many warnings (dead code,
>> unused local variables, unused imports...).
>>
>> If there were just something, akin to @header, that appeared between the
>> antlr-generated imports and the actual class, that would do the trick -
>> for doc-comments (of the class) and for annotations.
>>
>> Just a thought.
>>
>> --
>> Sam Barnett-Cormack
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
--
Sam Barnett-Cormack
More information about the antlr-interest
mailing list