| 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 /** | 5 /** |
| 6 * Scanner that reads from a String and creates tokens that points to | 6 * Scanner that reads from a String and creates tokens that points to |
| 7 * substrings. | 7 * substrings. |
| 8 */ | 8 */ |
| 9 class StringScanner extends ArrayBasedScanner<SourceString> { | 9 class StringScanner extends ArrayBasedScanner<SourceString> { |
| 10 final String string; | 10 final String string; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool operator ==(other) { | 46 bool operator ==(other) { |
| 47 return other is SourceString && toString() == other.toString(); | 47 return other is SourceString && toString() == other.toString(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 int get length() => end - begin; | 50 int get length() => end - begin; |
| 51 | 51 |
| 52 void printOn(StringBuffer sb) { | 52 void printOn(StringBuffer sb) { |
| 53 sb.add(this); | 53 sb.add(this); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void printSubstringOn(StringBuffer sb, int from, int to) { |
| 57 if (from >= to) return; |
| 58 sb.add(internalString.substring(begin + from, begin + to)); |
| 59 } |
| 60 |
| 61 int charCodeAt(int index) => internalString.charCodeAt(begin + index); |
| 62 |
| 63 String operator[](int index) => internalString[begin + index]; |
| 64 |
| 56 String toString() => internalString.substring(begin, end); | 65 String toString() => internalString.substring(begin, end); |
| 57 | 66 |
| 58 String get stringValue() => toString(); | 67 String get stringValue() => toString(); |
| 59 } | 68 } |
| OLD | NEW |