/** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN */ JCPrimitiveTypeTree basicType() { JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token()))); S.nextToken(); return t; }
/** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";" */ JCTree importDeclaration() { int pos = S.pos(); S.nextToken(); boolean importStatic = false; if (S.token() == STATIC) { checkStaticImports(); importStatic = true; S.nextToken(); } JCExpression pid = toP(F.at(S.pos()).Ident(ident())); do { int pos1 = S.pos(); accept(DOT); if (S.token() == STAR) { pid = to(F.at(pos1).Select(pid, names.asterisk)); S.nextToken(); break; } else { pid = toP(F.at(pos1).Select(pid, ident())); } } while (S.token() == DOT); accept(SEMI); return toP(F.at(pos).Import(pid, importStatic)); }
/** ImportDeclaration = IMPORT [ STATIC ] Ident { "." Ident } [ "." "*" ] ";" */ JCTree importDeclaration() { int pos = S.pos(); S.nextToken(); boolean importStatic = false; if (S.token() == STATIC) { checkStaticImports(); importStatic = true; S.nextToken(); } JCExpression pid = toP(F.at(S.pos()).Ident(ident())); do { int pos1 = S.pos(); accept(DOT); if (S.token() == STAR) { pid = to(F.at(pos1).Select(pid, names.asterisk)); S.nextToken(); break; } else { pid = toP(F.at(pos1).Select(pid, ident())); } } while (S.token() == DOT); accept(SEMI); return toP(F.at(pos).Import(pid, importStatic)); }
/** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN */ JCPrimitiveTypeTree basicType() { JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token()))); S.nextToken(); return t; }
S.nextToken(); if (S.token() == EXTENDS) { TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.EXTENDS)); S.nextToken(); return F.at(pos).Wildcard(t, type()); } else if (S.token() == SUPER) { TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.SUPER)); S.nextToken(); return F.at(pos).Wildcard(t, type());
/** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId * LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter */ JCVariableDecl formalParameter() { JCModifiers mods = optFinal(Flags.PARAMETER); JCExpression type = type(); if (S.token() == ELLIPSIS) { checkVarargs(); mods.flags |= Flags.VARARGS; type = to(F.at(S.pos()).TypeArray(type)); S.nextToken(); } return variableDeclaratorId(mods, type); }
S.nextToken(); if (S.token() == EXTENDS) { TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.EXTENDS)); S.nextToken(); return F.at(pos).Wildcard(t, type()); } else if (S.token() == SUPER) { TypeBoundKind t = to(F.at(S.pos()).TypeBoundKind(BoundKind.SUPER)); S.nextToken(); return F.at(pos).Wildcard(t, type());
/** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId * LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter */ JCVariableDecl formalParameter() { JCModifiers mods = optFinal(Flags.PARAMETER); JCExpression type = type(); if (S.token() == ELLIPSIS) { checkVarargs(); mods.flags |= Flags.VARARGS; type = to(F.at(S.pos()).TypeArray(type)); S.nextToken(); } return variableDeclaratorId(mods, type); }
if ((mode & EXPR) != 0) { mode = EXPR; t = to(F.at(pos).Ident(names._this)); S.nextToken(); if (typeArgs == null) if ((mode & EXPR) != 0) { mode = EXPR; t = to(superSuffix(typeArgs, F.at(pos).Ident(names._super))); typeArgs = null; } else return illegal(); mode = EXPR; JCExpression t1 = term(); t = to(F.at(pos).Indexed(t, t1)); if (typeArgs != null) return illegal(); mode = EXPR; t = to(F.at(pos).Select(t, names._class)); S.nextToken(); break loop; if (typeArgs != null) return illegal(); mode = EXPR; t = to(F.at(pos).Select(t, names._this)); S.nextToken(); break loop; case SUPER: mode = EXPR;
} else { stats.append(to(F.at(pos).Exec(checkExprStat(t)))); accept(SEMI);
accept(WHILE); JCExpression cond = parExpression(); JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond)); accept(SEMI); return t; accept(LBRACE); List<JCCase> cases = switchBlockStatementGroups(); JCSwitch t = to(F.at(pos).Switch(selector, cases)); accept(RBRACE); return t; S.nextToken(); JCExpression result = S.token() == SEMI ? null : expression(); JCReturn t = to(F.at(pos).Return(result)); accept(SEMI); return t; S.nextToken(); JCExpression exc = expression(); JCThrow t = to(F.at(pos).Throw(exc)); accept(SEMI); return t; S.nextToken(); Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null; JCBreak t = to(F.at(pos).Break(label)); accept(SEMI); return t;
} else { stats.append(to(F.at(pos).Exec(checkExprStat(t)))); accept(SEMI);
if ((mode & EXPR) != 0) { mode = EXPR; t = to(F.at(pos).Ident(names._this)); S.nextToken(); if (typeArgs == null) if ((mode & EXPR) != 0) { mode = EXPR; t = to(superSuffix(typeArgs, F.at(pos).Ident(names._super))); typeArgs = null; } else return illegal(); mode = EXPR; JCExpression t1 = term(); t = to(F.at(pos).Indexed(t, t1)); if (typeArgs != null) return illegal(); mode = EXPR; t = to(F.at(pos).Select(t, names._class)); S.nextToken(); break loop; if (typeArgs != null) return illegal(); mode = EXPR; t = to(F.at(pos).Select(t, names._this)); S.nextToken(); break loop; case SUPER: mode = EXPR;
accept(WHILE); JCExpression cond = parExpression(); JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond)); accept(SEMI); return t; accept(LBRACE); List<JCCase> cases = switchBlockStatementGroups(); JCSwitch t = to(F.at(pos).Switch(selector, cases)); accept(RBRACE); return t; S.nextToken(); JCExpression result = S.token() == SEMI ? null : expression(); JCReturn t = to(F.at(pos).Return(result)); accept(SEMI); return t; S.nextToken(); JCExpression exc = expression(); JCThrow t = to(F.at(pos).Throw(exc)); accept(SEMI); return t; S.nextToken(); Name label = (S.token() == IDENTIFIER || S.token() == ASSERT || S.token() == ENUM) ? ident() : null; JCBreak t = to(F.at(pos).Break(label)); accept(SEMI); return t;
boolean isVoid = S.token() == VOID; if (isVoid) { type = to(F.at(pos).TypeIdent(TypeTags.VOID)); S.nextToken(); } else {
boolean isVoid = S.token() == VOID; if (isVoid) { type = to(F.at(pos).TypeIdent(TypeTags.VOID)); S.nextToken(); } else {