[antlr-interest] @SuppressWarnings("all")
Greg Clemenson
greg at onvoq.com
Tue Sep 19 11:43:49 PDT 2006
Ter,
Thank you for your reply to my question. I was not quite able to
make things work by creating a GregJava.stg. However, I did get this
approach to work via just editing Java.stg and rebuilding Antlr.
This change is OK for me since i am exclusively doing Java 5
development. The part of Java.stg changed now reads like this:
<@imports>
import org.antlr.runtime.*;
<if(TREE_PARSER)>
import org.antlr.runtime.tree.*;
<endif>
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
<if(backtracking)>
import java.util.Map;
import java.util.HashMap;
<endif>
@SuppressWarnings({"unused", "cast"})
<@end>
I suppressed a more specific set of warnings, namely "unused" and
"cast".
Thank you,
Greg
----------------------
hi. You can just tweak the templates in org.antlr.codegen.templates/
Java/Java.stg :) call it GregJava.stg and then use language=GregJava
in the options. :)
Ter
On Sep 17, 2006, at 11:00 AM, Greg Clemenson wrote:
In Antlr 3.0b4 I can't figure out how to get @SuppressWarnings("all")
just before the Parser or Lexer class definition in Java. Putting it
in the @parser::header section doesn't work, since the Java template
inserts additional import statements following the inserted
@SuppressWarnings("all"), causing a Java compile error. I was
thinking there might be some sort of @header::preamble section (also
@lexer::preamble) that could insert such things before the class
declarations. Perhaps there is already a mechanism for doing this,
but I just can't find it?
Thanks,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060919/55cc8a28/attachment.html
More information about the antlr-interest
mailing list