| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.parser; | 3 library engine.parser; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'instrumentation.dart'; | 7 import 'instrumentation.dart'; |
| 8 import 'error.dart'; | 8 import 'error.dart'; |
| 9 import 'source.dart'; | 9 import 'source.dart'; |
| 10 import 'scanner.dart'; | 10 import 'scanner.dart'; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 * primary (arguments* assignableSelector)+ | 510 * primary (arguments* assignableSelector)+ |
| 511 * | 'super' assignableSelector | 511 * | 'super' assignableSelector |
| 512 * | identifier | 512 * | identifier |
| 513 * assignableSelector ::= | 513 * assignableSelector ::= |
| 514 * '\[' expression '\]' | 514 * '\[' expression '\]' |
| 515 * | '.' identifier | 515 * | '.' identifier |
| 516 * </pre> | 516 * </pre> |
| 517 * @param expression the expression being checked | 517 * @param expression the expression being checked |
| 518 */ | 518 */ |
| 519 void ensureAssignable(Expression expression) { | 519 void ensureAssignable(Expression expression) { |
| 520 if (expression != null && !expression.isAssignable()) { | 520 if (expression != null && !expression.isAssignable) { |
| 521 reportError7(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []); | 521 reportError7(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []); |
| 522 } | 522 } |
| 523 } | 523 } |
| 524 | 524 |
| 525 /** | 525 /** |
| 526 * If the current token is a keyword matching the given string, return it afte
r advancing to the | 526 * If the current token is a keyword matching the given string, return it afte
r advancing to the |
| 527 * next token. Otherwise report an error and return the current token without
advancing. | 527 * next token. Otherwise report an error and return the current token without
advancing. |
| 528 * @param keyword the keyword that is expected | 528 * @param keyword the keyword that is expected |
| 529 * @return the token that matched the given type | 529 * @return the token that matched the given type |
| 530 */ | 530 */ |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 if (next == null) { | 650 if (next == null) { |
| 651 return false; | 651 return false; |
| 652 } | 652 } |
| 653 return matchesIdentifier2(next); | 653 return matchesIdentifier2(next); |
| 654 } | 654 } |
| 655 | 655 |
| 656 /** | 656 /** |
| 657 * Return `true` if the current token appears to be the beginning of a functio
n declaration. | 657 * Return `true` if the current token appears to be the beginning of a functio
n declaration. |
| 658 * @return `true` if the current token appears to be the beginning of a functi
on declaration | 658 * @return `true` if the current token appears to be the beginning of a functi
on declaration |
| 659 */ | 659 */ |
| 660 bool isFunctionDeclaration() { | 660 bool get isFunctionDeclaration { |
| 661 if (matches(Keyword.VOID)) { | 661 if (matches(Keyword.VOID)) { |
| 662 return true; | 662 return true; |
| 663 } | 663 } |
| 664 Token afterReturnType = skipTypeName(_currentToken); | 664 Token afterReturnType = skipTypeName(_currentToken); |
| 665 if (afterReturnType == null) { | 665 if (afterReturnType == null) { |
| 666 afterReturnType = _currentToken; | 666 afterReturnType = _currentToken; |
| 667 } | 667 } |
| 668 Token afterIdentifier = skipSimpleIdentifier(afterReturnType); | 668 Token afterIdentifier = skipSimpleIdentifier(afterReturnType); |
| 669 if (afterIdentifier == null) { | 669 if (afterIdentifier == null) { |
| 670 afterIdentifier = skipSimpleIdentifier(_currentToken); | 670 afterIdentifier = skipSimpleIdentifier(_currentToken); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 * | 'var' | 710 * | 'var' |
| 711 * | type | 711 * | type |
| 712 * type ::= | 712 * type ::= |
| 713 * qualified typeArguments? | 713 * qualified typeArguments? |
| 714 * initializedIdentifier ::= | 714 * initializedIdentifier ::= |
| 715 * identifier ('=' expression)? | 715 * identifier ('=' expression)? |
| 716 * </pre> | 716 * </pre> |
| 717 * @return `true` if the current token is the first token in an initialized va
riable | 717 * @return `true` if the current token is the first token in an initialized va
riable |
| 718 * declaration | 718 * declaration |
| 719 */ | 719 */ |
| 720 bool isInitializedVariableDeclaration() { | 720 bool get isInitializedVariableDeclaration { |
| 721 if (matches(Keyword.FINAL) || matches(Keyword.VAR)) { | 721 if (matches(Keyword.FINAL) || matches(Keyword.VAR)) { |
| 722 return true; | 722 return true; |
| 723 } | 723 } |
| 724 if (matches(Keyword.CONST)) { | 724 if (matches(Keyword.CONST)) { |
| 725 return !matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, To
kenType.OPEN_SQUARE_BRACKET, TokenType.INDEX]); | 725 return !matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, To
kenType.OPEN_SQUARE_BRACKET, TokenType.INDEX]); |
| 726 } | 726 } |
| 727 Token token = skipTypeName(_currentToken); | 727 Token token = skipTypeName(_currentToken); |
| 728 if (token == null) { | 728 if (token == null) { |
| 729 return false; | 729 return false; |
| 730 } | 730 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 } | 766 } |
| 767 return nextChar == 0x5B; | 767 return nextChar == 0x5B; |
| 768 } | 768 } |
| 769 | 769 |
| 770 /** | 770 /** |
| 771 * Return `true` if the given token appears to be the beginning of an operator
declaration. | 771 * Return `true` if the given token appears to be the beginning of an operator
declaration. |
| 772 * @param startToken the token that might be the start of an operator declarat
ion | 772 * @param startToken the token that might be the start of an operator declarat
ion |
| 773 * @return `true` if the given token appears to be the beginning of an operato
r declaration | 773 * @return `true` if the given token appears to be the beginning of an operato
r declaration |
| 774 */ | 774 */ |
| 775 bool isOperator(Token startToken) { | 775 bool isOperator(Token startToken) { |
| 776 if (startToken.isOperator()) { | 776 if (startToken.isOperator) { |
| 777 Token token = startToken.next; | 777 Token token = startToken.next; |
| 778 while (token.isOperator()) { | 778 while (token.isOperator) { |
| 779 token = token.next; | 779 token = token.next; |
| 780 } | 780 } |
| 781 return matches4(token, TokenType.OPEN_PAREN); | 781 return matches4(token, TokenType.OPEN_PAREN); |
| 782 } | 782 } |
| 783 return false; | 783 return false; |
| 784 } | 784 } |
| 785 | 785 |
| 786 /** | 786 /** |
| 787 * Return `true` if the current token appears to be the beginning of a switch
member. | 787 * Return `true` if the current token appears to be the beginning of a switch
member. |
| 788 * @return `true` if the current token appears to be the beginning of a switch
member | 788 * @return `true` if the current token appears to be the beginning of a switch
member |
| 789 */ | 789 */ |
| 790 bool isSwitchMember() { | 790 bool get isSwitchMember { |
| 791 Token token = _currentToken; | 791 Token token = _currentToken; |
| 792 while (matches4(token, TokenType.IDENTIFIER) && matches4(token.next, TokenTy
pe.COLON)) { | 792 while (matches4(token, TokenType.IDENTIFIER) && matches4(token.next, TokenTy
pe.COLON)) { |
| 793 token = token.next.next; | 793 token = token.next.next; |
| 794 } | 794 } |
| 795 if (identical(token.type, TokenType.KEYWORD)) { | 795 if (identical(token.type, TokenType.KEYWORD)) { |
| 796 Keyword keyword = ((token as KeywordToken)).keyword; | 796 Keyword keyword = ((token as KeywordToken)).keyword; |
| 797 return identical(keyword, Keyword.CASE) || identical(keyword, Keyword.DEFA
ULT); | 797 return identical(keyword, Keyword.CASE) || identical(keyword, Keyword.DEFA
ULT); |
| 798 } | 798 } |
| 799 return false; | 799 return false; |
| 800 } | 800 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 * built-in identifiers (pseudo-keywords). | 921 * built-in identifiers (pseudo-keywords). |
| 922 * @return `true` if the current token is a valid identifier | 922 * @return `true` if the current token is a valid identifier |
| 923 */ | 923 */ |
| 924 bool matchesIdentifier() => matchesIdentifier2(_currentToken); | 924 bool matchesIdentifier() => matchesIdentifier2(_currentToken); |
| 925 | 925 |
| 926 /** | 926 /** |
| 927 * Return `true` if the given token is a valid identifier. Valid identifiers i
nclude | 927 * Return `true` if the given token is a valid identifier. Valid identifiers i
nclude |
| 928 * built-in identifiers (pseudo-keywords). | 928 * built-in identifiers (pseudo-keywords). |
| 929 * @return `true` if the given token is a valid identifier | 929 * @return `true` if the given token is a valid identifier |
| 930 */ | 930 */ |
| 931 bool matchesIdentifier2(Token token) => matches4(token, TokenType.IDENTIFIER)
|| (matches4(token, TokenType.KEYWORD) && ((token as KeywordToken)).keyword.isPs
eudoKeyword()); | 931 bool matchesIdentifier2(Token token) => matches4(token, TokenType.IDENTIFIER)
|| (matches4(token, TokenType.KEYWORD) && ((token as KeywordToken)).keyword.isPs
eudoKeyword); |
| 932 | 932 |
| 933 /** | 933 /** |
| 934 * If the current token has the given type, then advance to the next token and
return `true`. Otherwise, return `false` without advancing. | 934 * If the current token has the given type, then advance to the next token and
return `true`. Otherwise, return `false` without advancing. |
| 935 * @param type the type of token that can optionally appear in the current loc
ation | 935 * @param type the type of token that can optionally appear in the current loc
ation |
| 936 * @return `true` if the current token has the given type | 936 * @return `true` if the current token has the given type |
| 937 */ | 937 */ |
| 938 bool optional(TokenType type) { | 938 bool optional(TokenType type) { |
| 939 if (matches5(type)) { | 939 if (matches5(type)) { |
| 940 advance(); | 940 advance(); |
| 941 return true; | 941 return true; |
| 942 } | 942 } |
| 943 return false; | 943 return false; |
| 944 } | 944 } |
| 945 | 945 |
| 946 /** | 946 /** |
| 947 * Parse an additive expression. | 947 * Parse an additive expression. |
| 948 * <pre> | 948 * <pre> |
| 949 * additiveExpression ::= | 949 * additiveExpression ::= |
| 950 * multiplicativeExpression (additiveOperator multiplicativeExpression) | 950 * multiplicativeExpression (additiveOperator multiplicativeExpression) |
| 951 * | 'super' (additiveOperator multiplicativeExpression)+ | 951 * | 'super' (additiveOperator multiplicativeExpression)+ |
| 952 * </pre> | 952 * </pre> |
| 953 * @return the additive expression that was parsed | 953 * @return the additive expression that was parsed |
| 954 */ | 954 */ |
| 955 Expression parseAdditiveExpression() { | 955 Expression parseAdditiveExpression() { |
| 956 Expression expression; | 956 Expression expression; |
| 957 if (matches(Keyword.SUPER) && _currentToken.next.type.isAdditiveOperator())
{ | 957 if (matches(Keyword.SUPER) && _currentToken.next.type.isAdditiveOperator) { |
| 958 expression = new SuperExpression.full(andAdvance); | 958 expression = new SuperExpression.full(andAdvance); |
| 959 } else { | 959 } else { |
| 960 expression = parseMultiplicativeExpression(); | 960 expression = parseMultiplicativeExpression(); |
| 961 } | 961 } |
| 962 while (_currentToken.type.isAdditiveOperator()) { | 962 while (_currentToken.type.isAdditiveOperator) { |
| 963 Token operator = andAdvance; | 963 Token operator = andAdvance; |
| 964 expression = new BinaryExpression.full(expression, operator, parseMultipli
cativeExpression()); | 964 expression = new BinaryExpression.full(expression, operator, parseMultipli
cativeExpression()); |
| 965 } | 965 } |
| 966 return expression; | 966 return expression; |
| 967 } | 967 } |
| 968 | 968 |
| 969 /** | 969 /** |
| 970 * Parse an annotation. | 970 * Parse an annotation. |
| 971 * <pre> | 971 * <pre> |
| 972 * annotation ::= | 972 * annotation ::= |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 progress = false; | 1323 progress = false; |
| 1324 Expression selector = parseAssignableSelector(expression, true); | 1324 Expression selector = parseAssignableSelector(expression, true); |
| 1325 if (selector != expression) { | 1325 if (selector != expression) { |
| 1326 expression = selector; | 1326 expression = selector; |
| 1327 progress = true; | 1327 progress = true; |
| 1328 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) { | 1328 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) { |
| 1329 expression = new FunctionExpressionInvocation.full(expression, parseAr
gumentList()); | 1329 expression = new FunctionExpressionInvocation.full(expression, parseAr
gumentList()); |
| 1330 } | 1330 } |
| 1331 } | 1331 } |
| 1332 } | 1332 } |
| 1333 if (_currentToken.type.isAssignmentOperator()) { | 1333 if (_currentToken.type.isAssignmentOperator) { |
| 1334 Token operator = andAdvance; | 1334 Token operator = andAdvance; |
| 1335 ensureAssignable(expression); | 1335 ensureAssignable(expression); |
| 1336 expression = new AssignmentExpression.full(expression, operator, parseExpr
essionWithoutCascade()); | 1336 expression = new AssignmentExpression.full(expression, operator, parseExpr
essionWithoutCascade()); |
| 1337 } | 1337 } |
| 1338 return expression; | 1338 return expression; |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 /** | 1341 /** |
| 1342 * Parse a class declaration. | 1342 * Parse a class declaration. |
| 1343 * <pre> | 1343 * <pre> |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 * Parse an equality expression. | 2197 * Parse an equality expression. |
| 2198 * <pre> | 2198 * <pre> |
| 2199 * equalityExpression ::= | 2199 * equalityExpression ::= |
| 2200 * relationalExpression (equalityOperator relationalExpression)? | 2200 * relationalExpression (equalityOperator relationalExpression)? |
| 2201 * | 'super' equalityOperator relationalExpression | 2201 * | 'super' equalityOperator relationalExpression |
| 2202 * </pre> | 2202 * </pre> |
| 2203 * @return the equality expression that was parsed | 2203 * @return the equality expression that was parsed |
| 2204 */ | 2204 */ |
| 2205 Expression parseEqualityExpression() { | 2205 Expression parseEqualityExpression() { |
| 2206 Expression expression; | 2206 Expression expression; |
| 2207 if (matches(Keyword.SUPER) && _currentToken.next.type.isEqualityOperator())
{ | 2207 if (matches(Keyword.SUPER) && _currentToken.next.type.isEqualityOperator) { |
| 2208 expression = new SuperExpression.full(andAdvance); | 2208 expression = new SuperExpression.full(andAdvance); |
| 2209 } else { | 2209 } else { |
| 2210 expression = parseRelationalExpression(); | 2210 expression = parseRelationalExpression(); |
| 2211 } | 2211 } |
| 2212 while (_currentToken.type.isEqualityOperator()) { | 2212 while (_currentToken.type.isEqualityOperator) { |
| 2213 Token operator = andAdvance; | 2213 Token operator = andAdvance; |
| 2214 expression = new BinaryExpression.full(expression, operator, parseRelation
alExpression()); | 2214 expression = new BinaryExpression.full(expression, operator, parseRelation
alExpression()); |
| 2215 } | 2215 } |
| 2216 return expression; | 2216 return expression; |
| 2217 } | 2217 } |
| 2218 | 2218 |
| 2219 /** | 2219 /** |
| 2220 * Parse an export directive. | 2220 * Parse an export directive. |
| 2221 * <pre> | 2221 * <pre> |
| 2222 * exportDirective ::= | 2222 * exportDirective ::= |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 if (identical(tokenType, TokenType.PERIOD_PERIOD)) { | 2254 if (identical(tokenType, TokenType.PERIOD_PERIOD)) { |
| 2255 List<Expression> cascadeSections = new List<Expression>(); | 2255 List<Expression> cascadeSections = new List<Expression>(); |
| 2256 while (identical(tokenType, TokenType.PERIOD_PERIOD)) { | 2256 while (identical(tokenType, TokenType.PERIOD_PERIOD)) { |
| 2257 Expression section = parseCascadeSection(); | 2257 Expression section = parseCascadeSection(); |
| 2258 if (section != null) { | 2258 if (section != null) { |
| 2259 cascadeSections.add(section); | 2259 cascadeSections.add(section); |
| 2260 } | 2260 } |
| 2261 tokenType = _currentToken.type; | 2261 tokenType = _currentToken.type; |
| 2262 } | 2262 } |
| 2263 return new CascadeExpression.full(expression, cascadeSections); | 2263 return new CascadeExpression.full(expression, cascadeSections); |
| 2264 } else if (tokenType.isAssignmentOperator()) { | 2264 } else if (tokenType.isAssignmentOperator) { |
| 2265 Token operator = andAdvance; | 2265 Token operator = andAdvance; |
| 2266 ensureAssignable(expression); | 2266 ensureAssignable(expression); |
| 2267 return new AssignmentExpression.full(expression, operator, parseExpression
2()); | 2267 return new AssignmentExpression.full(expression, operator, parseExpression
2()); |
| 2268 } | 2268 } |
| 2269 return expression; | 2269 return expression; |
| 2270 } | 2270 } |
| 2271 | 2271 |
| 2272 /** | 2272 /** |
| 2273 * Parse a list of expressions. | 2273 * Parse a list of expressions. |
| 2274 * <pre> | 2274 * <pre> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2296 * </pre> | 2296 * </pre> |
| 2297 * @return the expression that was parsed | 2297 * @return the expression that was parsed |
| 2298 */ | 2298 */ |
| 2299 Expression parseExpressionWithoutCascade() { | 2299 Expression parseExpressionWithoutCascade() { |
| 2300 if (matches(Keyword.THROW)) { | 2300 if (matches(Keyword.THROW)) { |
| 2301 return parseThrowExpressionWithoutCascade(); | 2301 return parseThrowExpressionWithoutCascade(); |
| 2302 } else if (matches(Keyword.RETHROW)) { | 2302 } else if (matches(Keyword.RETHROW)) { |
| 2303 return parseRethrowExpression(); | 2303 return parseRethrowExpression(); |
| 2304 } | 2304 } |
| 2305 Expression expression = parseConditionalExpression(); | 2305 Expression expression = parseConditionalExpression(); |
| 2306 if (_currentToken.type.isAssignmentOperator()) { | 2306 if (_currentToken.type.isAssignmentOperator) { |
| 2307 Token operator = andAdvance; | 2307 Token operator = andAdvance; |
| 2308 ensureAssignable(expression); | 2308 ensureAssignable(expression); |
| 2309 expression = new AssignmentExpression.full(expression, operator, parseExpr
essionWithoutCascade()); | 2309 expression = new AssignmentExpression.full(expression, operator, parseExpr
essionWithoutCascade()); |
| 2310 } | 2310 } |
| 2311 return expression; | 2311 return expression; |
| 2312 } | 2312 } |
| 2313 | 2313 |
| 2314 /** | 2314 /** |
| 2315 * Parse a class extends clause. | 2315 * Parse a class extends clause. |
| 2316 * <pre> | 2316 * <pre> |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 Token leftParenthesis = expect2(TokenType.OPEN_PAREN); | 2541 Token leftParenthesis = expect2(TokenType.OPEN_PAREN); |
| 2542 VariableDeclarationList variableList = null; | 2542 VariableDeclarationList variableList = null; |
| 2543 Expression initialization = null; | 2543 Expression initialization = null; |
| 2544 if (!matches5(TokenType.SEMICOLON)) { | 2544 if (!matches5(TokenType.SEMICOLON)) { |
| 2545 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); | 2545 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); |
| 2546 if (matchesIdentifier() && matches3(peek(), Keyword.IN)) { | 2546 if (matchesIdentifier() && matches3(peek(), Keyword.IN)) { |
| 2547 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 2547 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
| 2548 SimpleIdentifier variableName = parseSimpleIdentifier(); | 2548 SimpleIdentifier variableName = parseSimpleIdentifier(); |
| 2549 variables.add(new VariableDeclaration.full(null, null, variableName, n
ull, null)); | 2549 variables.add(new VariableDeclaration.full(null, null, variableName, n
ull, null)); |
| 2550 variableList = new VariableDeclarationList.full(commentAndMetadata.com
ment, commentAndMetadata.metadata, null, null, variables); | 2550 variableList = new VariableDeclarationList.full(commentAndMetadata.com
ment, commentAndMetadata.metadata, null, null, variables); |
| 2551 } else if (isInitializedVariableDeclaration()) { | 2551 } else if (isInitializedVariableDeclaration) { |
| 2552 variableList = parseVariableDeclarationList(commentAndMetadata); | 2552 variableList = parseVariableDeclarationList(commentAndMetadata); |
| 2553 } else { | 2553 } else { |
| 2554 initialization = parseExpression2(); | 2554 initialization = parseExpression2(); |
| 2555 } | 2555 } |
| 2556 if (matches(Keyword.IN)) { | 2556 if (matches(Keyword.IN)) { |
| 2557 DeclaredIdentifier loopVariable = null; | 2557 DeclaredIdentifier loopVariable = null; |
| 2558 if (variableList == null) { | 2558 if (variableList == null) { |
| 2559 reportError7(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []); | 2559 reportError7(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []); |
| 2560 } else { | 2560 } else { |
| 2561 NodeList<VariableDeclaration> variables = variableList.variables; | 2561 NodeList<VariableDeclaration> variables = variableList.variables; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3252 * Parse a multiplicative expression. | 3252 * Parse a multiplicative expression. |
| 3253 * <pre> | 3253 * <pre> |
| 3254 * multiplicativeExpression ::= | 3254 * multiplicativeExpression ::= |
| 3255 * unaryExpression (multiplicativeOperator unaryExpression) | 3255 * unaryExpression (multiplicativeOperator unaryExpression) |
| 3256 * | 'super' (multiplicativeOperator unaryExpression)+ | 3256 * | 'super' (multiplicativeOperator unaryExpression)+ |
| 3257 * </pre> | 3257 * </pre> |
| 3258 * @return the multiplicative expression that was parsed | 3258 * @return the multiplicative expression that was parsed |
| 3259 */ | 3259 */ |
| 3260 Expression parseMultiplicativeExpression() { | 3260 Expression parseMultiplicativeExpression() { |
| 3261 Expression expression; | 3261 Expression expression; |
| 3262 if (matches(Keyword.SUPER) && _currentToken.next.type.isMultiplicativeOperat
or()) { | 3262 if (matches(Keyword.SUPER) && _currentToken.next.type.isMultiplicativeOperat
or) { |
| 3263 expression = new SuperExpression.full(andAdvance); | 3263 expression = new SuperExpression.full(andAdvance); |
| 3264 } else { | 3264 } else { |
| 3265 expression = parseUnaryExpression(); | 3265 expression = parseUnaryExpression(); |
| 3266 } | 3266 } |
| 3267 while (_currentToken.type.isMultiplicativeOperator()) { | 3267 while (_currentToken.type.isMultiplicativeOperator) { |
| 3268 Token operator = andAdvance; | 3268 Token operator = andAdvance; |
| 3269 expression = new BinaryExpression.full(expression, operator, parseUnaryExp
ression()); | 3269 expression = new BinaryExpression.full(expression, operator, parseUnaryExp
ression()); |
| 3270 } | 3270 } |
| 3271 return expression; | 3271 return expression; |
| 3272 } | 3272 } |
| 3273 | 3273 |
| 3274 /** | 3274 /** |
| 3275 * Parse a new expression. | 3275 * Parse a new expression. |
| 3276 * <pre> | 3276 * <pre> |
| 3277 * newExpression ::= | 3277 * newExpression ::= |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3305 Statement parseNonLabeledStatement() { | 3305 Statement parseNonLabeledStatement() { |
| 3306 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); | 3306 CommentAndMetadata commentAndMetadata = parseCommentAndMetadata(); |
| 3307 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { | 3307 if (matches5(TokenType.OPEN_CURLY_BRACKET)) { |
| 3308 if (matches4(peek(), TokenType.STRING)) { | 3308 if (matches4(peek(), TokenType.STRING)) { |
| 3309 Token afterString = skipStringLiteral(_currentToken.next); | 3309 Token afterString = skipStringLiteral(_currentToken.next); |
| 3310 if (afterString != null && identical(afterString.type, TokenType.COLON))
{ | 3310 if (afterString != null && identical(afterString.type, TokenType.COLON))
{ |
| 3311 return new ExpressionStatement.full(parseExpression2(), expect2(TokenT
ype.SEMICOLON)); | 3311 return new ExpressionStatement.full(parseExpression2(), expect2(TokenT
ype.SEMICOLON)); |
| 3312 } | 3312 } |
| 3313 } | 3313 } |
| 3314 return parseBlock(); | 3314 return parseBlock(); |
| 3315 } else if (matches5(TokenType.KEYWORD) && !((_currentToken as KeywordToken))
.keyword.isPseudoKeyword()) { | 3315 } else if (matches5(TokenType.KEYWORD) && !((_currentToken as KeywordToken))
.keyword.isPseudoKeyword) { |
| 3316 Keyword keyword = ((_currentToken as KeywordToken)).keyword; | 3316 Keyword keyword = ((_currentToken as KeywordToken)).keyword; |
| 3317 if (identical(keyword, Keyword.ASSERT)) { | 3317 if (identical(keyword, Keyword.ASSERT)) { |
| 3318 return parseAssertStatement(); | 3318 return parseAssertStatement(); |
| 3319 } else if (identical(keyword, Keyword.BREAK)) { | 3319 } else if (identical(keyword, Keyword.BREAK)) { |
| 3320 return parseBreakStatement(); | 3320 return parseBreakStatement(); |
| 3321 } else if (identical(keyword, Keyword.CONTINUE)) { | 3321 } else if (identical(keyword, Keyword.CONTINUE)) { |
| 3322 return parseContinueStatement(); | 3322 return parseContinueStatement(); |
| 3323 } else if (identical(keyword, Keyword.DO)) { | 3323 } else if (identical(keyword, Keyword.DO)) { |
| 3324 return parseDoStatement(); | 3324 return parseDoStatement(); |
| 3325 } else if (identical(keyword, Keyword.FOR)) { | 3325 } else if (identical(keyword, Keyword.FOR)) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 } | 3369 } |
| 3370 return parseVariableDeclarationStatement(commentAndMetadata); | 3370 return parseVariableDeclarationStatement(commentAndMetadata); |
| 3371 } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.T
RUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) ||
identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) { | 3371 } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.T
RUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) ||
identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) { |
| 3372 return new ExpressionStatement.full(parseExpression2(), expect2(TokenTyp
e.SEMICOLON)); | 3372 return new ExpressionStatement.full(parseExpression2(), expect2(TokenTyp
e.SEMICOLON)); |
| 3373 } else { | 3373 } else { |
| 3374 reportError7(ParserErrorCode.MISSING_STATEMENT, []); | 3374 reportError7(ParserErrorCode.MISSING_STATEMENT, []); |
| 3375 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON
)); | 3375 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON
)); |
| 3376 } | 3376 } |
| 3377 } else if (matches5(TokenType.SEMICOLON)) { | 3377 } else if (matches5(TokenType.SEMICOLON)) { |
| 3378 return parseEmptyStatement(); | 3378 return parseEmptyStatement(); |
| 3379 } else if (isInitializedVariableDeclaration()) { | 3379 } else if (isInitializedVariableDeclaration) { |
| 3380 return parseVariableDeclarationStatement(commentAndMetadata); | 3380 return parseVariableDeclarationStatement(commentAndMetadata); |
| 3381 } else if (isFunctionDeclaration()) { | 3381 } else if (isFunctionDeclaration) { |
| 3382 return parseFunctionDeclarationStatement(); | 3382 return parseFunctionDeclarationStatement(); |
| 3383 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { | 3383 } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) { |
| 3384 reportError7(ParserErrorCode.MISSING_STATEMENT, []); | 3384 reportError7(ParserErrorCode.MISSING_STATEMENT, []); |
| 3385 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON))
; | 3385 return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON))
; |
| 3386 } else { | 3386 } else { |
| 3387 return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.
SEMICOLON)); | 3387 return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.
SEMICOLON)); |
| 3388 } | 3388 } |
| 3389 } | 3389 } |
| 3390 | 3390 |
| 3391 /** | 3391 /** |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3447 * @return the operator declaration that was parsed | 3447 * @return the operator declaration that was parsed |
| 3448 */ | 3448 */ |
| 3449 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e
xternalKeyword, TypeName returnType) { | 3449 MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token e
xternalKeyword, TypeName returnType) { |
| 3450 Token operatorKeyword; | 3450 Token operatorKeyword; |
| 3451 if (matches(Keyword.OPERATOR)) { | 3451 if (matches(Keyword.OPERATOR)) { |
| 3452 operatorKeyword = andAdvance; | 3452 operatorKeyword = andAdvance; |
| 3453 } else { | 3453 } else { |
| 3454 reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []); | 3454 reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []); |
| 3455 operatorKeyword = createSyntheticToken(Keyword.OPERATOR); | 3455 operatorKeyword = createSyntheticToken(Keyword.OPERATOR); |
| 3456 } | 3456 } |
| 3457 if (!_currentToken.isUserDefinableOperator()) { | 3457 if (!_currentToken.isUserDefinableOperator) { |
| 3458 reportError7(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.l
exeme]); | 3458 reportError7(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.l
exeme]); |
| 3459 } | 3459 } |
| 3460 SimpleIdentifier name = new SimpleIdentifier.full(andAdvance); | 3460 SimpleIdentifier name = new SimpleIdentifier.full(andAdvance); |
| 3461 if (matches5(TokenType.EQ)) { | 3461 if (matches5(TokenType.EQ)) { |
| 3462 Token previous = _currentToken.previous; | 3462 Token previous = _currentToken.previous; |
| 3463 if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.B
ANG_EQ)) && _currentToken.offset == previous.offset + 2) { | 3463 if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.B
ANG_EQ)) && _currentToken.offset == previous.offset + 2) { |
| 3464 reportError7(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_cu
rrentToken.lexeme}"]); | 3464 reportError7(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_cu
rrentToken.lexeme}"]); |
| 3465 advance(); | 3465 advance(); |
| 3466 } | 3466 } |
| 3467 } | 3467 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3536 operand = new MethodInvocation.full(access.target, access.operator,
access.propertyName, argumentList); | 3536 operand = new MethodInvocation.full(access.target, access.operator,
access.propertyName, argumentList); |
| 3537 } else { | 3537 } else { |
| 3538 operand = new FunctionExpressionInvocation.full(operand, argumentLis
t); | 3538 operand = new FunctionExpressionInvocation.full(operand, argumentLis
t); |
| 3539 } | 3539 } |
| 3540 } else { | 3540 } else { |
| 3541 operand = parseAssignableSelector(operand, true); | 3541 operand = parseAssignableSelector(operand, true); |
| 3542 } | 3542 } |
| 3543 } while (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.PER
IOD) || matches5(TokenType.OPEN_PAREN)); | 3543 } while (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.PER
IOD) || matches5(TokenType.OPEN_PAREN)); |
| 3544 return operand; | 3544 return operand; |
| 3545 } | 3545 } |
| 3546 if (!_currentToken.type.isIncrementOperator()) { | 3546 if (!_currentToken.type.isIncrementOperator) { |
| 3547 return operand; | 3547 return operand; |
| 3548 } | 3548 } |
| 3549 if (operand is FunctionExpressionInvocation) { | 3549 if (operand is FunctionExpressionInvocation) { |
| 3550 reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []); | 3550 reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []); |
| 3551 } | 3551 } |
| 3552 Token operator = andAdvance; | 3552 Token operator = andAdvance; |
| 3553 return new PostfixExpression.full(operand, operator); | 3553 return new PostfixExpression.full(operand, operator); |
| 3554 } | 3554 } |
| 3555 | 3555 |
| 3556 /** | 3556 /** |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3686 /** | 3686 /** |
| 3687 * Parse a relational expression. | 3687 * Parse a relational expression. |
| 3688 * <pre> | 3688 * <pre> |
| 3689 * relationalExpression ::= | 3689 * relationalExpression ::= |
| 3690 * shiftExpression ('is' '!'? type | 'as' type | relationalOperator shiftExpre
ssion)? | 3690 * shiftExpression ('is' '!'? type | 'as' type | relationalOperator shiftExpre
ssion)? |
| 3691 * | 'super' relationalOperator shiftExpression | 3691 * | 'super' relationalOperator shiftExpression |
| 3692 * </pre> | 3692 * </pre> |
| 3693 * @return the relational expression that was parsed | 3693 * @return the relational expression that was parsed |
| 3694 */ | 3694 */ |
| 3695 Expression parseRelationalExpression() { | 3695 Expression parseRelationalExpression() { |
| 3696 if (matches(Keyword.SUPER) && _currentToken.next.type.isRelationalOperator()
) { | 3696 if (matches(Keyword.SUPER) && _currentToken.next.type.isRelationalOperator)
{ |
| 3697 Expression expression = new SuperExpression.full(andAdvance); | 3697 Expression expression = new SuperExpression.full(andAdvance); |
| 3698 Token operator = andAdvance; | 3698 Token operator = andAdvance; |
| 3699 expression = new BinaryExpression.full(expression, operator, parseShiftExp
ression()); | 3699 expression = new BinaryExpression.full(expression, operator, parseShiftExp
ression()); |
| 3700 return expression; | 3700 return expression; |
| 3701 } | 3701 } |
| 3702 Expression expression = parseShiftExpression(); | 3702 Expression expression = parseShiftExpression(); |
| 3703 if (matches(Keyword.AS)) { | 3703 if (matches(Keyword.AS)) { |
| 3704 Token asOperator = andAdvance; | 3704 Token asOperator = andAdvance; |
| 3705 expression = new AsExpression.full(expression, asOperator, parseTypeName()
); | 3705 expression = new AsExpression.full(expression, asOperator, parseTypeName()
); |
| 3706 } else if (matches(Keyword.IS)) { | 3706 } else if (matches(Keyword.IS)) { |
| 3707 Token isOperator = andAdvance; | 3707 Token isOperator = andAdvance; |
| 3708 Token notOperator = null; | 3708 Token notOperator = null; |
| 3709 if (matches5(TokenType.BANG)) { | 3709 if (matches5(TokenType.BANG)) { |
| 3710 notOperator = andAdvance; | 3710 notOperator = andAdvance; |
| 3711 } | 3711 } |
| 3712 expression = new IsExpression.full(expression, isOperator, notOperator, pa
rseTypeName()); | 3712 expression = new IsExpression.full(expression, isOperator, notOperator, pa
rseTypeName()); |
| 3713 } else if (_currentToken.type.isRelationalOperator()) { | 3713 } else if (_currentToken.type.isRelationalOperator) { |
| 3714 Token operator = andAdvance; | 3714 Token operator = andAdvance; |
| 3715 expression = new BinaryExpression.full(expression, operator, parseShiftExp
ression()); | 3715 expression = new BinaryExpression.full(expression, operator, parseShiftExp
ression()); |
| 3716 } | 3716 } |
| 3717 return expression; | 3717 return expression; |
| 3718 } | 3718 } |
| 3719 | 3719 |
| 3720 /** | 3720 /** |
| 3721 * Parse a rethrow expression. | 3721 * Parse a rethrow expression. |
| 3722 * <pre> | 3722 * <pre> |
| 3723 * rethrowExpression ::= | 3723 * rethrowExpression ::= |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3794 * Parse a shift expression. | 3794 * Parse a shift expression. |
| 3795 * <pre> | 3795 * <pre> |
| 3796 * shiftExpression ::= | 3796 * shiftExpression ::= |
| 3797 * additiveExpression (shiftOperator additiveExpression) | 3797 * additiveExpression (shiftOperator additiveExpression) |
| 3798 * | 'super' (shiftOperator additiveExpression)+ | 3798 * | 'super' (shiftOperator additiveExpression)+ |
| 3799 * </pre> | 3799 * </pre> |
| 3800 * @return the shift expression that was parsed | 3800 * @return the shift expression that was parsed |
| 3801 */ | 3801 */ |
| 3802 Expression parseShiftExpression() { | 3802 Expression parseShiftExpression() { |
| 3803 Expression expression; | 3803 Expression expression; |
| 3804 if (matches(Keyword.SUPER) && _currentToken.next.type.isShiftOperator()) { | 3804 if (matches(Keyword.SUPER) && _currentToken.next.type.isShiftOperator) { |
| 3805 expression = new SuperExpression.full(andAdvance); | 3805 expression = new SuperExpression.full(andAdvance); |
| 3806 } else { | 3806 } else { |
| 3807 expression = parseAdditiveExpression(); | 3807 expression = parseAdditiveExpression(); |
| 3808 } | 3808 } |
| 3809 while (_currentToken.type.isShiftOperator()) { | 3809 while (_currentToken.type.isShiftOperator) { |
| 3810 Token operator = andAdvance; | 3810 Token operator = andAdvance; |
| 3811 expression = new BinaryExpression.full(expression, operator, parseAdditive
Expression()); | 3811 expression = new BinaryExpression.full(expression, operator, parseAdditive
Expression()); |
| 3812 } | 3812 } |
| 3813 return expression; | 3813 return expression; |
| 3814 } | 3814 } |
| 3815 | 3815 |
| 3816 /** | 3816 /** |
| 3817 * Parse a simple identifier. | 3817 * Parse a simple identifier. |
| 3818 * <pre> | 3818 * <pre> |
| 3819 * identifier ::= | 3819 * identifier ::= |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3855 * Parse a list of statements within a switch statement. | 3855 * Parse a list of statements within a switch statement. |
| 3856 * <pre> | 3856 * <pre> |
| 3857 * statements ::= | 3857 * statements ::= |
| 3858 * statement | 3858 * statement |
| 3859 * </pre> | 3859 * </pre> |
| 3860 * @return the statements that were parsed | 3860 * @return the statements that were parsed |
| 3861 */ | 3861 */ |
| 3862 List<Statement> parseStatements2() { | 3862 List<Statement> parseStatements2() { |
| 3863 List<Statement> statements = new List<Statement>(); | 3863 List<Statement> statements = new List<Statement>(); |
| 3864 Token statementStart = _currentToken; | 3864 Token statementStart = _currentToken; |
| 3865 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)
&& !isSwitchMember()) { | 3865 while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)
&& !isSwitchMember) { |
| 3866 statements.add(parseStatement2()); | 3866 statements.add(parseStatement2()); |
| 3867 if (identical(_currentToken, statementStart)) { | 3867 if (identical(_currentToken, statementStart)) { |
| 3868 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT
oken.lexeme]); | 3868 reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentT
oken.lexeme]); |
| 3869 advance(); | 3869 advance(); |
| 3870 } | 3870 } |
| 3871 statementStart = _currentToken; | 3871 statementStart = _currentToken; |
| 3872 } | 3872 } |
| 3873 return statements; | 3873 return statements; |
| 3874 } | 3874 } |
| 3875 | 3875 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 Expression parseUnaryExpression() { | 4249 Expression parseUnaryExpression() { |
| 4250 if (matches5(TokenType.MINUS) || matches5(TokenType.BANG) || matches5(TokenT
ype.TILDE)) { | 4250 if (matches5(TokenType.MINUS) || matches5(TokenType.BANG) || matches5(TokenT
ype.TILDE)) { |
| 4251 Token operator = andAdvance; | 4251 Token operator = andAdvance; |
| 4252 if (matches(Keyword.SUPER)) { | 4252 if (matches(Keyword.SUPER)) { |
| 4253 if (matches4(peek(), TokenType.OPEN_SQUARE_BRACKET) || matches4(peek(),
TokenType.PERIOD)) { | 4253 if (matches4(peek(), TokenType.OPEN_SQUARE_BRACKET) || matches4(peek(),
TokenType.PERIOD)) { |
| 4254 return new PrefixExpression.full(operator, parseUnaryExpression()); | 4254 return new PrefixExpression.full(operator, parseUnaryExpression()); |
| 4255 } | 4255 } |
| 4256 return new PrefixExpression.full(operator, new SuperExpression.full(andA
dvance)); | 4256 return new PrefixExpression.full(operator, new SuperExpression.full(andA
dvance)); |
| 4257 } | 4257 } |
| 4258 return new PrefixExpression.full(operator, parseUnaryExpression()); | 4258 return new PrefixExpression.full(operator, parseUnaryExpression()); |
| 4259 } else if (_currentToken.type.isIncrementOperator()) { | 4259 } else if (_currentToken.type.isIncrementOperator) { |
| 4260 Token operator = andAdvance; | 4260 Token operator = andAdvance; |
| 4261 if (matches(Keyword.SUPER)) { | 4261 if (matches(Keyword.SUPER)) { |
| 4262 if (matches4(peek(), TokenType.OPEN_SQUARE_BRACKET) || matches4(peek(),
TokenType.PERIOD)) { | 4262 if (matches4(peek(), TokenType.OPEN_SQUARE_BRACKET) || matches4(peek(),
TokenType.PERIOD)) { |
| 4263 return new PrefixExpression.full(operator, parseUnaryExpression()); | 4263 return new PrefixExpression.full(operator, parseUnaryExpression()); |
| 4264 } | 4264 } |
| 4265 if (identical(operator.type, TokenType.MINUS_MINUS)) { | 4265 if (identical(operator.type, TokenType.MINUS_MINUS)) { |
| 4266 int offset = operator.offset; | 4266 int offset = operator.offset; |
| 4267 Token firstOperator = new Token(TokenType.MINUS, offset); | 4267 Token firstOperator = new Token(TokenType.MINUS, offset); |
| 4268 Token secondOperator = new Token(TokenType.MINUS, offset + 1); | 4268 Token secondOperator = new Token(TokenType.MINUS, offset + 1); |
| 4269 secondOperator.setNext(_currentToken); | 4269 secondOperator.setNext(_currentToken); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4623 * | 4623 * |
| 4624 * This method must be kept in sync with [parseSimpleIdentifier]. | 4624 * This method must be kept in sync with [parseSimpleIdentifier]. |
| 4625 * <pre> | 4625 * <pre> |
| 4626 * identifier ::= | 4626 * identifier ::= |
| 4627 * IDENTIFIER | 4627 * IDENTIFIER |
| 4628 * </pre> | 4628 * </pre> |
| 4629 * @param startToken the token at which parsing is to begin | 4629 * @param startToken the token at which parsing is to begin |
| 4630 * @return the token following the simple identifier that was parsed | 4630 * @return the token following the simple identifier that was parsed |
| 4631 */ | 4631 */ |
| 4632 Token skipSimpleIdentifier(Token startToken) { | 4632 Token skipSimpleIdentifier(Token startToken) { |
| 4633 if (matches4(startToken, TokenType.IDENTIFIER) || (matches4(startToken, Toke
nType.KEYWORD) && ((startToken as KeywordToken)).keyword.isPseudoKeyword())) { | 4633 if (matches4(startToken, TokenType.IDENTIFIER) || (matches4(startToken, Toke
nType.KEYWORD) && ((startToken as KeywordToken)).keyword.isPseudoKeyword)) { |
| 4634 return startToken.next; | 4634 return startToken.next; |
| 4635 } | 4635 } |
| 4636 return null; | 4636 return null; |
| 4637 } | 4637 } |
| 4638 | 4638 |
| 4639 /** | 4639 /** |
| 4640 * Parse a string literal that contains interpolations, starting at the given
token, without | 4640 * Parse a string literal that contains interpolations, starting at the given
token, without |
| 4641 * actually creating a string literal or changing the current token. Return th
e token following | 4641 * actually creating a string literal or changing the current token. Return th
e token following |
| 4642 * the string literal that was parsed, or `null` if the given token is not the
first token | 4642 * the string literal that was parsed, or `null` if the given token is not the
first token |
| 4643 * in a valid string literal. | 4643 * in a valid string literal. |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5523 _writer.print(";"); | 5523 _writer.print(";"); |
| 5524 return null; | 5524 return null; |
| 5525 } | 5525 } |
| 5526 Object visitComment(Comment node) { | 5526 Object visitComment(Comment node) { |
| 5527 Token token = node.beginToken; | 5527 Token token = node.beginToken; |
| 5528 while (token != null) { | 5528 while (token != null) { |
| 5529 bool firstLine = true; | 5529 bool firstLine = true; |
| 5530 for (String line in StringUtils.split(token.lexeme, "\n")) { | 5530 for (String line in StringUtils.split(token.lexeme, "\n")) { |
| 5531 if (firstLine) { | 5531 if (firstLine) { |
| 5532 firstLine = false; | 5532 firstLine = false; |
| 5533 if (node.isDocumentation()) { | 5533 if (node.isDocumentation) { |
| 5534 nl2(); | 5534 nl2(); |
| 5535 } | 5535 } |
| 5536 } else { | 5536 } else { |
| 5537 line = " ${line.trim()}"; | 5537 line = " ${line.trim()}"; |
| 5538 line = StringUtils.replace(line, "/*", "/ *"); | 5538 line = StringUtils.replace(line, "/*", "/ *"); |
| 5539 } | 5539 } |
| 5540 _writer.print(line); | 5540 _writer.print(line); |
| 5541 nl2(); | 5541 nl2(); |
| 5542 } | 5542 } |
| 5543 if (identical(token, node.endToken)) { | 5543 if (identical(token, node.endToken)) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5783 } | 5783 } |
| 5784 Object visitImportDirective(ImportDirective node) { | 5784 Object visitImportDirective(ImportDirective node) { |
| 5785 _writer.print("import "); | 5785 _writer.print("import "); |
| 5786 visit(node.uri); | 5786 visit(node.uri); |
| 5787 visit7(" as ", node.prefix); | 5787 visit7(" as ", node.prefix); |
| 5788 visitList7(" ", node.combinators, " "); | 5788 visitList7(" ", node.combinators, " "); |
| 5789 _writer.print(';'); | 5789 _writer.print(';'); |
| 5790 return null; | 5790 return null; |
| 5791 } | 5791 } |
| 5792 Object visitIndexExpression(IndexExpression node) { | 5792 Object visitIndexExpression(IndexExpression node) { |
| 5793 if (node.isCascaded()) { | 5793 if (node.isCascaded) { |
| 5794 _writer.print(".."); | 5794 _writer.print(".."); |
| 5795 } else { | 5795 } else { |
| 5796 visit(node.array); | 5796 visit(node.array); |
| 5797 } | 5797 } |
| 5798 _writer.print('['); | 5798 _writer.print('['); |
| 5799 visit(node.index); | 5799 visit(node.index); |
| 5800 _writer.print(']'); | 5800 _writer.print(']'); |
| 5801 return null; | 5801 return null; |
| 5802 } | 5802 } |
| 5803 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 5803 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5885 return null; | 5885 return null; |
| 5886 } | 5886 } |
| 5887 Object visitMethodDeclaration(MethodDeclaration node) { | 5887 Object visitMethodDeclaration(MethodDeclaration node) { |
| 5888 visit(node.documentationComment); | 5888 visit(node.documentationComment); |
| 5889 visit8(node.externalKeyword, " "); | 5889 visit8(node.externalKeyword, " "); |
| 5890 visit8(node.modifierKeyword, " "); | 5890 visit8(node.modifierKeyword, " "); |
| 5891 visit6(node.returnType, " "); | 5891 visit6(node.returnType, " "); |
| 5892 visit8(node.propertyKeyword, " "); | 5892 visit8(node.propertyKeyword, " "); |
| 5893 visit8(node.operatorKeyword, " "); | 5893 visit8(node.operatorKeyword, " "); |
| 5894 visit(node.name); | 5894 visit(node.name); |
| 5895 if (!node.isGetter()) { | 5895 if (!node.isGetter) { |
| 5896 visit(node.parameters); | 5896 visit(node.parameters); |
| 5897 } | 5897 } |
| 5898 if (node.body is! EmptyFunctionBody) { | 5898 if (node.body is! EmptyFunctionBody) { |
| 5899 _writer.print(' '); | 5899 _writer.print(' '); |
| 5900 } | 5900 } |
| 5901 visit(node.body); | 5901 visit(node.body); |
| 5902 return null; | 5902 return null; |
| 5903 } | 5903 } |
| 5904 Object visitMethodInvocation(MethodInvocation node) { | 5904 Object visitMethodInvocation(MethodInvocation node) { |
| 5905 if (node.isCascaded()) { | 5905 if (node.isCascaded) { |
| 5906 _writer.print(".."); | 5906 _writer.print(".."); |
| 5907 } else { | 5907 } else { |
| 5908 visit6(node.target, "."); | 5908 visit6(node.target, "."); |
| 5909 } | 5909 } |
| 5910 visit(node.methodName); | 5910 visit(node.methodName); |
| 5911 visit(node.argumentList); | 5911 visit(node.argumentList); |
| 5912 return null; | 5912 return null; |
| 5913 } | 5913 } |
| 5914 Object visitNamedExpression(NamedExpression node) { | 5914 Object visitNamedExpression(NamedExpression node) { |
| 5915 visit(node.name); | 5915 visit(node.name); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5954 _writer.print('.'); | 5954 _writer.print('.'); |
| 5955 visit(node.identifier); | 5955 visit(node.identifier); |
| 5956 return null; | 5956 return null; |
| 5957 } | 5957 } |
| 5958 Object visitPrefixExpression(PrefixExpression node) { | 5958 Object visitPrefixExpression(PrefixExpression node) { |
| 5959 _writer.print(node.operator.lexeme); | 5959 _writer.print(node.operator.lexeme); |
| 5960 visit(node.operand); | 5960 visit(node.operand); |
| 5961 return null; | 5961 return null; |
| 5962 } | 5962 } |
| 5963 Object visitPropertyAccess(PropertyAccess node) { | 5963 Object visitPropertyAccess(PropertyAccess node) { |
| 5964 if (node.isCascaded()) { | 5964 if (node.isCascaded) { |
| 5965 _writer.print(".."); | 5965 _writer.print(".."); |
| 5966 } else { | 5966 } else { |
| 5967 visit6(node.target, "."); | 5967 visit6(node.target, "."); |
| 5968 } | 5968 } |
| 5969 visit(node.propertyName); | 5969 visit(node.propertyName); |
| 5970 return null; | 5970 return null; |
| 5971 } | 5971 } |
| 5972 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { | 5972 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { |
| 5973 _writer.print("this"); | 5973 _writer.print("this"); |
| 5974 visit7(".", node.constructorName); | 5974 visit7(".", node.constructorName); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6262 for (int i = 0; i < size; i++) { | 6262 for (int i = 0; i < size; i++) { |
| 6263 if (i > 0) { | 6263 if (i > 0) { |
| 6264 _writer.print(separator); | 6264 _writer.print(separator); |
| 6265 } | 6265 } |
| 6266 nodes[i].accept(this); | 6266 nodes[i].accept(this); |
| 6267 } | 6267 } |
| 6268 } | 6268 } |
| 6269 } | 6269 } |
| 6270 } | 6270 } |
| 6271 } | 6271 } |
| OLD | NEW |