| 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 var slices = []; | 722 var slices = []; |
| 723 int length = 0; | 723 int length = 0; |
| 724 if (match.start > 0) { | 724 if (match.start > 0) { |
| 725 length += _addReplaceSlice(slices, 0, match.start); | 725 length += _addReplaceSlice(slices, 0, match.start); |
| 726 } | 726 } |
| 727 slices.add(replacement); | 727 slices.add(replacement); |
| 728 length += replacement.length; | 728 length += replacement.length; |
| 729 if (match.end < this.length) { | 729 if (match.end < this.length) { |
| 730 length += _addReplaceSlice(slices, match.end, this.length); | 730 length += _addReplaceSlice(slices, match.end, this.length); |
| 731 } | 731 } |
| 732 bool replacementIsOneByte = _replacement._isOneByte; | 732 bool replacementIsOneByte = replacement._isOneByte; |
| 733 if (replacementIsOneByte && | 733 if (replacementIsOneByte && |
| 734 length < _maxJoinReplaceOneByteStringLength && | 734 length < _maxJoinReplaceOneByteStringLength && |
| 735 this._isOneByte) { | 735 this._isOneByte) { |
| 736 return _joinReplaceAllOneByteResult(this, matches, length); | 736 return _joinReplaceAllOneByteResult(this, slices, length); |
| 737 } | 737 } |
| 738 return _joinReplaceAllResult(this, slices, length, replacementIsOneByte); | 738 return _joinReplaceAllResult(this, slices, length, replacementIsOneByte); |
| 739 } | 739 } |
| 740 | 740 |
| 741 static String _matchString(Match match) => match[0]; | 741 static String _matchString(Match match) => match[0]; |
| 742 static String _stringIdentity(String string) => string; | 742 static String _stringIdentity(String string) => string; |
| 743 | 743 |
| 744 String _splitMapJoinEmptyString(String onMatch(Match match), | 744 String _splitMapJoinEmptyString(String onMatch(Match match), |
| 745 String onNonMatch(String nonMatch)) { | 745 String onNonMatch(String nonMatch)) { |
| 746 // Pattern is the empty string. | 746 // Pattern is the empty string. |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 for (int g in groups) { | 1293 for (int g in groups) { |
| 1294 result.add(group(g)); | 1294 result.add(group(g)); |
| 1295 } | 1295 } |
| 1296 return result; | 1296 return result; |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 final int start; | 1299 final int start; |
| 1300 final String input; | 1300 final String input; |
| 1301 final String pattern; | 1301 final String pattern; |
| 1302 } | 1302 } |
| OLD | NEW |