| 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 // 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 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 * An [errorListener] lock, if more than `0`, then errors are not reported. | 2265 * An [errorListener] lock, if more than `0`, then errors are not reported. |
| 2266 */ | 2266 */ |
| 2267 int _errorListenerLock = 0; | 2267 int _errorListenerLock = 0; |
| 2268 | 2268 |
| 2269 /** | 2269 /** |
| 2270 * A flag indicating whether parser is to parse function bodies. | 2270 * A flag indicating whether parser is to parse function bodies. |
| 2271 */ | 2271 */ |
| 2272 bool _parseFunctionBodies = true; | 2272 bool _parseFunctionBodies = true; |
| 2273 | 2273 |
| 2274 /** | 2274 /** |
| 2275 * A flag indicating whether the parser is to parse the async support. | |
| 2276 */ | |
| 2277 bool _parseAsync = AnalysisOptionsImpl.DEFAULT_ENABLE_ASYNC; | |
| 2278 | |
| 2279 /** | |
| 2280 * A flag indicating whether the parser is to parse deferred libraries. | 2275 * A flag indicating whether the parser is to parse deferred libraries. |
| 2281 */ | 2276 */ |
| 2282 bool _parseDeferredLibraries = | 2277 bool _parseDeferredLibraries = |
| 2283 AnalysisOptionsImpl.DEFAULT_ENABLE_DEFERRED_LOADING; | 2278 AnalysisOptionsImpl.DEFAULT_ENABLE_DEFERRED_LOADING; |
| 2284 | 2279 |
| 2285 /** | 2280 /** |
| 2286 * A flag indicating whether the parser is to parse enum declarations. | 2281 * A flag indicating whether the parser is to parse enum declarations. |
| 2287 */ | 2282 */ |
| 2288 bool _parseEnum = AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM; | 2283 bool _parseEnum = AnalysisOptionsImpl.DEFAULT_ENABLE_ENUM; |
| 2289 | 2284 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 */ | 2347 */ |
| 2353 bool get hasReturnTypeInTypeAlias { | 2348 bool get hasReturnTypeInTypeAlias { |
| 2354 Token next = _skipReturnType(_currentToken); | 2349 Token next = _skipReturnType(_currentToken); |
| 2355 if (next == null) { | 2350 if (next == null) { |
| 2356 return false; | 2351 return false; |
| 2357 } | 2352 } |
| 2358 return _tokenMatchesIdentifier(next); | 2353 return _tokenMatchesIdentifier(next); |
| 2359 } | 2354 } |
| 2360 | 2355 |
| 2361 /** | 2356 /** |
| 2362 * Set whether the parser is to parse the async support. | |
| 2363 * | |
| 2364 * @param parseAsync `true` if the parser is to parse the async support | |
| 2365 */ | |
| 2366 void set parseAsync(bool parseAsync) { | |
| 2367 this._parseAsync = parseAsync; | |
| 2368 } | |
| 2369 | |
| 2370 /** | |
| 2371 * Set whether the parser is to parse deferred libraries. | 2357 * Set whether the parser is to parse deferred libraries. |
| 2372 * | 2358 * |
| 2373 * @param parseDeferredLibraries `true` if the parser is to parse deferred lib
raries | 2359 * @param parseDeferredLibraries `true` if the parser is to parse deferred lib
raries |
| 2374 */ | 2360 */ |
| 2375 void set parseDeferredLibraries(bool parseDeferredLibraries) { | 2361 void set parseDeferredLibraries(bool parseDeferredLibraries) { |
| 2376 this._parseDeferredLibraries = parseDeferredLibraries; | 2362 this._parseDeferredLibraries = parseDeferredLibraries; |
| 2377 } | 2363 } |
| 2378 | 2364 |
| 2379 /** | 2365 /** |
| 2380 * Set whether the parser is to parse enum declarations. | 2366 * Set whether the parser is to parse enum declarations. |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 return false; | 4373 return false; |
| 4388 } | 4374 } |
| 4389 Token afterParameters = _skipFormalParameterList(startToken); | 4375 Token afterParameters = _skipFormalParameterList(startToken); |
| 4390 if (afterParameters == null) { | 4376 if (afterParameters == null) { |
| 4391 return false; | 4377 return false; |
| 4392 } | 4378 } |
| 4393 if (afterParameters.matchesAny( | 4379 if (afterParameters.matchesAny( |
| 4394 [TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) { | 4380 [TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) { |
| 4395 return true; | 4381 return true; |
| 4396 } | 4382 } |
| 4397 if (_parseAsync) { | 4383 String lexeme = afterParameters.lexeme; |
| 4398 String lexeme = afterParameters.lexeme; | 4384 return lexeme == ASYNC || lexeme == SYNC; |
| 4399 return lexeme == ASYNC || lexeme == SYNC; | |
| 4400 } | |
| 4401 return false; | |
| 4402 } | 4385 } |
| 4403 | 4386 |
| 4404 /** | 4387 /** |
| 4405 * Return `true` if the given character is a valid hexadecimal digit. | 4388 * Return `true` if the given character is a valid hexadecimal digit. |
| 4406 * | 4389 * |
| 4407 * @param character the character being tested | 4390 * @param character the character being tested |
| 4408 * @return `true` if the character is a valid hexadecimal digit | 4391 * @return `true` if the character is a valid hexadecimal digit |
| 4409 */ | 4392 */ |
| 4410 bool _isHexDigit(int character) => | 4393 bool _isHexDigit(int character) => |
| 4411 (0x30 <= character && character <= 0x39) || | 4394 (0x30 <= character && character <= 0x39) || |
| (...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6518 if (_matches(TokenType.STRING)) { | 6501 if (_matches(TokenType.STRING)) { |
| 6519 stringLiteral = parseStringLiteral(); | 6502 stringLiteral = parseStringLiteral(); |
| 6520 } | 6503 } |
| 6521 return new NativeFunctionBody( | 6504 return new NativeFunctionBody( |
| 6522 nativeToken, | 6505 nativeToken, |
| 6523 stringLiteral, | 6506 stringLiteral, |
| 6524 _expect(TokenType.SEMICOLON)); | 6507 _expect(TokenType.SEMICOLON)); |
| 6525 } | 6508 } |
| 6526 Token keyword = null; | 6509 Token keyword = null; |
| 6527 Token star = null; | 6510 Token star = null; |
| 6528 if (_parseAsync) { | 6511 if (_matchesString(ASYNC)) { |
| 6529 if (_matchesString(ASYNC)) { | 6512 keyword = getAndAdvance(); |
| 6530 keyword = getAndAdvance(); | 6513 if (_matches(TokenType.STAR)) { |
| 6531 if (_matches(TokenType.STAR)) { | 6514 star = getAndAdvance(); |
| 6532 star = getAndAdvance(); | 6515 _inGenerator = true; |
| 6533 _inGenerator = true; | 6516 } |
| 6534 } | 6517 _inAsync = true; |
| 6535 _inAsync = true; | 6518 } else if (_matchesString(SYNC)) { |
| 6536 } else if (_matchesString(SYNC)) { | 6519 keyword = getAndAdvance(); |
| 6537 keyword = getAndAdvance(); | 6520 if (_matches(TokenType.STAR)) { |
| 6538 if (_matches(TokenType.STAR)) { | 6521 star = getAndAdvance(); |
| 6539 star = getAndAdvance(); | 6522 _inGenerator = true; |
| 6540 _inGenerator = true; | |
| 6541 } | |
| 6542 } | 6523 } |
| 6543 } | 6524 } |
| 6544 if (_matches(TokenType.FUNCTION)) { | 6525 if (_matches(TokenType.FUNCTION)) { |
| 6545 if (keyword != null) { | 6526 if (keyword != null) { |
| 6546 if (!_tokenMatchesString(keyword, ASYNC)) { | 6527 if (!_tokenMatchesString(keyword, ASYNC)) { |
| 6547 _reportErrorForToken(ParserErrorCode.INVALID_SYNC, keyword); | 6528 _reportErrorForToken(ParserErrorCode.INVALID_SYNC, keyword); |
| 6548 keyword = null; | 6529 keyword = null; |
| 6549 } else if (star != null) { | 6530 } else if (star != null) { |
| 6550 _reportErrorForToken( | 6531 _reportErrorForToken( |
| 6551 ParserErrorCode.INVALID_STAR_AFTER_ASYNC, | 6532 ParserErrorCode.INVALID_STAR_AFTER_ASYNC, |
| (...skipping 5583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12135 * Copy resolution data from one node to another. | 12116 * Copy resolution data from one node to another. |
| 12136 * | 12117 * |
| 12137 * @param fromNode the node from which resolution information will be copied | 12118 * @param fromNode the node from which resolution information will be copied |
| 12138 * @param toNode the node to which resolution information will be copied | 12119 * @param toNode the node to which resolution information will be copied |
| 12139 */ | 12120 */ |
| 12140 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 12121 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 12141 ResolutionCopier copier = new ResolutionCopier(); | 12122 ResolutionCopier copier = new ResolutionCopier(); |
| 12142 copier._isEqualNodes(fromNode, toNode); | 12123 copier._isEqualNodes(fromNode, toNode); |
| 12143 } | 12124 } |
| 12144 } | 12125 } |
| OLD | NEW |