| 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 List regExpExec(JSSyntaxRegExp regExp, String str) { | 5 List regExpExec(JSSyntaxRegExp regExp, String str) { |
| 6 var nativeRegExp = regExpGetNative(regExp); | 6 var nativeRegExp = regExpGetNative(regExp); |
| 7 var result = JS('List', r'#.exec(#)', nativeRegExp, str); | 7 var result = JS('List', r'#.exec(#)', nativeRegExp, str); |
| 8 if (JS('bool', r'# == null', result)) return null; | 8 if (JS('bool', r'# == null', result)) return null; |
| 9 return result; | 9 return result; |
| 10 } | 10 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 List<String> groups(List<int> groups) { | 114 List<String> groups(List<int> groups) { |
| 115 List<String> out = []; | 115 List<String> out = []; |
| 116 for (int i in groups) { | 116 for (int i in groups) { |
| 117 out.add(group(i)); | 117 out.add(group(i)); |
| 118 } | 118 } |
| 119 return out; | 119 return out; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 class _AllMatchesIterable implements Iterable<Match> { | 123 class _AllMatchesIterable extends Iterable<Match> { |
| 124 final JSSyntaxRegExp _re; | 124 final JSSyntaxRegExp _re; |
| 125 final String _str; | 125 final String _str; |
| 126 | 126 |
| 127 const _AllMatchesIterable(this._re, this._str); | 127 const _AllMatchesIterable(this._re, this._str); |
| 128 | 128 |
| 129 Iterator<Match> iterator() => new _AllMatchesIterator(_re, _str); | 129 Iterator<Match> iterator() => new _AllMatchesIterator(_re, _str); |
| 130 } | 130 } |
| 131 | 131 |
| 132 class _AllMatchesIterator implements Iterator<Match> { | 132 class _AllMatchesIterator implements Iterator<Match> { |
| 133 final RegExp _re; | 133 final RegExp _re; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 160 // hidden global flag. | 160 // hidden global flag. |
| 161 _next = _re.firstMatch(_str); | 161 _next = _re.firstMatch(_str); |
| 162 if (_next == null) { | 162 if (_next == null) { |
| 163 _done = true; | 163 _done = true; |
| 164 return false; | 164 return false; |
| 165 } else { | 165 } else { |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 } | 169 } |
| OLD | NEW |