OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 const int _maxAscii = 0x7f; | 5 const int _maxAscii = 0x7f; |
6 const int _maxLatin1 = 0xff; | 6 const int _maxLatin1 = 0xff; |
7 const int _maxUtf16 = 0xffff; | 7 const int _maxUtf16 = 0xffff; |
8 const int _maxUnicode = 0x10ffff; | 8 const int _maxUnicode = 0x10ffff; |
9 | 9 |
10 @patch class String { | 10 @patch class String { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 int code = charCodes[i]; | 148 int code = charCodes[i]; |
149 if (code is! _Smi) throw new ArgumentError(charCodes); | 149 if (code is! _Smi) throw new ArgumentError(charCodes); |
150 bits |= code; | 150 bits |= code; |
151 } | 151 } |
152 return bits; | 152 return bits; |
153 } | 153 } |
154 | 154 |
155 static String _createStringFromIterable(Iterable<int> charCodes, | 155 static String _createStringFromIterable(Iterable<int> charCodes, |
156 int start, int end) { | 156 int start, int end) { |
157 // Treat charCodes as Iterable. | 157 // Treat charCodes as Iterable. |
158 if (charCodes is EfficientLength) { | 158 if (charCodes is EfficientLengthIterable) { |
159 int length = charCodes.length; | 159 int length = charCodes.length; |
160 end = RangeError.checkValidRange(start, end, length); | 160 end = RangeError.checkValidRange(start, end, length); |
161 List charCodeList = new List.from(charCodes.take(end).skip(start), | 161 List charCodeList = new List.from(charCodes.take(end).skip(start), |
162 growable: false); | 162 growable: false); |
163 return createFromCharCodes(charCodeList, 0, charCodeList.length, null); | 163 return createFromCharCodes(charCodeList, 0, charCodeList.length, null); |
164 } | 164 } |
165 // Don't know length of iterable, so iterate and see if all the values | 165 // Don't know length of iterable, so iterate and see if all the values |
166 // are there. | 166 // are there. |
167 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); | 167 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); |
168 var it = charCodes.iterator; | 168 var it = charCodes.iterator; |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 int end = index + _pattern.length; | 1357 int end = index + _pattern.length; |
1358 _current = new _StringMatch(index, _input, _pattern); | 1358 _current = new _StringMatch(index, _input, _pattern); |
1359 // Empty match, don't start at same location again. | 1359 // Empty match, don't start at same location again. |
1360 if (end == _index) end++; | 1360 if (end == _index) end++; |
1361 _index = end; | 1361 _index = end; |
1362 return true; | 1362 return true; |
1363 } | 1363 } |
1364 | 1364 |
1365 Match get current => _current; | 1365 Match get current => _current; |
1366 } | 1366 } |
OLD | NEW |