I believe you are on the right track :) Please report back
T
On Aug 2, 2009, at 3:54 AM, Sam Barnett-Cormack wrote:
> More specifically, I change Java.stg (after copying and renaming, in
> my case) so that the last few lines of outputFile are now
>
> <docComment>
> <actions.(actionScope).annotate>
> <recognizer>
>
> Then in my combined grammar I assume I can do:
>
> @annotate {/* stuff for parser*/}
> @lexer::annotate {/* stuff for lexer */}
>
> I'm almost tempted to remove the existing <docComment> invocation
> and put one in using <actions.(actionScope).doc> or something.
>
> Am I heading in the right direction?
>
> Sam
>
> 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.
>> Ter
>> 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
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---