| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 static String _createOneByteString(List<int> charCodes, int start, int len) { | 213 static String _createOneByteString(List<int> charCodes, int start, int len) { |
| 214 // It's always faster to do this in Dart than to call into the runtime. | 214 // It's always faster to do this in Dart than to call into the runtime. |
| 215 var s = _OneByteString._allocate(len); | 215 var s = _OneByteString._allocate(len); |
| 216 for (int i = 0; i < len; i++) { | 216 for (int i = 0; i < len; i++) { |
| 217 s._setAt(i, charCodes[start + i]); | 217 s._setAt(i, charCodes[start + i]); |
| 218 } | 218 } |
| 219 return s; | 219 return s; |
| 220 } | 220 } |
| 221 | 221 |
| 222 static String _createTwoByteString(List<int> charCodes, int start, int len) { | |
| 223 // TODO(lrn): Create string without scanning charCodes again - all values | |
| 224 // in the [start..end] range are uint16 values. | |
| 225 return _createFromCodePoints(charCodes, start, end); | |
| 226 } | |
| 227 | |
| 228 static String _createFromCodePoints(List<int> codePoints, int start, int end) | 222 static String _createFromCodePoints(List<int> codePoints, int start, int end) |
| 229 native "StringBase_createFromCodePoints"; | 223 native "StringBase_createFromCodePoints"; |
| 230 | 224 |
| 231 String operator [](int index) native "String_charAt"; | 225 String operator [](int index) native "String_charAt"; |
| 232 | 226 |
| 233 int codeUnitAt(int index) native "String_codeUnitAt"; | 227 int codeUnitAt(int index) native "String_codeUnitAt"; |
| 234 | 228 |
| 235 int get length native "String_getLength"; | 229 int get length native "String_getLength"; |
| 236 | 230 |
| 237 bool get isEmpty { | 231 bool get isEmpty { |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 int end = index + _pattern.length; | 1345 int end = index + _pattern.length; |
| 1352 _current = new _StringMatch(index, _input, _pattern); | 1346 _current = new _StringMatch(index, _input, _pattern); |
| 1353 // Empty match, don't start at same location again. | 1347 // Empty match, don't start at same location again. |
| 1354 if (end == _index) end++; | 1348 if (end == _index) end++; |
| 1355 _index = end; | 1349 _index = end; |
| 1356 return true; | 1350 return true; |
| 1357 } | 1351 } |
| 1358 | 1352 |
| 1359 Match get current => _current; | 1353 Match get current => _current; |
| 1360 } | 1354 } |
| OLD | NEW |