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

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

Issue 624403002: Write end-of-block comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | « pkg/analyzer/lib/src/generated/html.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 @override 424 @override
425 AstNode visitExportDirective(ExportDirective node) { 425 AstNode visitExportDirective(ExportDirective node) {
426 if (identical(_oldNode, node.documentationComment)) { 426 if (identical(_oldNode, node.documentationComment)) {
427 throw new InsufficientContextException(); 427 throw new InsufficientContextException();
428 } else if (node.metadata.contains(_oldNode)) { 428 } else if (node.metadata.contains(_oldNode)) {
429 return _parser.parseAnnotation(); 429 return _parser.parseAnnotation();
430 } else if (identical(_oldNode, node.uri)) { 430 } else if (identical(_oldNode, node.uri)) {
431 return _parser.parseStringLiteral(); 431 return _parser.parseStringLiteral();
432 } else if (node.combinators.contains(_oldNode)) { 432 } else if (node.combinators.contains(_oldNode)) {
433 throw new IncrementalParseException(); 433 throw new IncrementalParseException();
434 //return parser.parseCombinator();
434 } 435 }
435 return _notAChild(node); 436 return _notAChild(node);
436 } 437 }
437 438
438 @override 439 @override
439 AstNode visitExpressionFunctionBody(ExpressionFunctionBody node) { 440 AstNode visitExpressionFunctionBody(ExpressionFunctionBody node) {
440 if (identical(_oldNode, node.expression)) { 441 if (identical(_oldNode, node.expression)) {
441 return _parser.parseExpression2(); 442 return _parser.parseExpression2();
442 } 443 }
443 return _notAChild(node); 444 return _notAChild(node);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } else if (identical(_oldNode, node.parameters)) { 485 } else if (identical(_oldNode, node.parameters)) {
485 return _parser.parseFormalParameterList(); 486 return _parser.parseFormalParameterList();
486 } 487 }
487 return _notAChild(node); 488 return _notAChild(node);
488 } 489 }
489 490
490 @override 491 @override
491 AstNode visitForEachStatement(ForEachStatement node) { 492 AstNode visitForEachStatement(ForEachStatement node) {
492 if (identical(_oldNode, node.loopVariable)) { 493 if (identical(_oldNode, node.loopVariable)) {
493 throw new InsufficientContextException(); 494 throw new InsufficientContextException();
495 //return parser.parseDeclaredIdentifier();
494 } else if (identical(_oldNode, node.identifier)) { 496 } else if (identical(_oldNode, node.identifier)) {
495 return _parser.parseSimpleIdentifier(); 497 return _parser.parseSimpleIdentifier();
496 } else if (identical(_oldNode, node.body)) { 498 } else if (identical(_oldNode, node.body)) {
497 return _parser.parseStatement2(); 499 return _parser.parseStatement2();
498 } 500 }
499 return _notAChild(node); 501 return _notAChild(node);
500 } 502 }
501 503
502 @override 504 @override
503 AstNode visitFormalParameterList(FormalParameterList node) { 505 AstNode visitFormalParameterList(FormalParameterList node) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (identical(_oldNode, node.documentationComment)) { 634 if (identical(_oldNode, node.documentationComment)) {
633 throw new InsufficientContextException(); 635 throw new InsufficientContextException();
634 } else if (node.metadata.contains(_oldNode)) { 636 } else if (node.metadata.contains(_oldNode)) {
635 return _parser.parseAnnotation(); 637 return _parser.parseAnnotation();
636 } else if (identical(_oldNode, node.uri)) { 638 } else if (identical(_oldNode, node.uri)) {
637 return _parser.parseStringLiteral(); 639 return _parser.parseStringLiteral();
638 } else if (identical(_oldNode, node.prefix)) { 640 } else if (identical(_oldNode, node.prefix)) {
639 return _parser.parseSimpleIdentifier(); 641 return _parser.parseSimpleIdentifier();
640 } else if (node.combinators.contains(_oldNode)) { 642 } else if (node.combinators.contains(_oldNode)) {
641 throw new IncrementalParseException(); 643 throw new IncrementalParseException();
644 //return parser.parseCombinator();
642 } 645 }
643 return _notAChild(node); 646 return _notAChild(node);
644 } 647 }
645 648
646 @override 649 @override
647 AstNode visitIndexExpression(IndexExpression node) { 650 AstNode visitIndexExpression(IndexExpression node) {
648 if (identical(_oldNode, node.target)) { 651 if (identical(_oldNode, node.target)) {
649 throw new InsufficientContextException(); 652 throw new InsufficientContextException();
650 } else if (identical(_oldNode, node.index)) { 653 } else if (identical(_oldNode, node.index)) {
651 return _parser.parseExpression2(); 654 return _parser.parseExpression2();
(...skipping 12 matching lines...) Expand all
664 } 667 }
665 668
666 @override 669 @override
667 AstNode visitIntegerLiteral(IntegerLiteral node) => _notAChild(node); 670 AstNode visitIntegerLiteral(IntegerLiteral node) => _notAChild(node);
668 671
669 @override 672 @override
670 AstNode visitInterpolationExpression(InterpolationExpression node) { 673 AstNode visitInterpolationExpression(InterpolationExpression node) {
671 if (identical(_oldNode, node.expression)) { 674 if (identical(_oldNode, node.expression)) {
672 if (node.leftBracket == null) { 675 if (node.leftBracket == null) {
673 throw new InsufficientContextException(); 676 throw new InsufficientContextException();
677 //return parser.parseThisOrSimpleIdentifier();
674 } 678 }
675 return _parser.parseExpression2(); 679 return _parser.parseExpression2();
676 } 680 }
677 return _notAChild(node); 681 return _notAChild(node);
678 } 682 }
679 683
680 @override 684 @override
681 AstNode visitInterpolationString(InterpolationString node) { 685 AstNode visitInterpolationString(InterpolationString node) {
682 throw new InsufficientContextException(); 686 throw new InsufficientContextException();
683 } 687 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 765 }
762 766
763 @override 767 @override
764 AstNode visitMethodDeclaration(MethodDeclaration node) { 768 AstNode visitMethodDeclaration(MethodDeclaration node) {
765 if (identical(_oldNode, node.documentationComment)) { 769 if (identical(_oldNode, node.documentationComment)) {
766 throw new InsufficientContextException(); 770 throw new InsufficientContextException();
767 } else if (node.metadata.contains(_oldNode)) { 771 } else if (node.metadata.contains(_oldNode)) {
768 return _parser.parseAnnotation(); 772 return _parser.parseAnnotation();
769 } else if (identical(_oldNode, node.returnType)) { 773 } else if (identical(_oldNode, node.returnType)) {
770 throw new InsufficientContextException(); 774 throw new InsufficientContextException();
775 //return parser.parseTypeName();
776 //return parser.parseReturnType();
771 } else if (identical(_oldNode, node.name)) { 777 } else if (identical(_oldNode, node.name)) {
772 if (node.operatorKeyword != null) { 778 if (node.operatorKeyword != null) {
773 throw new InsufficientContextException(); 779 throw new InsufficientContextException();
774 } 780 }
775 return _parser.parseSimpleIdentifier(); 781 return _parser.parseSimpleIdentifier();
776 } else if (identical(_oldNode, node.body)) { 782 } else if (identical(_oldNode, node.body)) {
777 //return parser.parseFunctionBody(); 783 //return parser.parseFunctionBody();
778 throw new InsufficientContextException(); 784 throw new InsufficientContextException();
779 } 785 }
780 return _notAChild(node); 786 return _notAChild(node);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 * @param token the first token of the compilation unit 1564 * @param token the first token of the compilation unit
1559 * @return the compilation unit that was parsed 1565 * @return the compilation unit that was parsed
1560 */ 1566 */
1561 CompilationUnit parseCompilationUnit(Token token) { 1567 CompilationUnit parseCompilationUnit(Token token) {
1562 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseCompilationUnit"); 1568 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseCompilationUnit");
1563 try { 1569 try {
1564 _currentToken = token; 1570 _currentToken = token;
1565 return parseCompilationUnit2(); 1571 return parseCompilationUnit2();
1566 } finally { 1572 } finally {
1567 instrumentation.log2(2); 1573 instrumentation.log2(2);
1574 //Record if >= 2ms
1568 } 1575 }
1569 } 1576 }
1570 1577
1571 /** 1578 /**
1572 * Parse the script tag and directives in a compilation unit, starting with th e given token, until 1579 * Parse the script tag and directives in a compilation unit, starting with th e given token, until
1573 * the first non-directive is encountered. The remainder of the compilation un it will not be 1580 * the first non-directive is encountered. The remainder of the compilation un it will not be
1574 * parsed. Specifically, if there are directives later in the file, they will not be parsed. 1581 * parsed. Specifically, if there are directives later in the file, they will not be parsed.
1575 * 1582 *
1576 * @param token the first token of the compilation unit 1583 * @param token the first token of the compilation unit
1577 * @return the compilation unit that was parsed 1584 * @return the compilation unit that was parsed
1578 */ 1585 */
1579 CompilationUnit parseDirectives(Token token) { 1586 CompilationUnit parseDirectives(Token token) {
1580 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseDirectives"); 1587 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseDirectives");
1581 try { 1588 try {
1582 _currentToken = token; 1589 _currentToken = token;
1583 return _parseDirectives(); 1590 return _parseDirectives();
1584 } finally { 1591 } finally {
1585 instrumentation.log2(2); 1592 instrumentation.log2(2);
1593 //Record if >= 2ms
1586 } 1594 }
1587 } 1595 }
1588 1596
1589 /** 1597 /**
1590 * Parse an expression, starting with the given token. 1598 * Parse an expression, starting with the given token.
1591 * 1599 *
1592 * @param token the first token of the expression 1600 * @param token the first token of the expression
1593 * @return the expression that was parsed, or `null` if the tokens do not repr esent a 1601 * @return the expression that was parsed, or `null` if the tokens do not repr esent a
1594 * recognizable expression 1602 * recognizable expression
1595 */ 1603 */
1596 Expression parseExpression(Token token) { 1604 Expression parseExpression(Token token) {
1597 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseExpression"); 1605 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseExpression");
1598 try { 1606 try {
1599 _currentToken = token; 1607 _currentToken = token;
1600 return parseExpression2(); 1608 return parseExpression2();
1601 } finally { 1609 } finally {
1602 instrumentation.log2(2); 1610 instrumentation.log2(2);
1611 //Record if >= 2ms
1603 } 1612 }
1604 } 1613 }
1605 1614
1606 /** 1615 /**
1607 * Parse a statement, starting with the given token. 1616 * Parse a statement, starting with the given token.
1608 * 1617 *
1609 * @param token the first token of the statement 1618 * @param token the first token of the statement
1610 * @return the statement that was parsed, or `null` if the tokens do not repre sent a 1619 * @return the statement that was parsed, or `null` if the tokens do not repre sent a
1611 * recognizable statement 1620 * recognizable statement
1612 */ 1621 */
1613 Statement parseStatement(Token token) { 1622 Statement parseStatement(Token token) {
1614 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseStatement"); 1623 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseStatement");
1615 try { 1624 try {
1616 _currentToken = token; 1625 _currentToken = token;
1617 return parseStatement2(); 1626 return parseStatement2();
1618 } finally { 1627 } finally {
1619 instrumentation.log2(2); 1628 instrumentation.log2(2);
1629 //Record if >= 2ms
1620 } 1630 }
1621 } 1631 }
1622 1632
1623 /** 1633 /**
1624 * Parse a sequence of statements, starting with the given token. 1634 * Parse a sequence of statements, starting with the given token.
1625 * 1635 *
1626 * @param token the first token of the sequence of statement 1636 * @param token the first token of the sequence of statement
1627 * @return the statements that were parsed, or `null` if the tokens do not rep resent a 1637 * @return the statements that were parsed, or `null` if the tokens do not rep resent a
1628 * recognizable sequence of statements 1638 * recognizable sequence of statements
1629 */ 1639 */
1630 List<Statement> parseStatements(Token token) { 1640 List<Statement> parseStatements(Token token) {
1631 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseStatements"); 1641 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseStatements");
1632 try { 1642 try {
1633 _currentToken = token; 1643 _currentToken = token;
1634 return _parseStatementList(); 1644 return _parseStatementList();
1635 } finally { 1645 } finally {
1636 instrumentation.log2(2); 1646 instrumentation.log2(2);
1647 //Record if >= 2ms
1637 } 1648 }
1638 } 1649 }
1639 1650
1640 /** 1651 /**
1641 * Set whether the parser is to parse the async support. 1652 * Set whether the parser is to parse the async support.
1642 * 1653 *
1643 * @param parseAsync `true` if the parser is to parse the async support 1654 * @param parseAsync `true` if the parser is to parse the async support
1644 */ 1655 */
1645 void set parseAsync(bool parseAsync) { 1656 void set parseAsync(bool parseAsync) {
1646 this._parseAsync = parseAsync; 1657 this._parseAsync = parseAsync;
(...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 } 3910 }
3900 } else if (_matchesKeyword(Keyword.WITH)) { 3911 } else if (_matchesKeyword(Keyword.WITH)) {
3901 if (withClause == null) { 3912 if (withClause == null) {
3902 withClause = parseWithClause(); 3913 withClause = parseWithClause();
3903 if (implementsClause != null) { 3914 if (implementsClause != null) {
3904 _reportErrorForToken(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, impleme ntsClause.keyword, []); 3915 _reportErrorForToken(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, impleme ntsClause.keyword, []);
3905 } 3916 }
3906 } else { 3917 } else {
3907 _reportErrorForToken(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause .withKeyword, []); 3918 _reportErrorForToken(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause .withKeyword, []);
3908 parseWithClause(); 3919 parseWithClause();
3920 // TODO(brianwilkerson) Should we merge the list of applied mixins int o a single list?
3909 } 3921 }
3910 } else if (_matchesKeyword(Keyword.IMPLEMENTS)) { 3922 } else if (_matchesKeyword(Keyword.IMPLEMENTS)) {
3911 if (implementsClause == null) { 3923 if (implementsClause == null) {
3912 implementsClause = parseImplementsClause(); 3924 implementsClause = parseImplementsClause();
3913 } else { 3925 } else {
3914 _reportErrorForToken(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, impl ementsClause.keyword, []); 3926 _reportErrorForToken(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, impl ementsClause.keyword, []);
3915 parseImplementsClause(); 3927 parseImplementsClause();
3928 // TODO(brianwilkerson) Should we merge the list of implemented classe s into a single list?
3916 } 3929 }
3917 } else { 3930 } else {
3918 foundClause = false; 3931 foundClause = false;
3919 } 3932 }
3920 } 3933 }
3921 if (withClause != null && extendsClause == null) { 3934 if (withClause != null && extendsClause == null) {
3922 _reportErrorForToken(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.with Keyword, []); 3935 _reportErrorForToken(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.with Keyword, []);
3923 } 3936 }
3924 // 3937 //
3925 // Look for and skip over the extra-lingual 'native' specification. 3938 // Look for and skip over the extra-lingual 'native' specification.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 } 4147 }
4135 return new CommentReference(newKeyword, identifier); 4148 return new CommentReference(newKeyword, identifier);
4136 } else if (_tokenMatchesKeyword(firstToken, Keyword.THIS) || _tokenMatches Keyword(firstToken, Keyword.NULL) || _tokenMatchesKeyword(firstToken, Keyword.TR UE) || _tokenMatchesKeyword(firstToken, Keyword.FALSE)) { 4149 } else if (_tokenMatchesKeyword(firstToken, Keyword.THIS) || _tokenMatches Keyword(firstToken, Keyword.NULL) || _tokenMatchesKeyword(firstToken, Keyword.TR UE) || _tokenMatchesKeyword(firstToken, Keyword.FALSE)) {
4137 // TODO(brianwilkerson) If we want to support this we will need to exten d the definition 4150 // TODO(brianwilkerson) If we want to support this we will need to exten d the definition
4138 // of CommentReference to take an expression rather than an identifier. For now we just 4151 // of CommentReference to take an expression rather than an identifier. For now we just
4139 // ignore it to reduce the number of errors produced, but that's probabl y not a valid 4152 // ignore it to reduce the number of errors produced, but that's probabl y not a valid
4140 // long term approach. 4153 // long term approach.
4141 return null; 4154 return null;
4142 } 4155 }
4143 } catch (exception) { 4156 } catch (exception) {
4157 // Ignored because we assume that it wasn't a real comment reference.
4144 } 4158 }
4145 return null; 4159 return null;
4146 } 4160 }
4147 4161
4148 /** 4162 /**
4149 * Parse all of the comment references occurring in the given array of documen tation comments. 4163 * Parse all of the comment references occurring in the given array of documen tation comments.
4150 * 4164 *
4151 * <pre> 4165 * <pre>
4152 * commentReference ::= 4166 * commentReference ::=
4153 * '[' 'new'? qualified ']' libraryReference? 4167 * '[' 'new'? qualified ']' libraryReference?
(...skipping 14 matching lines...) Expand all
4168 int leftIndex = comment.indexOf('['); 4182 int leftIndex = comment.indexOf('[');
4169 while (leftIndex >= 0 && leftIndex + 1 < length) { 4183 while (leftIndex >= 0 && leftIndex + 1 < length) {
4170 List<int> range = _findRange(codeBlockRanges, leftIndex); 4184 List<int> range = _findRange(codeBlockRanges, leftIndex);
4171 if (range == null) { 4185 if (range == null) {
4172 int nameOffset = token.offset + leftIndex + 1; 4186 int nameOffset = token.offset + leftIndex + 1;
4173 int rightIndex = JavaString.indexOf(comment, ']', leftIndex); 4187 int rightIndex = JavaString.indexOf(comment, ']', leftIndex);
4174 if (rightIndex >= 0) { 4188 if (rightIndex >= 0) {
4175 int firstChar = comment.codeUnitAt(leftIndex + 1); 4189 int firstChar = comment.codeUnitAt(leftIndex + 1);
4176 if (firstChar != 0x27 && firstChar != 0x22) { 4190 if (firstChar != 0x27 && firstChar != 0x22) {
4177 if (_isLinkText(comment, rightIndex)) { 4191 if (_isLinkText(comment, rightIndex)) {
4192 // TODO(brianwilkerson) Handle the case where there's a library URI in the link text.
4178 } else { 4193 } else {
4179 CommentReference reference = _parseCommentReference(comment.subs tring(leftIndex + 1, rightIndex), nameOffset); 4194 CommentReference reference = _parseCommentReference(comment.subs tring(leftIndex + 1, rightIndex), nameOffset);
4180 if (reference != null) { 4195 if (reference != null) {
4181 references.add(reference); 4196 references.add(reference);
4182 } 4197 }
4183 } 4198 }
4184 } 4199 }
4185 } else { 4200 } else {
4186 // terminating ']' is not typed yet 4201 // terminating ']' is not typed yet
4187 int charAfterLeft = comment.codeUnitAt(leftIndex + 1); 4202 int charAfterLeft = comment.codeUnitAt(leftIndex + 1);
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
4874 VariableDeclaration variable = variables[0]; 4889 VariableDeclaration variable = variables[0];
4875 if (variable.initializer != null) { 4890 if (variable.initializer != null) {
4876 _reportErrorForCurrentToken(ParserErrorCode.INITIALIZED_VARIABLE_I N_FOR_EACH, []); 4891 _reportErrorForCurrentToken(ParserErrorCode.INITIALIZED_VARIABLE_I N_FOR_EACH, []);
4877 } 4892 }
4878 Token keyword = variableList.keyword; 4893 Token keyword = variableList.keyword;
4879 TypeName type = variableList.type; 4894 TypeName type = variableList.type;
4880 if (keyword != null || type != null) { 4895 if (keyword != null || type != null) {
4881 loopVariable = new DeclaredIdentifier(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, type, variable.name); 4896 loopVariable = new DeclaredIdentifier(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, type, variable.name);
4882 } else { 4897 } else {
4883 if (!commentAndMetadata.metadata.isEmpty) { 4898 if (!commentAndMetadata.metadata.isEmpty) {
4899 // TODO(jwren) metadata isn't allowed before the identifier in " identifier in expression",
4900 // add warning if commentAndMetadata has content
4884 } 4901 }
4885 identifier = variable.name; 4902 identifier = variable.name;
4886 } 4903 }
4887 } 4904 }
4888 Token inKeyword = _expectKeyword(Keyword.IN); 4905 Token inKeyword = _expectKeyword(Keyword.IN);
4889 Expression iterator = parseExpression2(); 4906 Expression iterator = parseExpression2();
4890 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); 4907 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
4891 Statement body = parseStatement2(); 4908 Statement body = parseStatement2();
4892 if (loopVariable == null) { 4909 if (loopVariable == null) {
4893 return new ForEachStatement.con2(awaitKeyword, forKeyword, leftParen thesis, identifier, inKeyword, iterator, rightParenthesis, body); 4910 return new ForEachStatement.con2(awaitKeyword, forKeyword, leftParen thesis, identifier, inKeyword, iterator, rightParenthesis, body);
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
5992 } else if (_matchesKeyword(Keyword.FALSE)) { 6009 } else if (_matchesKeyword(Keyword.FALSE)) {
5993 return new BooleanLiteral(andAdvance, false); 6010 return new BooleanLiteral(andAdvance, false);
5994 } else if (_matchesKeyword(Keyword.TRUE)) { 6011 } else if (_matchesKeyword(Keyword.TRUE)) {
5995 return new BooleanLiteral(andAdvance, true); 6012 return new BooleanLiteral(andAdvance, true);
5996 } else if (_matches(TokenType.DOUBLE)) { 6013 } else if (_matches(TokenType.DOUBLE)) {
5997 Token token = andAdvance; 6014 Token token = andAdvance;
5998 double value = 0.0; 6015 double value = 0.0;
5999 try { 6016 try {
6000 value = double.parse(token.lexeme); 6017 value = double.parse(token.lexeme);
6001 } on FormatException catch (exception) { 6018 } on FormatException catch (exception) {
6019 // The invalid format should have been reported by the scanner.
6002 } 6020 }
6003 return new DoubleLiteral(token, value); 6021 return new DoubleLiteral(token, value);
6004 } else if (_matches(TokenType.HEXADECIMAL)) { 6022 } else if (_matches(TokenType.HEXADECIMAL)) {
6005 Token token = andAdvance; 6023 Token token = andAdvance;
6006 int value = null; 6024 int value = null;
6007 try { 6025 try {
6008 value = int.parse(token.lexeme.substring(2), radix: 16); 6026 value = int.parse(token.lexeme.substring(2), radix: 16);
6009 } on FormatException catch (exception) { 6027 } on FormatException catch (exception) {
6028 // The invalid format should have been reported by the scanner.
6010 } 6029 }
6011 return new IntegerLiteral(token, value); 6030 return new IntegerLiteral(token, value);
6012 } else if (_matches(TokenType.INT)) { 6031 } else if (_matches(TokenType.INT)) {
6013 Token token = andAdvance; 6032 Token token = andAdvance;
6014 int value = null; 6033 int value = null;
6015 try { 6034 try {
6016 value = int.parse(token.lexeme); 6035 value = int.parse(token.lexeme);
6017 } on FormatException catch (exception) { 6036 } on FormatException catch (exception) {
6037 // The invalid format should have been reported by the scanner.
6018 } 6038 }
6019 return new IntegerLiteral(token, value); 6039 return new IntegerLiteral(token, value);
6020 } else if (_matches(TokenType.STRING)) { 6040 } else if (_matches(TokenType.STRING)) {
6021 return parseStringLiteral(); 6041 return parseStringLiteral();
6022 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { 6042 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
6023 return _parseMapLiteral(null, null); 6043 return _parseMapLiteral(null, null);
6024 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.IND EX)) { 6044 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.IND EX)) {
6025 return _parseListLiteral(null, null); 6045 return _parseListLiteral(null, null);
6026 } else if (_matchesIdentifier()) { 6046 } else if (_matchesIdentifier()) {
6027 // TODO(brianwilkerson) The code below was an attempt to recover from an e rror case, but it 6047 // TODO(brianwilkerson) The code below was an attempt to recover from an e rror case, but it
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
7362 // Illegal escape sequence: no char after escape 7382 // Illegal escape sequence: no char after escape
7363 // This cannot actually happen because it would require the escape charact er to be the last 7383 // This cannot actually happen because it would require the escape charact er to be the last
7364 // character in the string, but if it were it would escape the closing quo te, leaving the 7384 // character in the string, but if it were it would escape the closing quo te, leaving the
7365 // string unclosed. 7385 // string unclosed.
7366 // reportError(ParserErrorCode.MISSING_CHAR_IN_ESCAPE_SEQUENCE); 7386 // reportError(ParserErrorCode.MISSING_CHAR_IN_ESCAPE_SEQUENCE);
7367 return length; 7387 return length;
7368 } 7388 }
7369 currentChar = lexeme.codeUnitAt(currentIndex); 7389 currentChar = lexeme.codeUnitAt(currentIndex);
7370 if (currentChar == 0x6E) { 7390 if (currentChar == 0x6E) {
7371 builder.appendChar(0xA); 7391 builder.appendChar(0xA);
7392 // newline
7372 } else if (currentChar == 0x72) { 7393 } else if (currentChar == 0x72) {
7373 builder.appendChar(0xD); 7394 builder.appendChar(0xD);
7395 // carriage return
7374 } else if (currentChar == 0x66) { 7396 } else if (currentChar == 0x66) {
7375 builder.appendChar(0xC); 7397 builder.appendChar(0xC);
7398 // form feed
7376 } else if (currentChar == 0x62) { 7399 } else if (currentChar == 0x62) {
7377 builder.appendChar(0x8); 7400 builder.appendChar(0x8);
7401 // backspace
7378 } else if (currentChar == 0x74) { 7402 } else if (currentChar == 0x74) {
7379 builder.appendChar(0x9); 7403 builder.appendChar(0x9);
7404 // tab
7380 } else if (currentChar == 0x76) { 7405 } else if (currentChar == 0x76) {
7381 builder.appendChar(0xB); 7406 builder.appendChar(0xB);
7407 // vertical tab
7382 } else if (currentChar == 0x78) { 7408 } else if (currentChar == 0x78) {
7383 if (currentIndex + 2 >= length) { 7409 if (currentIndex + 2 >= length) {
7384 // Illegal escape sequence: not enough hex digits 7410 // Illegal escape sequence: not enough hex digits
7385 _reportErrorForCurrentToken(ParserErrorCode.INVALID_HEX_ESCAPE, []); 7411 _reportErrorForCurrentToken(ParserErrorCode.INVALID_HEX_ESCAPE, []);
7386 return length; 7412 return length;
7387 } 7413 }
7388 int firstDigit = lexeme.codeUnitAt(currentIndex + 1); 7414 int firstDigit = lexeme.codeUnitAt(currentIndex + 1);
7389 int secondDigit = lexeme.codeUnitAt(currentIndex + 2); 7415 int secondDigit = lexeme.codeUnitAt(currentIndex + 2);
7390 if (!_isHexDigit(firstDigit) || !_isHexDigit(secondDigit)) { 7416 if (!_isHexDigit(firstDigit) || !_isHexDigit(secondDigit)) {
7391 // Illegal escape sequence: invalid hex digit 7417 // Illegal escape sequence: invalid hex digit
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
9492 return trampoline(target, arguments[0], arguments[1]); 9518 return trampoline(target, arguments[0], arguments[1]);
9493 case 3: 9519 case 3:
9494 return trampoline(target, arguments[0], arguments[1], arguments[2]); 9520 return trampoline(target, arguments[0], arguments[1], arguments[2]);
9495 case 4: 9521 case 4:
9496 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 9522 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
9497 default: 9523 default:
9498 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 9524 throw new IllegalArgumentException("Not implemented for > 4 arguments");
9499 } 9525 }
9500 } 9526 }
9501 } 9527 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/html.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698