void checkAnnotations() { if (!allowAnnotations) { log.error(S.pos(), "annotations.not.supported.in.source", source.name); allowAnnotations = true; } } }
/** Generate a syntax error at current position unless one was already * reported at the same position. */ private JCErroneous syntaxError(String key) { return syntaxError(S.pos(), key); }
/** Generate a syntax error at current position unless one was * already reported at the same position. */ private JCErroneous syntaxError(String key, String arg) { return syntaxError(S.pos(), key, arg); }
/** Generate a syntax error at current position unless one was * already reported at the same position. */ private JCErroneous syntaxError(String key, String arg) { return syntaxError(S.pos(), key, arg); }
void checkGenerics() { if (!allowGenerics) { log.error(S.pos(), "generics.not.supported.in.source", source.name); allowGenerics = true; } } void checkVarargs() {
void checkVarargs() { if (!allowVarargs) { log.error(S.pos(), "varargs.not.supported.in.source", source.name); allowVarargs = true; } } void checkForeach() {
void checkForeach() { if (!allowForeach) { log.error(S.pos(), "foreach.not.supported.in.source", source.name); allowForeach = true; } } void checkStaticImports() {
/** Diagnose a modifier flag from the set, if any. */ void checkNoMods(long mods) { if (mods != 0) { long lowestMod = mods & -mods; log.error(S.pos(), "mod.not.allowed.here", Flags.toString(lowestMod).trim()); } }
/** VariableDeclarator = Ident VariableDeclaratorRest * ConstantDeclarator = Ident ConstantDeclaratorRest */ JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, String dc) { return variableDeclaratorRest(S.pos(), mods, type, ident(), reqInit, dc); }
/** Report an illegal start of expression/type error at given position. */ JCExpression illegal(int pos) { setErrorEndPos(S.pos()); if ((mode & EXPR) != 0) return syntaxError(pos, "illegal.start.of.expr"); else return syntaxError(pos, "illegal.start.of.type"); }
/** BracketsOpt = {"[" "]"} */ private JCExpression bracketsOpt(JCExpression t) { if (S.token() == LBRACKET) { int pos = S.pos(); S.nextToken(); t = bracketsOptCont(t, pos); F.at(pos); } return t; }
/** {@inheritDoc} */ @Override JCExpression parExpression() { int pos = S.pos(); JCExpression t = super.parExpression(); return toP(F.at(pos).Parens(t)); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = S.pos(); List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
/** {@inheritDoc} */ @Override JCExpression parExpression() { int pos = S.pos(); JCExpression t = super.parExpression(); return toP(F.at(pos).Parens(t)); }
JCMethodInvocation arguments(List<JCExpression> typeArgs, JCExpression t) { int pos = S.pos(); List<JCExpression> args = arguments(); return toP(F.at(pos).Apply(typeArgs, t, args)); }
/** ForUpdate = StatementExpression MoreStatementExpressions */ List<JCExpressionStatement> forUpdate() { return moreStatementExpressions(S.pos(), expression(), new ListBuffer<JCExpressionStatement>()).toList(); }
/** 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; }
/** If next input token matches given token, skip it, otherwise report * an error. */ public void accept(Token token) { if (S.token() == token) { S.nextToken(); } else { setErrorEndPos(S.pos()); reportSyntaxError(S.prevEndPos(), "expected", keywords.token2string(token)); } }
/** If next input token matches given token, skip it, otherwise report * an error. */ public void accept(Token token) { if (S.token() == token) { S.nextToken(); } else { setErrorEndPos(S.pos()); reportSyntaxError(S.prevEndPos(), "expected", keywords.token2string(token)); } }