Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 515543002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser; 8 library engine.parser;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 * A flag indicating whether the parser is to parse enum declarations. 1493 * A flag indicating whether the parser is to parse enum declarations.
1494 */ 1494 */
1495 bool _parseEnum = AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM; 1495 bool _parseEnum = AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM;
1496 1496
1497 /** 1497 /**
1498 * The next token to be parsed. 1498 * The next token to be parsed.
1499 */ 1499 */
1500 Token _currentToken; 1500 Token _currentToken;
1501 1501
1502 /** 1502 /**
1503 * A flag indicating whether the parser is currently in a function body marked as being 'async'.
1504 */
1505 bool _inAsync = false;
1506
1507 /**
1503 * A flag indicating whether the parser is currently in the body of a loop. 1508 * A flag indicating whether the parser is currently in the body of a loop.
1504 */ 1509 */
1505 bool _inLoop = false; 1510 bool _inLoop = false;
1506 1511
1507 /** 1512 /**
1508 * A flag indicating whether the parser is currently in a switch statement. 1513 * A flag indicating whether the parser is currently in a switch statement.
1509 */ 1514 */
1510 bool _inSwitch = false; 1515 bool _inSwitch = false;
1511 1516
1512 /** 1517 /**
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 * | block 4916 * | block
4912 * </pre> 4917 * </pre>
4913 * 4918 *
4914 * @param mayBeEmpty `true` if the function body is allowed to be empty 4919 * @param mayBeEmpty `true` if the function body is allowed to be empty
4915 * @param emptyErrorCode the error code to report if function body expected, b ut not found 4920 * @param emptyErrorCode the error code to report if function body expected, b ut not found
4916 * @param inExpression `true` if the function body is being parsed as part of an expression 4921 * @param inExpression `true` if the function body is being parsed as part of an expression
4917 * and therefore does not have a terminating semicolon 4922 * and therefore does not have a terminating semicolon
4918 * @return the function body that was parsed 4923 * @return the function body that was parsed
4919 */ 4924 */
4920 FunctionBody _parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCod e, bool inExpression) { 4925 FunctionBody _parseFunctionBody(bool mayBeEmpty, ParserErrorCode emptyErrorCod e, bool inExpression) {
4926 bool wasInAsync = _inAsync;
4921 bool wasInLoop = _inLoop; 4927 bool wasInLoop = _inLoop;
4922 bool wasInSwitch = _inSwitch; 4928 bool wasInSwitch = _inSwitch;
4929 _inAsync = false;
4923 _inLoop = false; 4930 _inLoop = false;
4924 _inSwitch = false; 4931 _inSwitch = false;
4925 try { 4932 try {
4926 if (_matches(TokenType.SEMICOLON)) { 4933 if (_matches(TokenType.SEMICOLON)) {
4927 if (!mayBeEmpty) { 4934 if (!mayBeEmpty) {
4928 _reportErrorForCurrentToken(emptyErrorCode, []); 4935 _reportErrorForCurrentToken(emptyErrorCode, []);
4929 } 4936 }
4930 return new EmptyFunctionBody(andAdvance); 4937 return new EmptyFunctionBody(andAdvance);
4931 } else if (_matchesString(_NATIVE)) { 4938 } else if (_matchesString(_NATIVE)) {
4932 Token nativeToken = andAdvance; 4939 Token nativeToken = andAdvance;
4933 StringLiteral stringLiteral = null; 4940 StringLiteral stringLiteral = null;
4934 if (_matches(TokenType.STRING)) { 4941 if (_matches(TokenType.STRING)) {
4935 stringLiteral = parseStringLiteral(); 4942 stringLiteral = parseStringLiteral();
4936 } 4943 }
4937 return new NativeFunctionBody(nativeToken, stringLiteral, _expect(TokenT ype.SEMICOLON)); 4944 return new NativeFunctionBody(nativeToken, stringLiteral, _expect(TokenT ype.SEMICOLON));
4938 } 4945 }
4939 Token keyword = null; 4946 Token keyword = null;
4940 Token star = null; 4947 Token star = null;
4941 if (_parseAsync) { 4948 if (_parseAsync) {
4942 if (_matchesString(ASYNC)) { 4949 if (_matchesString(ASYNC)) {
4943 keyword = andAdvance; 4950 keyword = andAdvance;
4944 if (_matches(TokenType.STAR)) { 4951 if (_matches(TokenType.STAR)) {
4945 star = andAdvance; 4952 star = andAdvance;
4946 } 4953 }
4954 _inAsync = true;
4947 } else if (_matchesString(SYNC)) { 4955 } else if (_matchesString(SYNC)) {
4948 keyword = andAdvance; 4956 keyword = andAdvance;
4949 if (_matches(TokenType.STAR)) { 4957 if (_matches(TokenType.STAR)) {
4950 star = andAdvance; 4958 star = andAdvance;
4951 } 4959 }
4952 } 4960 }
4953 } 4961 }
4954 if (_matches(TokenType.FUNCTION)) { 4962 if (_matches(TokenType.FUNCTION)) {
4955 if (keyword != null) { 4963 if (keyword != null) {
4956 if (!_tokenMatchesString(keyword, ASYNC)) { 4964 if (!_tokenMatchesString(keyword, ASYNC)) {
(...skipping 23 matching lines...) Expand all
4980 _skipBlock(); 4988 _skipBlock();
4981 return new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON )); 4989 return new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON ));
4982 } 4990 }
4983 return new BlockFunctionBody(keyword, star, parseBlock()); 4991 return new BlockFunctionBody(keyword, star, parseBlock());
4984 } else { 4992 } else {
4985 // Invalid function body 4993 // Invalid function body
4986 _reportErrorForCurrentToken(emptyErrorCode, []); 4994 _reportErrorForCurrentToken(emptyErrorCode, []);
4987 return new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON)) ; 4995 return new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON)) ;
4988 } 4996 }
4989 } finally { 4997 } finally {
4998 _inAsync = wasInAsync;
4990 _inLoop = wasInLoop; 4999 _inLoop = wasInLoop;
4991 _inSwitch = wasInSwitch; 5000 _inSwitch = wasInSwitch;
4992 } 5001 }
4993 } 5002 }
4994 5003
4995 /** 5004 /**
4996 * Parse a function declaration. 5005 * Parse a function declaration.
4997 * 5006 *
4998 * <pre> 5007 * <pre>
4999 * functionDeclaration ::= 5008 * functionDeclaration ::=
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
5763 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a); 5772 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a);
5764 } else if (keyword == Keyword.NEW || keyword == Keyword.TRUE || keyword == Keyword.FALSE || keyword == Keyword.NULL || keyword == Keyword.SUPER || keyword == Keyword.THIS) { 5773 } else if (keyword == Keyword.NEW || keyword == Keyword.TRUE || keyword == Keyword.FALSE || keyword == Keyword.NULL || keyword == Keyword.SUPER || keyword == Keyword.THIS) {
5765 return new ExpressionStatement(parseExpression2(), _expect(TokenType.SEM ICOLON)); 5774 return new ExpressionStatement(parseExpression2(), _expect(TokenType.SEM ICOLON));
5766 } else { 5775 } else {
5767 // 5776 //
5768 // We have found an error of some kind. Try to recover. 5777 // We have found an error of some kind. Try to recover.
5769 // 5778 //
5770 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []); 5779 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []);
5771 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON)); 5780 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
5772 } 5781 }
5773 } else if (_parseAsync && _matchesString(_YIELD)) { 5782 } else if (_inAsync && _matchesString(_YIELD)) {
5774 return _parseYieldStatement(); 5783 return _parseYieldStatement();
5775 } else if (_parseAsync && _matchesString(_AWAIT) && _tokenMatchesKeyword(_pe ek(), Keyword.FOR)) { 5784 } else if (_inAsync && _matchesString(_AWAIT)) {
5776 return _parseForStatement(); 5785 if (_tokenMatchesKeyword(_peek(), Keyword.FOR)) {
5786 return _parseForStatement();
5787 }
5788 return new ExpressionStatement(parseExpression2(), _expect(TokenType.SEMIC OLON));
5777 } else if (_matches(TokenType.SEMICOLON)) { 5789 } else if (_matches(TokenType.SEMICOLON)) {
5778 return _parseEmptyStatement(); 5790 return _parseEmptyStatement();
5779 } else if (_isInitializedVariableDeclaration()) { 5791 } else if (_isInitializedVariableDeclaration()) {
5780 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadata) ; 5792 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadata) ;
5781 } else if (_isFunctionDeclaration()) { 5793 } else if (_isFunctionDeclaration()) {
5782 return _parseFunctionDeclarationStatement(); 5794 return _parseFunctionDeclarationStatement();
5783 } else if (_matches(TokenType.CLOSE_CURLY_BRACKET)) { 5795 } else if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
5784 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []); 5796 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []);
5785 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON)); 5797 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
5786 } else { 5798 } else {
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
6582 } else { 6594 } else {
6583 // Invalid operator before 'super' 6595 // Invalid operator before 'super'
6584 _reportErrorForCurrentToken(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER , [operator.lexeme]); 6596 _reportErrorForCurrentToken(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER , [operator.lexeme]);
6585 return new PrefixExpression(operator, new SuperExpression(andAdvance)) ; 6597 return new PrefixExpression(operator, new SuperExpression(andAdvance)) ;
6586 } 6598 }
6587 } 6599 }
6588 return new PrefixExpression(operator, _parseAssignableExpression(false)); 6600 return new PrefixExpression(operator, _parseAssignableExpression(false));
6589 } else if (_matches(TokenType.PLUS)) { 6601 } else if (_matches(TokenType.PLUS)) {
6590 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []); 6602 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER, []);
6591 return _createSyntheticIdentifier(); 6603 return _createSyntheticIdentifier();
6592 } else if (_parseAsync && _matchesString(_AWAIT)) { 6604 } else if (_inAsync && _matchesString(_AWAIT)) {
6593 return _parseAwaitExpression(); 6605 return _parseAwaitExpression();
6594 } 6606 }
6595 return _parsePostfixExpression(); 6607 return _parsePostfixExpression();
6596 } 6608 }
6597 6609
6598 /** 6610 /**
6599 * Parse a variable declaration. 6611 * Parse a variable declaration.
6600 * 6612 *
6601 * <pre> 6613 * <pre>
6602 * variableDeclaration ::= 6614 * variableDeclaration ::=
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after
9455 return trampoline(target, arguments[0], arguments[1]); 9467 return trampoline(target, arguments[0], arguments[1]);
9456 case 3: 9468 case 3:
9457 return trampoline(target, arguments[0], arguments[1], arguments[2]); 9469 return trampoline(target, arguments[0], arguments[1], arguments[2]);
9458 case 4: 9470 case 4:
9459 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 9471 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
9460 default: 9472 default:
9461 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 9473 throw new IllegalArgumentException("Not implemented for > 4 arguments");
9462 } 9474 }
9463 } 9475 }
9464 } 9476 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698