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.parser; | 5 library analyzer.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/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 /** | 278 /** |
279 * Initialize a newly created parser to parse tokens in the given [_source] | 279 * Initialize a newly created parser to parse tokens in the given [_source] |
280 * and to report any errors that are found to the given [_errorListener]. | 280 * and to report any errors that are found to the given [_errorListener]. |
281 */ | 281 */ |
282 factory Parser(Source source, AnalysisErrorListener errorListener, | 282 factory Parser(Source source, AnalysisErrorListener errorListener, |
283 {bool useFasta}) { | 283 {bool useFasta}) { |
284 if (useFasta ?? Parser.useFasta) { | 284 if (useFasta ?? Parser.useFasta) { |
285 return new _Parser2(source, errorListener); | 285 return new _Parser2(source, errorListener); |
286 } else { | 286 } else { |
287 return new Parser._(source, errorListener); | 287 return new Parser.withoutFasta(source, errorListener); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 Parser._(this._source, this._errorListener); | 291 Parser.withoutFasta(this._source, this._errorListener); |
292 | 292 |
293 /** | 293 /** |
294 * Return the current token. | 294 * Return the current token. |
295 */ | 295 */ |
296 Token get currentToken => _currentToken; | 296 Token get currentToken => _currentToken; |
297 | 297 |
298 /** | 298 /** |
299 * Set the token with which the parse is to begin to the given [token]. | 299 * Set the token with which the parse is to begin to the given [token]. |
300 */ | 300 */ |
301 void set currentToken(Token token) { | 301 void set currentToken(Token token) { |
(...skipping 8324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8626 } | 8626 } |
8627 } | 8627 } |
8628 } | 8628 } |
8629 | 8629 |
8630 /** | 8630 /** |
8631 * Instances of this class are thrown when the parser detects that AST has | 8631 * Instances of this class are thrown when the parser detects that AST has |
8632 * too many nested expressions to be parsed safely and avoid possibility of | 8632 * too many nested expressions to be parsed safely and avoid possibility of |
8633 * [StackOverflowError] in the parser or during later analysis. | 8633 * [StackOverflowError] in the parser or during later analysis. |
8634 */ | 8634 */ |
8635 class _TooDeepTreeError {} | 8635 class _TooDeepTreeError {} |
OLD | NEW |