@SuppressWarnings("unchecked") protected boolean peekToken(int lookahead, Filter<TokenKind>... kinds) { for (; lookahead < kinds.length ; lookahead++) { if (!kinds[lookahead].accepts(S.token(lookahead + 1).kind)) { return false; } } return true; }
/** ArgumentsOpt = [ Arguments ] */ JCExpression argumentsOpt(List<JCExpression> typeArgs, JCExpression t) { if ((mode & EXPR) != 0 && S.token() == LPAREN || typeArgs != null) { mode = EXPR; return arguments(typeArgs, t); } else { return t; } }
List<JCExpression> typeArgumentsOpt(int useMode) { if (S.token() == LT) { checkGenerics(); if ((mode & useMode) == 0 || (mode & NOPARAMS) != 0) { illegal(); } mode = useMode; return typeArguments(); } return null; }
/** VariableInitializer = ArrayInitializer | Expression */ public JCExpression variableInitializer() { return S.token() == LBRACE ? arrayInitializer(S.pos(), null) : expression(); }
/** VariableInitializer = ArrayInitializer | Expression */ public JCExpression variableInitializer() { return S.token() == LBRACE ? arrayInitializer(S.pos(), null) : expression(); }
/** AnnotationsOpt = { '@' Annotation } */ List<JCAnnotation> annotationsOpt() { if (S.token() != MONKEYS_AT) return List.nil(); // optimization ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>(); while (S.token() == MONKEYS_AT) { int pos = S.pos(); S.nextToken(); buf.append(annotation(pos)); } return buf.toList(); }
/** AnnotationsOpt = { '@' Annotation } */ List<JCAnnotation> annotationsOpt() { if (S.token() != MONKEYS_AT) return List.nil(); // optimization ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>(); while (S.token() == MONKEYS_AT) { int pos = S.pos(); S.nextToken(); buf.append(annotation(pos)); } return buf.toList(); }
/** 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; }
/** 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; }
/** 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)); } }
/** 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; }
/** QualidentList = Qualident {"," Qualident} */ List<JCExpression> qualidentList() { ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>(); ts.append(qualident()); while (S.token() == COMMA) { S.nextToken(); ts.append(qualident()); } return ts.toList(); }
/** QualidentList = Qualident {"," Qualident} */ List<JCExpression> qualidentList() { ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>(); ts.append(qualident()); while (S.token() == COMMA) { S.nextToken(); ts.append(qualident()); } return ts.toList(); }
/** TypeList = Type {"," Type} */ List<JCExpression> typeList() { ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>(); ts.append(type()); while (S.token() == COMMA) { S.nextToken(); ts.append(type()); } return ts.toList(); }
/** TypeList = Type {"," Type} */ List<JCExpression> typeList() { ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>(); ts.append(type()); while (S.token() == COMMA) { S.nextToken(); ts.append(type()); } return ts.toList(); }
/** InnerCreator = Ident [TypeArguments] ClassCreatorRest */ JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) { JCExpression t = toP(F.at(S.pos()).Ident(ident())); if (S.token() == LT) { checkGenerics(); t = typeArguments(t); } return classCreatorRest(newpos, encl, typeArgs, t); }
/** * Qualident = Ident { DOT Ident } */ public JCExpression qualident() { JCExpression t = toP(F.at(S.pos()).Ident(ident())); while (S.token() == DOT) { int pos = S.pos(); S.nextToken(); t = toP(F.at(pos).Select(t, ident())); } return t; }