| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 dart2js.scanner.string; | 5 library dart2js.scanner.string; |
| 6 | 6 |
| 7 import '../io/source_file.dart' show SourceFile; | 7 import '../io/source_file.dart' show SourceFile; |
| 8 import '../tokens/precedence.dart' show PrecedenceInfo; | 8 import '../tokens/precedence.dart' show PrecedenceInfo; |
| 9 import '../tokens/token.dart' show StringToken, Token; | 9 import '../tokens/token.dart' show StringToken, Token; |
| 10 | |
| 11 import 'array_based_scanner.dart' show ArrayBasedScanner; | 10 import 'array_based_scanner.dart' show ArrayBasedScanner; |
| 12 | 11 |
| 13 /** | 12 /** |
| 14 * Scanner that reads from a String and creates tokens that points to | 13 * Scanner that reads from a String and creates tokens that points to |
| 15 * substrings. | 14 * substrings. |
| 16 */ | 15 */ |
| 17 class StringScanner extends ArrayBasedScanner { | 16 class StringScanner extends ArrayBasedScanner { |
| 18 /** The file content. */ | 17 /** The file content. */ |
| 19 String string; | 18 String string; |
| 20 | 19 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void appendSubstringToken(PrecedenceInfo info, int start, bool asciiOnly, | 53 void appendSubstringToken(PrecedenceInfo info, int start, bool asciiOnly, |
| 55 [int extraOffset = 0]) { | 54 [int extraOffset = 0]) { |
| 56 tail.next = new StringToken.fromSubstring( | 55 tail.next = new StringToken.fromSubstring( |
| 57 info, string, start, scanOffset + extraOffset, tokenStart, | 56 info, string, start, scanOffset + extraOffset, tokenStart, |
| 58 canonicalize: true); | 57 canonicalize: true); |
| 59 tail = tail.next; | 58 tail = tail.next; |
| 60 } | 59 } |
| 61 | 60 |
| 62 bool atEndOfFile() => scanOffset >= string.length - 1; | 61 bool atEndOfFile() => scanOffset >= string.length - 1; |
| 63 } | 62 } |
| OLD | NEW |