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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 buffer.write(onNonMatch(this.substring(startIndex, match.start))); | 794 buffer.write(onNonMatch(this.substring(startIndex, match.start))); |
795 buffer.write(onMatch(match).toString()); | 795 buffer.write(onMatch(match).toString()); |
796 startIndex = match.end; | 796 startIndex = match.end; |
797 } | 797 } |
798 buffer.write(onNonMatch(this.substring(startIndex))); | 798 buffer.write(onNonMatch(this.substring(startIndex))); |
799 return buffer.toString(); | 799 return buffer.toString(); |
800 } | 800 } |
801 | 801 |
802 // Convert single object to string. | 802 // Convert single object to string. |
803 static String _interpolateSingle(Object o) { | 803 static String _interpolateSingle(Object o) { |
| 804 if (o is String) return o; |
804 final s = o.toString(); | 805 final s = o.toString(); |
805 if (s is! String) { | 806 if (s is! String) { |
806 throw new ArgumentError(s); | 807 throw new ArgumentError(s); |
807 } | 808 } |
808 return s; | 809 return s; |
809 } | 810 } |
810 | 811 |
811 /** | 812 /** |
812 * Convert all objects in [values] to strings and concat them | 813 * Convert all objects in [values] to strings and concat them |
813 * into a result string. | 814 * into a result string. |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 int end = index + _pattern.length; | 1351 int end = index + _pattern.length; |
1351 _current = new _StringMatch(index, _input, _pattern); | 1352 _current = new _StringMatch(index, _input, _pattern); |
1352 // Empty match, don't start at same location again. | 1353 // Empty match, don't start at same location again. |
1353 if (end == _index) end++; | 1354 if (end == _index) end++; |
1354 _index = end; | 1355 _index = end; |
1355 return true; | 1356 return true; |
1356 } | 1357 } |
1357 | 1358 |
1358 Match get current => _current; | 1359 Match get current => _current; |
1359 } | 1360 } |
OLD | NEW |