| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:charcode/ascii.dart'; | 5 import 'package:charcode/ascii.dart'; |
| 6 import 'package:front_end/src/scanner/errors.dart'; | 6 import 'package:front_end/src/scanner/errors.dart'; |
| 7 import 'package:front_end/src/scanner/reader.dart'; | 7 import 'package:front_end/src/scanner/reader.dart'; |
| 8 import 'package:front_end/src/scanner/string_utilities.dart'; | 8 import 'package:front_end/src/scanner/string_utilities.dart'; |
| 9 import 'package:front_end/src/scanner/token.dart'; | 9 import 'package:front_end/src/scanner/token.dart'; |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 * determine whether source of the form "<<" should be scanned as a single | 122 * determine whether source of the form "<<" should be scanned as a single |
| 123 * left-shift operator or as two left angle brackets. This scanner does not have | 123 * left-shift operator or as two left angle brackets. This scanner does not have |
| 124 * any context, so it always resolves such conflicts by scanning the longest | 124 * any context, so it always resolves such conflicts by scanning the longest |
| 125 * possible token. | 125 * possible token. |
| 126 */ | 126 */ |
| 127 abstract class Scanner { | 127 abstract class Scanner { |
| 128 /** | 128 /** |
| 129 * A flag indicating whether the analyzer [Scanner] factory method | 129 * A flag indicating whether the analyzer [Scanner] factory method |
| 130 * will return a fasta based scanner or an analyzer based scanner. | 130 * will return a fasta based scanner or an analyzer based scanner. |
| 131 */ | 131 */ |
| 132 static bool useFasta = | 132 static bool useFasta = const bool.fromEnvironment("useFastaScanner"); |
| 133 const bool.fromEnvironment("useFastaScanner", defaultValue: true); | |
| 134 | 133 |
| 135 /** | 134 /** |
| 136 * The reader used to access the characters in the source. | 135 * The reader used to access the characters in the source. |
| 137 */ | 136 */ |
| 138 final CharacterReader _reader; | 137 final CharacterReader _reader; |
| 139 | 138 |
| 140 /** | 139 /** |
| 141 * The flag specifying whether documentation comments should be parsed. | 140 * The flag specifying whether documentation comments should be parsed. |
| 142 */ | 141 */ |
| 143 bool _preserveComments = true; | 142 bool _preserveComments = true; |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 } | 1334 } |
| 1336 | 1335 |
| 1337 /** | 1336 /** |
| 1338 * Checks if [value] is a single-line or multi-line comment. | 1337 * Checks if [value] is a single-line or multi-line comment. |
| 1339 */ | 1338 */ |
| 1340 static bool _isDocumentationComment(String value) { | 1339 static bool _isDocumentationComment(String value) { |
| 1341 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || | 1340 return StringUtilities.startsWith3(value, 0, $slash, $slash, $slash) || |
| 1342 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); | 1341 StringUtilities.startsWith3(value, 0, $slash, $asterisk, $asterisk); |
| 1343 } | 1342 } |
| 1344 } | 1343 } |
| OLD | NEW |