equal
deleted
inserted
replaced
668 mode = prevmode; |
668 mode = prevmode; |
669 return t; |
669 return t; |
670 } |
670 } |
671 |
671 |
672 /** |
672 /** |
|
673 * {@literal |
673 * Expression = Expression1 [ExpressionRest] |
674 * Expression = Expression1 [ExpressionRest] |
674 * ExpressionRest = [AssignmentOperator Expression1] |
675 * ExpressionRest = [AssignmentOperator Expression1] |
675 * AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | |
676 * AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | |
676 * "&=" | "|=" | "^=" | |
677 * "&=" | "|=" | "^=" | |
677 * "%=" | "<<=" | ">>=" | ">>>=" |
678 * "%=" | "<<=" | ">>=" | ">>>=" |
678 * Type = Type1 |
679 * Type = Type1 |
679 * TypeNoParams = TypeNoParams1 |
680 * TypeNoParams = TypeNoParams1 |
680 * StatementExpression = Expression |
681 * StatementExpression = Expression |
681 * ConstantExpression = Expression |
682 * ConstantExpression = Expression |
|
683 * } |
682 */ |
684 */ |
683 JCExpression term() { |
685 JCExpression term() { |
684 JCExpression t = term1(); |
686 JCExpression t = term1(); |
685 if ((mode & EXPR) != 0 && |
687 if ((mode & EXPR) != 0 && |
686 token.kind == EQ || PLUSEQ.compareTo(token.kind) <= 0 && token.kind.compareTo(GTGTGTEQ) <= 0) |
688 token.kind == EQ || PLUSEQ.compareTo(token.kind) <= 0 && token.kind.compareTo(GTGTGTEQ) <= 0) |
882 Token[] opStack = opStackSupply.elems.head; |
884 Token[] opStack = opStackSupply.elems.head; |
883 opStackSupply.elems = opStackSupply.elems.tail; |
885 opStackSupply.elems = opStackSupply.elems.tail; |
884 return opStack; |
886 return opStack; |
885 } |
887 } |
886 |
888 |
887 /** Expression3 = PrefixOp Expression3 |
889 /** |
|
890 * Expression3 = PrefixOp Expression3 |
888 * | "(" Expr | TypeNoParams ")" Expression3 |
891 * | "(" Expr | TypeNoParams ")" Expression3 |
889 * | Primary {Selector} {PostfixOp} |
892 * | Primary {Selector} {PostfixOp} |
|
893 * |
|
894 * {@literal |
890 * Primary = "(" Expression ")" |
895 * Primary = "(" Expression ")" |
891 * | Literal |
896 * | Literal |
892 * | [TypeArguments] THIS [Arguments] |
897 * | [TypeArguments] THIS [Arguments] |
893 * | [TypeArguments] SUPER SuperSuffix |
898 * | [TypeArguments] SUPER SuperSuffix |
894 * | NEW [TypeArguments] Creator |
899 * | NEW [TypeArguments] Creator |
899 * [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" ) |
904 * [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" ) |
900 * | Arguments |
905 * | Arguments |
901 * | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator ) |
906 * | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator ) |
902 * ] |
907 * ] |
903 * | BasicType BracketsOpt "." CLASS |
908 * | BasicType BracketsOpt "." CLASS |
|
909 * } |
|
910 * |
904 * PrefixOp = "++" | "--" | "!" | "~" | "+" | "-" |
911 * PrefixOp = "++" | "--" | "!" | "~" | "+" | "-" |
905 * PostfixOp = "++" | "--" |
912 * PostfixOp = "++" | "--" |
906 * Type3 = Ident { "." Ident } [TypeArguments] {TypeSelector} BracketsOpt |
913 * Type3 = Ident { "." Ident } [TypeArguments] {TypeSelector} BracketsOpt |
907 * | BasicType |
914 * | BasicType |
908 * TypeNoParams3 = Ident { "." Ident } BracketsOpt |
915 * TypeNoParams3 = Ident { "." Ident } BracketsOpt |
1451 return typeArguments(false); |
1458 return typeArguments(false); |
1452 } |
1459 } |
1453 return null; |
1460 return null; |
1454 } |
1461 } |
1455 |
1462 |
1456 /** TypeArguments = "<" TypeArgument {"," TypeArgument} ">" |
1463 /** |
|
1464 * {@literal |
|
1465 * TypeArguments = "<" TypeArgument {"," TypeArgument} ">" |
|
1466 * } |
1457 */ |
1467 */ |
1458 List<JCExpression> typeArguments(boolean diamondAllowed) { |
1468 List<JCExpression> typeArguments(boolean diamondAllowed) { |
1459 if (token.kind == LT) { |
1469 if (token.kind == LT) { |
1460 nextToken(); |
1470 nextToken(); |
1461 if (token.kind == GT && diamondAllowed) { |
1471 if (token.kind == GT && diamondAllowed) { |
1488 } else { |
1498 } else { |
1489 return List.<JCExpression>of(syntaxError(token.pos, "expected", LT)); |
1499 return List.<JCExpression>of(syntaxError(token.pos, "expected", LT)); |
1490 } |
1500 } |
1491 } |
1501 } |
1492 |
1502 |
1493 /** TypeArgument = Type |
1503 /** |
|
1504 * {@literal |
|
1505 * TypeArgument = Type |
1494 * | "?" |
1506 * | "?" |
1495 * | "?" EXTENDS Type {"&" Type} |
1507 * | "?" EXTENDS Type {"&" Type} |
1496 * | "?" SUPER Type |
1508 * | "?" SUPER Type |
|
1509 * } |
1497 */ |
1510 */ |
1498 JCExpression typeArgument() { |
1511 JCExpression typeArgument() { |
1499 if (token.kind != QUES) return parseType(); |
1512 if (token.kind != QUES) return parseType(); |
1500 int pos = token.pos; |
1513 int pos = token.pos; |
1501 nextToken(); |
1514 nextToken(); |
2989 ts.append(qualident()); |
3002 ts.append(qualident()); |
2990 } |
3003 } |
2991 return ts.toList(); |
3004 return ts.toList(); |
2992 } |
3005 } |
2993 |
3006 |
2994 /** TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"] |
3007 /** |
|
3008 * {@literal |
|
3009 * TypeParametersOpt = ["<" TypeParameter {"," TypeParameter} ">"] |
|
3010 * } |
2995 */ |
3011 */ |
2996 List<JCTypeParameter> typeParametersOpt() { |
3012 List<JCTypeParameter> typeParametersOpt() { |
2997 if (token.kind == LT) { |
3013 if (token.kind == LT) { |
2998 checkGenerics(); |
3014 checkGenerics(); |
2999 ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>(); |
3015 ListBuffer<JCTypeParameter> typarams = new ListBuffer<JCTypeParameter>(); |
3008 } else { |
3024 } else { |
3009 return List.nil(); |
3025 return List.nil(); |
3010 } |
3026 } |
3011 } |
3027 } |
3012 |
3028 |
3013 /** TypeParameter = TypeVariable [TypeParameterBound] |
3029 /** |
|
3030 * {@literal |
|
3031 * TypeParameter = TypeVariable [TypeParameterBound] |
3014 * TypeParameterBound = EXTENDS Type {"&" Type} |
3032 * TypeParameterBound = EXTENDS Type {"&" Type} |
3015 * TypeVariable = Ident |
3033 * TypeVariable = Ident |
|
3034 * } |
3016 */ |
3035 */ |
3017 JCTypeParameter typeParameter() { |
3036 JCTypeParameter typeParameter() { |
3018 int pos = token.pos; |
3037 int pos = token.pos; |
3019 Name name = ident(); |
3038 Name name = ident(); |
3020 ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>(); |
3039 ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>(); |