OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class JSRegExpMatch implements Match { | 5 class JSRegExpMatch implements Match { |
6 JSRegExpMatch(this.regexp, this.str, this._match); | 6 JSRegExpMatch(this.regexp, this.str, this._match); |
7 | 7 |
8 int start() { | 8 int start() { |
9 return _start(0); | 9 return _start(0); |
10 } | 10 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 Match firstMatch(String str) { | 58 Match firstMatch(String str) { |
59 List match = _ExecuteMatch(str, 0); | 59 List match = _ExecuteMatch(str, 0); |
60 if (match === null) { | 60 if (match === null) { |
61 return null; | 61 return null; |
62 } | 62 } |
63 return new JSRegExpMatch(this, str, match); | 63 return new JSRegExpMatch(this, str, match); |
64 } | 64 } |
65 | 65 |
66 Iterable<Match> allMatches(String str) { | 66 Iterable<Match> allMatches(String str) { |
67 var jsregexMatches = new GrowableObjectArray<JSRegExpMatch>(); | 67 var jsregexMatches = new List<JSRegExpMatch>(); |
68 List match = _ExecuteMatch(str, 0); | 68 List match = _ExecuteMatch(str, 0); |
69 if (match !== null) { | 69 if (match !== null) { |
70 jsregexMatches.add(new JSRegExpMatch(this, str, match)); | 70 jsregexMatches.add(new JSRegExpMatch(this, str, match)); |
71 while (true) { | 71 while (true) { |
72 match = _ExecuteMatch(str, match[1]); | 72 match = _ExecuteMatch(str, match[1]); |
73 if (match === null) { | 73 if (match === null) { |
74 break; | 74 break; |
75 } | 75 } |
76 jsregexMatches.add(new JSRegExpMatch(this, str, match)); | 76 jsregexMatches.add(new JSRegExpMatch(this, str, match)); |
77 } | 77 } |
(...skipping 18 matching lines...) Expand all Loading... |
96 | 96 |
97 bool get multiLine() native "JSSyntaxRegExp_multiLine"; | 97 bool get multiLine() native "JSSyntaxRegExp_multiLine"; |
98 | 98 |
99 bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase"; | 99 bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase"; |
100 | 100 |
101 int get _groupCount() native "JSSyntaxRegExp_getGroupCount"; | 101 int get _groupCount() native "JSSyntaxRegExp_getGroupCount"; |
102 | 102 |
103 List _ExecuteMatch(String str, int start_index) | 103 List _ExecuteMatch(String str, int start_index) |
104 native "JSSyntaxRegExp_ExecuteMatch"; | 104 native "JSSyntaxRegExp_ExecuteMatch"; |
105 } | 105 } |
OLD | NEW |