| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 const SubstringWrapper(String this.internalString, | 41 const SubstringWrapper(String this.internalString, |
| 42 int this.begin, int this.end); | 42 int this.begin, int this.end); |
| 43 | 43 |
| 44 int hashCode() => toString().hashCode(); | 44 int hashCode() => toString().hashCode(); |
| 45 | 45 |
| 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 Iterator<int> iterator() => |
| 51 new StringCodeIterator.substring(stringValue, begin, end); |
| 52 |
| 50 int get length() => end - begin; | 53 int get length() => end - begin; |
| 51 | 54 |
| 52 void printOn(StringBuffer sb) { | 55 void printOn(StringBuffer sb) { |
| 53 sb.add(this); | 56 sb.add(this); |
| 54 } | 57 } |
| 55 | 58 |
| 56 String toString() => internalString.substring(begin, end); | 59 String toString() => internalString.substring(begin, end); |
| 57 | 60 |
| 58 String get stringValue() => toString(); | 61 String get stringValue() => toString(); |
| 59 } | 62 } |
| OLD | NEW |