| 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 patch class RegExp { | 5 patch class RegExp { |
| 6 /* patch */ factory RegExp(String pattern, | 6 /* patch */ factory RegExp(String pattern, |
| 7 {bool multiLine: false, | 7 {bool multiLine: false, |
| 8 bool ignoreCase: false}) { | 8 bool ignoreCase: false}) { |
| 9 return new _JSSyntaxRegExp(pattern, | 9 return new _JSSyntaxRegExp(pattern, |
| 10 multiLine: multiLine, | 10 multiLine: multiLine, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 Match firstMatch(String str) { | 71 Match firstMatch(String str) { |
| 72 List match = _ExecuteMatch(str, 0); | 72 List match = _ExecuteMatch(str, 0); |
| 73 if (match == null) { | 73 if (match == null) { |
| 74 return null; | 74 return null; |
| 75 } | 75 } |
| 76 return new _JSRegExpMatch(this, str, match); | 76 return new _JSRegExpMatch(this, str, match); |
| 77 } | 77 } |
| 78 | 78 |
| 79 Iterable<Match> allMatches(String str) { | 79 Iterable<Match> allMatches(String str) { |
| 80 if (str is! String) throw new ArgumentError(str); |
| 80 List<Match> result = new List<Match>(); | 81 List<Match> result = new List<Match>(); |
| 81 int length = str.length; | 82 int length = str.length; |
| 82 int startIndex = 0; | 83 int startIndex = 0; |
| 83 while (true) { | 84 while (true) { |
| 84 List match = _ExecuteMatch(str, startIndex); | 85 List match = _ExecuteMatch(str, startIndex); |
| 85 if (match == null) { | 86 if (match == null) { |
| 86 break; | 87 break; |
| 87 } | 88 } |
| 88 result.add(new _JSRegExpMatch(this, str, match)); | 89 result.add(new _JSRegExpMatch(this, str, match)); |
| 89 int endIndex = match[1]; | 90 int endIndex = match[1]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 bool get multiLine native "JSSyntaxRegExp_multiLine"; | 117 bool get multiLine native "JSSyntaxRegExp_multiLine"; |
| 117 | 118 |
| 118 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; | 119 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
| 119 | 120 |
| 120 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; | 121 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; |
| 121 | 122 |
| 122 List _ExecuteMatch(String str, int start_index) | 123 List _ExecuteMatch(String str, int start_index) |
| 123 native "JSSyntaxRegExp_ExecuteMatch"; | 124 native "JSSyntaxRegExp_ExecuteMatch"; |
| 124 } | 125 } |
| OLD | NEW |