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 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 class JSSyntaxMatch implements Match { | 34 class JSSyntaxMatch implements Match { |
35 const JSSyntaxMatch(RegExp regexp, String str) | 35 const JSSyntaxMatch(RegExp regexp, String str) |
36 : this.pattern = regexp, this.str = str; | 36 : this.pattern = regexp, this.str = str; |
37 | 37 |
38 final String str; | 38 final String str; |
39 final Pattern pattern; | 39 final Pattern pattern; |
40 | 40 |
41 String operator[](int group) { | 41 String operator[](int group_) { |
42 return this.group(group); | 42 return this.group(group_); |
43 } | 43 } |
44 | 44 |
45 List<String> groups(List<int> groups) { | 45 List<String> groups(List<int> groups_) { |
46 List<String> strings = new List<String>(); | 46 List<String> strings = new List<String>(); |
47 groups.forEach((int group) { | 47 groups_.forEach((int group_) { |
48 strings.add(this.group(group)); | 48 strings.add(this.group(group_)); |
49 }); | 49 }); |
50 return strings; | 50 return strings; |
51 } | 51 } |
52 | 52 |
53 String group(int nb) native; | 53 String group(int nb) native; |
54 | 54 |
55 int start() native; | 55 int start() native; |
56 | 56 |
57 int end() native; | 57 int end() native; |
58 | 58 |
(...skipping 73 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 |