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 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 get start => _start(0); |
9 return _start(0); | 9 int get end => _end(0); |
10 } | |
11 | |
12 int end() { | |
13 return _end(0); | |
14 } | |
15 | 10 |
16 int _start(int groupIdx) { | 11 int _start(int groupIdx) { |
17 return _match[(groupIdx * MATCH_PAIR)]; | 12 return _match[(groupIdx * MATCH_PAIR)]; |
18 } | 13 } |
19 | 14 |
20 int _end(int groupIdx) { | 15 int _end(int groupIdx) { |
21 return _match[(groupIdx * MATCH_PAIR) + 1]; | 16 return _match[(groupIdx * MATCH_PAIR) + 1]; |
22 } | 17 } |
23 | 18 |
24 String group(int groupIdx) { | 19 String group(int groupIdx) { |
(...skipping 14 matching lines...) Expand all Loading... |
39 } | 34 } |
40 | 35 |
41 List<String> groups(List<int> groupsSpec) { | 36 List<String> groups(List<int> groupsSpec) { |
42 var groupsList = new List<String>(groupsSpec.length); | 37 var groupsList = new List<String>(groupsSpec.length); |
43 for (int i = 0; i < groupsSpec.length; i++) { | 38 for (int i = 0; i < groupsSpec.length; i++) { |
44 groupsList[i] = group(groupsSpec[i]); | 39 groupsList[i] = group(groupsSpec[i]); |
45 } | 40 } |
46 return groupsList; | 41 return groupsList; |
47 } | 42 } |
48 | 43 |
49 int groupCount() { | 44 int get groupCount => regexp._groupCount; |
50 return regexp._groupCount; | |
51 } | |
52 | 45 |
53 String get pattern => regexp.pattern; | 46 String get pattern => regexp.pattern; |
54 | 47 |
55 final RegExp regexp; | 48 final RegExp regexp; |
56 final String str; | 49 final String str; |
57 final List<int> _match; | 50 final List<int> _match; |
58 static const int MATCH_PAIR = 2; | 51 static const int MATCH_PAIR = 2; |
59 } | 52 } |
60 | 53 |
61 | 54 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 105 |
113 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; | 106 /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; |
114 | 107 |
115 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; | 108 /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
116 | 109 |
117 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; | 110 int get _groupCount native "JSSyntaxRegExp_getGroupCount"; |
118 | 111 |
119 List _ExecuteMatch(String str, int start_index) | 112 List _ExecuteMatch(String str, int start_index) |
120 native "JSSyntaxRegExp_ExecuteMatch"; | 113 native "JSSyntaxRegExp_ExecuteMatch"; |
121 } | 114 } |
OLD | NEW |