| OLD | NEW |
| 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 library analyzer.src.generated.parser; | 5 library analyzer.src.generated.parser; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| 11 import 'package:analyzer/dart/ast/visitor.dart'; |
| 12 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 13 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 11 import 'package:analyzer/src/generated/engine.dart' | 14 import 'package:analyzer/src/generated/engine.dart' |
| 12 show AnalysisEngine, AnalysisOptionsImpl; | 15 show AnalysisEngine, AnalysisOptionsImpl; |
| 13 import 'package:analyzer/src/generated/error.dart'; | 16 import 'package:analyzer/src/generated/error.dart'; |
| 14 import 'package:analyzer/src/generated/java_core.dart'; | 17 import 'package:analyzer/src/generated/java_core.dart'; |
| 15 import 'package:analyzer/src/generated/java_engine.dart'; | 18 import 'package:analyzer/src/generated/java_engine.dart'; |
| 16 import 'package:analyzer/src/generated/scanner.dart'; | 19 import 'package:analyzer/src/generated/scanner.dart'; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 20 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:analyzer/src/generated/utilities_collection.dart' show TokenMap; | 21 import 'package:analyzer/src/generated/utilities_collection.dart' show TokenMap; |
| 19 import 'package:analyzer/src/generated/utilities_dart.dart'; | 22 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 20 | 23 |
| (...skipping 5343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5364 * | 5367 * |
| 5365 * constExpression ::= | 5368 * constExpression ::= |
| 5366 * instanceCreationExpression | 5369 * instanceCreationExpression |
| 5367 * | listLiteral | 5370 * | listLiteral |
| 5368 * | mapLiteral | 5371 * | mapLiteral |
| 5369 */ | 5372 */ |
| 5370 Expression _parseConstExpression() { | 5373 Expression _parseConstExpression() { |
| 5371 Token keyword = _expectKeyword(Keyword.CONST); | 5374 Token keyword = _expectKeyword(Keyword.CONST); |
| 5372 if (_matches(TokenType.LT) || _injectGenericCommentTypeList()) { | 5375 if (_matches(TokenType.LT) || _injectGenericCommentTypeList()) { |
| 5373 return _parseListOrMapLiteral(keyword); | 5376 return _parseListOrMapLiteral(keyword); |
| 5374 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.IND
EX)) { | 5377 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || |
| 5378 _matches(TokenType.INDEX)) { |
| 5375 return _parseListLiteral(keyword, null); | 5379 return _parseListLiteral(keyword, null); |
| 5376 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { | 5380 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { |
| 5377 return _parseMapLiteral(keyword, null); | 5381 return _parseMapLiteral(keyword, null); |
| 5378 } | 5382 } |
| 5379 return _parseInstanceCreationExpression(keyword); | 5383 return _parseInstanceCreationExpression(keyword); |
| 5380 } | 5384 } |
| 5381 | 5385 |
| 5382 ConstructorDeclaration _parseConstructor( | 5386 ConstructorDeclaration _parseConstructor( |
| 5383 CommentAndMetadata commentAndMetadata, | 5387 CommentAndMetadata commentAndMetadata, |
| 5384 Token externalKeyword, | 5388 Token externalKeyword, |
| (...skipping 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9374 * identifiers async, await, or yield is used as an identifier in a function | 9378 * identifiers async, await, or yield is used as an identifier in a function |
| 9375 * body marked with either async, async*, or sync*. | 9379 * body marked with either async, async*, or sync*. |
| 9376 */ | 9380 */ |
| 9377 static const ParserErrorCode ASYNC_KEYWORD_USED_AS_IDENTIFIER = | 9381 static const ParserErrorCode ASYNC_KEYWORD_USED_AS_IDENTIFIER = |
| 9378 const ParserErrorCode('ASYNC_KEYWORD_USED_AS_IDENTIFIER', | 9382 const ParserErrorCode('ASYNC_KEYWORD_USED_AS_IDENTIFIER', |
| 9379 "The keywords 'async', 'await', and 'yield' may not be used as identif
iers in an asynchronous or generator function."); | 9383 "The keywords 'async', 'await', and 'yield' may not be used as identif
iers in an asynchronous or generator function."); |
| 9380 | 9384 |
| 9381 /** | 9385 /** |
| 9382 * Some environments, such as Fletch, do not support async. | 9386 * Some environments, such as Fletch, do not support async. |
| 9383 */ | 9387 */ |
| 9384 static const ParserErrorCode ASYNC_NOT_SUPPORTED = | 9388 static const ParserErrorCode ASYNC_NOT_SUPPORTED = const ParserErrorCode( |
| 9385 const ParserErrorCode('ASYNC_NOT_SUPPORTED', | 9389 'ASYNC_NOT_SUPPORTED', |
| 9386 "Async and sync are not supported in this environment."); | 9390 "Async and sync are not supported in this environment."); |
| 9387 | 9391 |
| 9388 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( | 9392 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( |
| 9389 'BREAK_OUTSIDE_OF_LOOP', | 9393 'BREAK_OUTSIDE_OF_LOOP', |
| 9390 "A break statement cannot be used outside of a loop or switch statement"); | 9394 "A break statement cannot be used outside of a loop or switch statement"); |
| 9391 | 9395 |
| 9392 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( | 9396 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( |
| 9393 'CLASS_IN_CLASS', "Classes cannot be declared inside other classes"); | 9397 'CLASS_IN_CLASS', "Classes cannot be declared inside other classes"); |
| 9394 | 9398 |
| 9395 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode( | 9399 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode( |
| 9396 'COLON_IN_PLACE_OF_IN', "For-in loops use 'in' rather than a colon"); | 9400 'COLON_IN_PLACE_OF_IN', "For-in loops use 'in' rather than a colon"); |
| (...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11356 } | 11360 } |
| 11357 | 11361 |
| 11358 /** | 11362 /** |
| 11359 * Copy resolution data from the [fromNode] to the [toNode]. | 11363 * Copy resolution data from the [fromNode] to the [toNode]. |
| 11360 */ | 11364 */ |
| 11361 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11365 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 11362 ResolutionCopier copier = new ResolutionCopier(); | 11366 ResolutionCopier copier = new ResolutionCopier(); |
| 11363 copier._isEqualNodes(fromNode, toNode); | 11367 copier._isEqualNodes(fromNode, toNode); |
| 11364 } | 11368 } |
| 11365 } | 11369 } |
| OLD | NEW |