| 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 /** | 5 /** |
| 6 * [_StringBase] contains common methods used by concrete String | 6 * [_StringBase] contains common methods used by concrete String |
| 7 * implementations, e.g., _OneByteString. | 7 * implementations, e.g., _OneByteString. |
| 8 */ | 8 */ |
| 9 class _StringBase { | 9 class _StringBase { |
| 10 | 10 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // whitespaces for one byte strings. | 417 // whitespaces for one byte strings. |
| 418 bool _isWhitespace(int codePoint) { | 418 bool _isWhitespace(int codePoint) { |
| 419 return | 419 return |
| 420 (codePoint === 32) || // Space. | 420 (codePoint === 32) || // Space. |
| 421 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. | 421 ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 | 425 |
| 426 class _ExternalTwoByteString extends _StringBase implements String { | 426 class _ExternalTwoByteString extends _StringBase implements String { |
| 427 factory ExternalTwoByteString._uninstantiable() { | 427 factory _ExternalTwoByteString._uninstantiable() { |
| 428 throw new UnsupportedError( | 428 throw new UnsupportedError( |
| 429 "_ExternalTwoByteString can only be allocated by the VM"); | 429 "_ExternalTwoByteString can only be allocated by the VM"); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // Checks for one-byte whitespaces only. | 432 // Checks for one-byte whitespaces only. |
| 433 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid | 433 // TODO(srdjan): Investigate if 0x85 (NEL) and 0xA0 (NBSP) are valid |
| 434 // whitespaces. Add checking for multi-byte whitespace codepoints. | 434 // whitespaces. Add checking for multi-byte whitespace codepoints. |
| 435 bool _isWhitespace(int codePoint) { | 435 bool _isWhitespace(int codePoint) { |
| 436 return | 436 return |
| 437 (codePoint === 32) || // Space. | 437 (codePoint === 32) || // Space. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 for (int g in groups) { | 478 for (int g in groups) { |
| 479 result.add(group(g)); | 479 result.add(group(g)); |
| 480 } | 480 } |
| 481 return result; | 481 return result; |
| 482 } | 482 } |
| 483 | 483 |
| 484 final int start; | 484 final int start; |
| 485 final String str; | 485 final String str; |
| 486 final String pattern; | 486 final String pattern; |
| 487 } | 487 } |
| OLD | NEW |