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

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

Issue 900683002: Fix for issue 22178 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/test/generated/parser_test.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:math" as math; 10 import "dart:math" as math;
(...skipping 6066 matching lines...) Expand 10 before | Expand all | Expand 10 after
6077 Statement _parseEmptyStatement() => new EmptyStatement(getAndAdvance()); 6077 Statement _parseEmptyStatement() => new EmptyStatement(getAndAdvance());
6078 6078
6079 EnumConstantDeclaration _parseEnumConstantDeclaration() { 6079 EnumConstantDeclaration _parseEnumConstantDeclaration() {
6080 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata(); 6080 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata();
6081 SimpleIdentifier name; 6081 SimpleIdentifier name;
6082 if (_matchesIdentifier()) { 6082 if (_matchesIdentifier()) {
6083 name = parseSimpleIdentifier(); 6083 name = parseSimpleIdentifier();
6084 } else { 6084 } else {
6085 name = _createSyntheticIdentifier(); 6085 name = _createSyntheticIdentifier();
6086 } 6086 }
6087 if (commentAndMetadata.metadata.isNotEmpty) {
6088 _reportErrorForNode(ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT, commentAn dMetadata.metadata[0]);
6089 }
6087 return new EnumConstantDeclaration( 6090 return new EnumConstantDeclaration(
6088 commentAndMetadata.comment, 6091 commentAndMetadata.comment,
6089 commentAndMetadata.metadata, 6092 commentAndMetadata.metadata,
6090 name); 6093 name);
6091 } 6094 }
6092 6095
6093 /** 6096 /**
6094 * Parse an enum declaration. 6097 * Parse an enum declaration.
6095 * 6098 *
6096 * <pre> 6099 * <pre>
6097 * enumType ::= 6100 * enumType ::=
6098 * metadata 'enum' id '{' id (',' id)* (',')? '}' 6101 * metadata 'enum' id '{' id (',' id)* (',')? '}'
6099 * </pre> 6102 * </pre>
6100 * 6103 *
6101 * @param commentAndMetadata the metadata to be associated with the member 6104 * @param commentAndMetadata the metadata to be associated with the member
6102 * @return the enum declaration that was parsed 6105 * @return the enum declaration that was parsed
6103 */ 6106 */
6104 EnumDeclaration _parseEnumDeclaration(CommentAndMetadata commentAndMetadata) { 6107 EnumDeclaration _parseEnumDeclaration(CommentAndMetadata commentAndMetadata) {
6105 Token keyword = _expectKeyword(Keyword.ENUM); 6108 Token keyword = _expectKeyword(Keyword.ENUM);
6106 SimpleIdentifier name = parseSimpleIdentifier(); 6109 SimpleIdentifier name = parseSimpleIdentifier();
6107 Token leftBracket = null; 6110 Token leftBracket = null;
6108 List<EnumConstantDeclaration> constants = 6111 List<EnumConstantDeclaration> constants =
6109 new List<EnumConstantDeclaration>(); 6112 new List<EnumConstantDeclaration>();
6110 Token rightBracket = null; 6113 Token rightBracket = null;
6111 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { 6114 if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
6112 leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET); 6115 leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET);
6113 if (_matchesIdentifier()) { 6116 if (_matchesIdentifier() || _matches(TokenType.AT)) {
6114 constants.add(_parseEnumConstantDeclaration()); 6117 constants.add(_parseEnumConstantDeclaration());
6115 } else if (_matches(TokenType.COMMA) && 6118 } else if (_matches(TokenType.COMMA) &&
6116 _tokenMatchesIdentifier(_peek())) { 6119 _tokenMatchesIdentifier(_peek())) {
6117 constants.add(_parseEnumConstantDeclaration()); 6120 constants.add(_parseEnumConstantDeclaration());
6118 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); 6121 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
6119 } else { 6122 } else {
6120 constants.add(_parseEnumConstantDeclaration()); 6123 constants.add(_parseEnumConstantDeclaration());
6121 _reportErrorForCurrentToken(ParserErrorCode.EMPTY_ENUM_BODY); 6124 _reportErrorForCurrentToken(ParserErrorCode.EMPTY_ENUM_BODY);
6122 } 6125 }
6123 while (_optional(TokenType.COMMA)) { 6126 while (_optional(TokenType.COMMA)) {
(...skipping 3884 matching lines...) Expand 10 before | Expand all | Expand 10 after
10008 10011
10009 static const ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = 10012 static const ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE =
10010 const ParserErrorCode( 10013 const ParserErrorCode(
10011 'ABSTRACT_TOP_LEVEL_VARIABLE', 10014 'ABSTRACT_TOP_LEVEL_VARIABLE',
10012 "Top-level variables cannot be declared to be 'abstract'"); 10015 "Top-level variables cannot be declared to be 'abstract'");
10013 10016
10014 static const ParserErrorCode ABSTRACT_TYPEDEF = const ParserErrorCode( 10017 static const ParserErrorCode ABSTRACT_TYPEDEF = const ParserErrorCode(
10015 'ABSTRACT_TYPEDEF', 10018 'ABSTRACT_TYPEDEF',
10016 "Type aliases cannot be declared to be 'abstract'"); 10019 "Type aliases cannot be declared to be 'abstract'");
10017 10020
10021 static const ParserErrorCode ANNOTATION_ON_ENUM_CONSTANT = const ParserErrorCo de(
10022 'ANNOTATION_ON_ENUM_CONSTANT',
10023 "Enum constants cannot have annotations");
10024
10018 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT = 10025 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT =
10019 const ParserErrorCode( 10026 const ParserErrorCode(
10020 'ASSERT_DOES_NOT_TAKE_ASSIGNMENT', 10027 'ASSERT_DOES_NOT_TAKE_ASSIGNMENT',
10021 "Assert cannot be called on an assignment"); 10028 "Assert cannot be called on an assignment");
10022 10029
10023 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_CASCADE = 10030 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_CASCADE =
10024 const ParserErrorCode( 10031 const ParserErrorCode(
10025 'ASSERT_DOES_NOT_TAKE_CASCADE', 10032 'ASSERT_DOES_NOT_TAKE_CASCADE',
10026 "Assert cannot be called on cascade"); 10033 "Assert cannot be called on cascade");
10027 10034
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after
12119 * Copy resolution data from one node to another. 12126 * Copy resolution data from one node to another.
12120 * 12127 *
12121 * @param fromNode the node from which resolution information will be copied 12128 * @param fromNode the node from which resolution information will be copied
12122 * @param toNode the node to which resolution information will be copied 12129 * @param toNode the node to which resolution information will be copied
12123 */ 12130 */
12124 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 12131 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
12125 ResolutionCopier copier = new ResolutionCopier(); 12132 ResolutionCopier copier = new ResolutionCopier();
12126 copier._isEqualNodes(fromNode, toNode); 12133 copier._isEqualNodes(fromNode, toNode);
12127 } 12134 }
12128 } 12135 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698