| 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); | |
| 81 List<Match> result = new List<Match>(); | 80 List<Match> result = new List<Match>(); |
| 82 int length = str.length; | 81 int length = str.length; |
| 83 int startIndex = 0; | 82 int startIndex = 0; |
| 84 while (true) { | 83 while (true) { |
| 85 List match = _ExecuteMatch(str, startIndex); | 84 List match = _ExecuteMatch(str, startIndex); |
| 86 if (match == null) { | 85 if (match == null) { |
| 87 break; | 86 break; |
| 88 } | 87 } |
| 89 result.add(new _JSRegExpMatch(this, str, match)); | 88 result.add(new _JSRegExpMatch(this, str, match)); |
| 90 int endIndex = match[1]; | 89 int endIndex = match[1]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 116 | 115 |
| 117 bool get multiLine native "JSSyntaxRegExp_multiLine"; | 116 bool get multiLine native "JSSyntaxRegExp_multiLine"; |
| 118 | 117 |
| 119 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; | 118 bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
| 120 | 119 |
| 121 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; | 120 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; |
| 122 | 121 |
| 123 List _ExecuteMatch(String str, int start_index) | 122 List _ExecuteMatch(String str, int start_index) |
| 124 native "JSSyntaxRegExp_ExecuteMatch"; | 123 native "JSSyntaxRegExp_ExecuteMatch"; |
| 125 } | 124 } |
| OLD | NEW |