/** Expression1Rest = ["?" Expression ":" Expression1] */ JCExpression term1Rest(JCExpression t) { if (S.token() == QUES) { int pos = S.pos(); S.nextToken(); JCExpression t1 = term(); accept(COLON); JCExpression t2 = term1(); return F.at(pos).Conditional(t, t1, t2); } else { return t; } }
/** Expression1Rest = ["?" Expression ":" Expression1] */ JCExpression term1Rest(JCExpression t) { if (S.token() == QUES) { int pos = S.pos(); S.nextToken(); JCExpression t1 = term(); accept(COLON); JCExpression t2 = term1(); return F.at(pos).Conditional(t, t1, t2); } else { return t; } }
/** * Expression = Expression1 [ExpressionRest] * ExpressionRest = [AssignmentOperator Expression1] * AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | * "&=" | "|=" | "^=" | * "%=" | "<<=" | ">>=" | ">>>=" * Type = Type1 * TypeNoParams = TypeNoParams1 * StatementExpression = Expression * ConstantExpression = Expression */ JCExpression term() { JCExpression t = term1(); if ((mode & EXPR) != 0 && S.token() == EQ || PLUSEQ.compareTo(S.token()) <= 0 && S.token().compareTo(GTGTGTEQ) <= 0) return termRest(t); else return t; }
/** * Expression = Expression1 [ExpressionRest] * ExpressionRest = [AssignmentOperator Expression1] * AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | * "&=" | "|=" | "^=" | * "%=" | "<<=" | ">>=" | ">>>=" * Type = Type1 * TypeNoParams = TypeNoParams1 * StatementExpression = Expression * ConstantExpression = Expression */ JCExpression term() { JCExpression t = term1(); if ((mode & EXPR) != 0 && S.token() == EQ || PLUSEQ.compareTo(S.token()) <= 0 && S.token().compareTo(GTGTGTEQ) <= 0) return termRest(t); else return t; }
/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (S.token() == IDENTIFIER) { mode = EXPR; JCExpression t1 = term1(); if (t1.tag == JCTree.IDENT && S.token() == EQ) { int pos = S.pos(); accept(EQ); return toP(F.at(pos).Assign(t1, annotationValue())); } else { return t1; } } return annotationValue(); }
/** AnnotationFieldValue = AnnotationValue * | Identifier "=" AnnotationValue */ JCExpression annotationFieldValue() { if (S.token() == IDENTIFIER) { mode = EXPR; JCExpression t1 = term1(); if (t1.getTag() == JCTree.IDENT && S.token() == EQ) { int pos = S.pos(); accept(EQ); return toP(F.at(pos).Assign(t1, annotationValue())); } else { return t1; } } return annotationValue(); }
JCExpression annotationValue() { int pos; switch (S.token()) { case MONKEYS_AT: pos = S.pos(); S.nextToken(); return annotation(pos); case LBRACE: pos = S.pos(); accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (S.token() != RBRACE) { buf.append(annotationValue()); while (S.token() == COMMA) { S.nextToken(); if (S.token() == RPAREN) break; buf.append(annotationValue()); } } accept(RBRACE); return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList())); default: mode = EXPR; return term1(); } }
JCExpression annotationValue() { int pos; switch (S.token()) { case MONKEYS_AT: pos = S.pos(); S.nextToken(); return annotation(pos); case LBRACE: pos = S.pos(); accept(LBRACE); ListBuffer<JCExpression> buf = new ListBuffer<JCExpression>(); if (S.token() != RBRACE) { buf.append(annotationValue()); while (S.token() == COMMA) { S.nextToken(); if (S.token() == RBRACE) break; buf.append(annotationValue()); } } accept(RBRACE); return toP(F.at(pos).NewArray(null, List.<JCExpression>nil(), buf.toList())); default: mode = EXPR; return term1(); } }