< prev index next >

test/langtools/tools/javac/parser/extend/TrialParser.java

Print this page




 158             case WHILE:
 159             case DO:
 160             case TRY:
 161             case SWITCH:
 162             case SYNCHRONIZED:
 163             case RETURN:
 164             case THROW:
 165             case BREAK:
 166             case CONTINUE:
 167             case SEMI:
 168             case ELSE:
 169             case FINALLY:
 170             case CATCH:
 171             case ASSERT:
 172                 return List.<JCTree>of(parseStatement());
 173             default:
 174                 JCModifiers mods = modifiersOpt(pmods);
 175                 if (token.kind == CLASS
 176                         || token.kind == INTERFACE
 177                         || token.kind == ENUM) {
 178                     return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
 179                 } else {
 180                     int pos = token.pos;
 181                     List<JCTypeParameter> typarams = typeParametersOpt();
 182                 // if there are type parameters but no modifiers, save the start
 183                     // position of the method in the modifiers.
 184                     if (typarams.nonEmpty() && mods.pos == Position.NOPOS) {
 185                         mods.pos = pos;
 186                         storeEnd(mods, pos);
 187                     }
 188                     List<JCAnnotation> annosAfterParams = annotationsOpt(Tag.ANNOTATION);
 189 
 190                     if (annosAfterParams.nonEmpty()) {
 191                         checkSourceLevel(annosAfterParams.head.pos, Feature.ANNOTATIONS_AFTER_TYPE_PARAMS);
 192                         mods.annotations = mods.annotations.appendList(annosAfterParams);
 193                         if (mods.pos == Position.NOPOS) {
 194                             mods.pos = mods.annotations.head.pos;
 195                         }
 196                     }
 197 
 198                     Token prevToken = token;




 158             case WHILE:
 159             case DO:
 160             case TRY:
 161             case SWITCH:
 162             case SYNCHRONIZED:
 163             case RETURN:
 164             case THROW:
 165             case BREAK:
 166             case CONTINUE:
 167             case SEMI:
 168             case ELSE:
 169             case FINALLY:
 170             case CATCH:
 171             case ASSERT:
 172                 return List.<JCTree>of(parseStatement());
 173             default:
 174                 JCModifiers mods = modifiersOpt(pmods);
 175                 if (token.kind == CLASS
 176                         || token.kind == INTERFACE
 177                         || token.kind == ENUM) {
 178                     return List.<JCTree>of(classOrRecordOrInterfaceOrEnumDeclaration(mods, dc));
 179                 } else {
 180                     int pos = token.pos;
 181                     List<JCTypeParameter> typarams = typeParametersOpt();
 182                 // if there are type parameters but no modifiers, save the start
 183                     // position of the method in the modifiers.
 184                     if (typarams.nonEmpty() && mods.pos == Position.NOPOS) {
 185                         mods.pos = pos;
 186                         storeEnd(mods, pos);
 187                     }
 188                     List<JCAnnotation> annosAfterParams = annotationsOpt(Tag.ANNOTATION);
 189 
 190                     if (annosAfterParams.nonEmpty()) {
 191                         checkSourceLevel(annosAfterParams.head.pos, Feature.ANNOTATIONS_AFTER_TYPE_PARAMS);
 192                         mods.annotations = mods.annotations.appendList(annosAfterParams);
 193                         if (mods.pos == Position.NOPOS) {
 194                             mods.pos = mods.annotations.head.pos;
 195                         }
 196                     }
 197 
 198                     Token prevToken = token;


< prev index next >