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 JSSyntaxRegExp implements RegExp { | 5 class JSSyntaxRegExp implements RegExp { |
6 const JSSyntaxRegExp( | 6 const JSSyntaxRegExp( |
7 String this.pattern, | 7 String this.pattern, |
8 [bool this.multiLine = false, | 8 [bool this.multiLine = false, |
9 bool this.ignoreCase = false]); | 9 bool this.ignoreCase = false]); |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 int end() native; | 57 int end() native; |
58 | 58 |
59 groupCount() native; | 59 groupCount() native; |
60 | 60 |
61 static _new(RegExp regexp, String str) native { | 61 static _new(RegExp regexp, String str) native { |
62 return new JSSyntaxMatch(regexp, str); | 62 return new JSSyntaxMatch(regexp, str); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 class _LazyAllMatches implements Collection<Match> { | 66 class _LazyAllMatches implements Collection<Match> { |
67 JSSyntaxRegExp _regexp; | 67 final JSSyntaxRegExp _regexp; |
68 String _str; | 68 final String _str; |
69 | 69 |
70 const _LazyAllMatches(this._regexp, this._str); | 70 const _LazyAllMatches(this._regexp, this._str); |
71 | 71 |
72 void forEach(void f(Match match)) { | 72 void forEach(void f(Match match)) { |
73 for (Match match in this) { | 73 for (Match match in this) { |
74 f(match); | 74 f(match); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 Collection<Match> filter(bool f(Match match)) { | 78 Collection<Match> filter(bool f(Match match)) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 bool hasNext() { | 133 bool hasNext() { |
134 if (_nextMatch != null) return true; | 134 if (_nextMatch != null) return true; |
135 _nextMatch = _computeNextMatch(_regexp, _str); | 135 _nextMatch = _computeNextMatch(_regexp, _str); |
136 return (_nextMatch != null); | 136 return (_nextMatch != null); |
137 } | 137 } |
138 | 138 |
139 void _jsInit(JSSyntaxRegExp regexp) native; | 139 void _jsInit(JSSyntaxRegExp regexp) native; |
140 Match _computeNextMatch(JSSyntaxRegExp regexp, String str) native; | 140 Match _computeNextMatch(JSSyntaxRegExp regexp, String str) native; |
141 } | 141 } |
OLD | NEW |