| 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_scanner; | 5 library dart2js.scanner.string_scanner; |
| 6 | 6 |
| 7 import 'array_based_scanner.dart' show ArrayBasedScanner; | 7 import 'array_based_scanner.dart' show ArrayBasedScanner; |
| 8 | 8 |
| 9 import 'precedence.dart' show PrecedenceInfo; | 9 import 'precedence.dart' show PrecedenceInfo; |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 DartDocToken createDartDocToken( | 63 DartDocToken createDartDocToken( |
| 64 PrecedenceInfo info, int start, bool asciiOnly, | 64 PrecedenceInfo info, int start, bool asciiOnly, |
| 65 [int extraOffset = 0]) { | 65 [int extraOffset = 0]) { |
| 66 return new DartDocToken.fromSubstring( | 66 return new DartDocToken.fromSubstring( |
| 67 info, string, start, scanOffset + extraOffset, tokenStart, | 67 info, string, start, scanOffset + extraOffset, tokenStart, |
| 68 canonicalize: true); | 68 canonicalize: true); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool atEndOfFile() => scanOffset >= string.length - 1; | 71 bool atEndOfFile() => scanOffset >= string.length - 1; |
| 72 } | 72 } |
| 73 |
| 74 /** |
| 75 * Scanner that creates tokens for a part of a larger [String], where the part |
| 76 * starts at the [baseOffset]. |
| 77 */ |
| 78 class SubStringScanner extends StringScanner { |
| 79 final int baseOffset; |
| 80 |
| 81 SubStringScanner(this.baseOffset, String string, |
| 82 {bool includeComments: false}) |
| 83 : super(string, includeComments: includeComments); |
| 84 |
| 85 @override |
| 86 void beginToken() { |
| 87 tokenStart = baseOffset + stringOffset; |
| 88 } |
| 89 } |
| OLD | NEW |