231 TRANSIENT(TokenKind.TRANSIENT, XDECL1), // transient |
231 TRANSIENT(TokenKind.TRANSIENT, XDECL1), // transient |
232 VOLATILE(TokenKind.VOLATILE, XDECL1), // volatile |
232 VOLATILE(TokenKind.VOLATILE, XDECL1), // volatile |
233 |
233 |
234 // Declarations and type parameters (thus expressions) |
234 // Declarations and type parameters (thus expressions) |
235 EXTENDS(TokenKind.EXTENDS, XEXPR|XDECL), // extends |
235 EXTENDS(TokenKind.EXTENDS, XEXPR|XDECL), // extends |
236 COMMA(TokenKind.COMMA, XEXPR|XDECL|XTERM), // , |
236 COMMA(TokenKind.COMMA, XEXPR|XDECL), // , |
237 AMP(TokenKind.AMP, XEXPR|XDECL), // & |
237 AMP(TokenKind.AMP, XEXPR|XDECL), // & |
238 GT(TokenKind.GT, XEXPR|XDECL), // > |
238 GT(TokenKind.GT, XEXPR|XDECL), // > |
239 LT(TokenKind.LT, XEXPR|XDECL1), // < |
239 LT(TokenKind.LT, XEXPR|XDECL1), // < |
240 LTLT(TokenKind.LTLT, XEXPR|XDECL1), // << |
240 LTLT(TokenKind.LTLT, XEXPR|XDECL1), // << |
241 GTGT(TokenKind.GTGT, XEXPR|XDECL), // >> |
241 GTGT(TokenKind.GTGT, XEXPR|XDECL), // >> |
539 break; |
539 break; |
540 default: |
540 default: |
541 ct = new CT(TK.tokenKindToTK(prevTK, current.kind), advance()); |
541 ct = new CT(TK.tokenKindToTK(prevTK, current.kind), advance()); |
542 break; |
542 break; |
543 } |
543 } |
544 if (ct.kind.isStart() && !prevTK.isOkToTerminate()) { |
544 // Detect an error if we are at starting position and the last |
|
545 // token wasn't a terminating one. Special case: within braces, |
|
546 // comma can proceed semicolon, e.g. the values list in enum |
|
547 if (ct.kind.isStart() && !prevTK.isOkToTerminate() && prevTK != COMMA) { |
545 return new CT(ERROR, current, "No '" + prevTK + "' before '" + ct.kind + "'"); |
548 return new CT(ERROR, current, "No '" + prevTK + "' before '" + ct.kind + "'"); |
546 } |
549 } |
547 if (stack.isEmpty() || ct.kind.isError()) { |
550 if (stack.isEmpty() || ct.kind.isError()) { |
548 return ct; |
551 return ct; |
549 } |
552 } |
651 isBracesNeeded |= token.kind.isBracesNeeded(); |
654 isBracesNeeded |= token.kind.isBracesNeeded(); |
652 nextToken(); |
655 nextToken(); |
653 } |
656 } |
654 switch (token.kind) { |
657 switch (token.kind) { |
655 case EQ: |
658 case EQ: |
656 // Check for array initializer |
659 nextToken(); |
657 nextToken(); |
|
658 if (token.kind == BRACES) { |
|
659 nextToken(); |
|
660 return lastly(SEMI); |
|
661 } |
|
662 return parseExpressionStatement(); |
660 return parseExpressionStatement(); |
663 case BRACES: |
661 case BRACES: |
664 case SEMI: |
662 case SEMI: |
665 nextToken(); |
663 nextToken(); |
666 return Completeness.COMPLETE; |
664 return Completeness.COMPLETE; |