[antlr-interest] question about inserting @SuppressWarnings() in grammar

Yi Wei ywei at cis.udel.edu
Tue Dec 29 13:00:52 PST 2009


hi,

I was using Antlr-3.1 to build a small language and the lexer and parser
Antlr generated contained some warnings such as never used local variables
or never used imported classes. So I decided to use the
@SuppressWarnings() construct to suppress all these warnings. But I had
difficulty finding a place in the grammar file to add this construct. I
tried to add them in the @header {} block, but the @SuppressWarnings()
will appear right after the package header in the generated parser and
causes a syntax error. If I added the construct in the @members {} block,
the construct doesn't have any effect. Actually, the construct should be
added after the imports but before the class declarations. Is there a way
in Antlr so that I can insert this construct to the right place? Thank you
very much!

Regards,
Yi

-- 




More information about the antlr-interest mailing list