--- Java.stg	wo sep 23 12:02:24 2009
+++ Java.stg	do mei 27 10:37:44 2010
@@ -73,6 +73,7 @@
 
 lexer(grammar, name, tokens, scopes, rules, numRules, labelType="CommonToken",
       filterMode, superClass="Lexer") ::= <<
+@SuppressWarnings("unused")
 public class <grammar.recognizerName> extends <@superClassName><superClass><@end> {
     <tokens:{public static final int <it.name>=<it.type>;}; separator="\n">
     <scopes:{<if(it.isDynamicGlobalScope)><globalAttributeScope(scope=it)><endif>}>
@@ -183,6 +184,12 @@
               bitsets, inputStreamType, superClass,
               ASTLabelType="Object", labelType, members, rewriteElementType,
               filterMode) ::= <<
+<if(PARSER)>
+@SuppressWarnings({"unused", "unchecked"})<\n>
+<endif>
+<if(TREE_PARSER)>
+@SuppressWarnings("unused")<\n>
+<endif>
 public class <grammar.recognizerName> extends <@superClassName><superClass><@end> {
 <if(grammar.grammarIsRoot)>
     public static final String[] tokenNames = new String[] {
@@ -1014,21 +1021,15 @@
     }
     <@errorMethod()>
 <if(dfa.specialStateSTs)>
-    public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
-        <if(LEXER)>
-        IntStream input = _input;
-        <endif>
-        <if(PARSER)>
-        TokenStream input = (TokenStream)_input;
-        <endif>
-        <if(TREE_PARSER)>
-        TreeNodeStream input = (TreeNodeStream)_input;
-        <endif>
-    	int _s = s;
+    public int specialStateTransition(int s, IntStream input) throws NoViableAltException {
+        int _s = s;
         switch ( s ) {
         <dfa.specialStateSTs:{state |
         case <i0> : <! compressed special state numbers 0..n-1 !>
-            <state>}; separator="\n">
+            s = specialState<i0>(s, input);
+            if (s >= 0) return s;
+            break;
+        }; separator="\n">
         }
 <if(backtracking)>
         if (state.backtracking>0) {state.failed=true; return -1;}<\n>
@@ -1038,6 +1039,20 @@
         error(nvae);
         throw nvae;
     }<\n>
+<dfa.specialStateSTs:{state |
+    private int specialState<i0>(int s, IntStream _input) {
+        <if(LEXER)>
+        IntStream input = _input;
+        <endif>
+        <if(PARSER)>
+        TokenStream input = (TokenStream)_input;
+        <endif>
+        <if(TREE_PARSER)>
+        TreeNodeStream input = (TreeNodeStream)_input;
+        <endif>
+        <state>
+    }
+}; separator="\n">
 <endif>
 }<\n>
 >>
@@ -1056,8 +1071,7 @@
 <if(semPredState)> <! return input cursor to state before we rewound !>
 input.seek(index<decisionNumber>_<stateNumber>);<\n>
 <endif>
-if ( s>=0 ) return s;
-break;
+return s;
 >>
 
 /** Just like a fixed DFA edge, test the lookahead and indicate what
