Chromium Code Reviews| 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 } |
| 11 | 11 |
| 12 int end() { | 12 int end() { |
| 13 return _end(0); | 13 return _end(0); |
| 14 } | 14 } |
| 15 | 15 |
| 16 int _start(int group) { | 16 int _start(int groupIdx) { |
|
Ivan Posva
2012/03/14 05:34:05
What is the warning here?
zundel
2012/03/14 12:56:21
parameter 'group' shadows the method 'group' in th
| |
| 17 return _match[(group * _kMatchPair)]; | 17 return _match[(groupIdx * _kMatchPair)]; |
| 18 } | 18 } |
| 19 | 19 |
| 20 int _end(int group) { | 20 int _end(int groupIdx) { |
| 21 return _match[(group * _kMatchPair) + 1]; | 21 return _match[(groupIdx * _kMatchPair) + 1]; |
| 22 } | 22 } |
| 23 | 23 |
| 24 String group(int group) { | 24 String group(int groupIdx) { |
| 25 return str.substringUnchecked_(_start(group), _end(group)); | 25 return str.substringUnchecked_(_start(groupIdx), _end(groupIdx)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 String operator [](int group) { | 28 String operator [](int groupIdx) { |
| 29 return str.substringUnchecked_(_start(group), _end(group)); | 29 return str.substringUnchecked_(_start(groupIdx), _end(groupIdx)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 List<String> groups(List<int> groups) { | 32 List<String> groups(List<int> groupsSpec) { |
| 33 var groupsList = new List<String>(groups.length); | 33 var groupsList = new List<String>(groupsSpec.length); |
| 34 for (int i = 0; i < groups.length; i++) { | 34 for (int i = 0; i < groupsSpec.length; i++) { |
| 35 int grp_idx = groups[i]; | 35 int grp_idx = groupsSpec[i]; |
| 36 groupsList[i] = str.substringUnchecked_(_start(grp_idx), _end(grp_idx)); | 36 groupsList[i] = str.substringUnchecked_(_start(grp_idx), _end(grp_idx)); |
| 37 } | 37 } |
| 38 return groupsList; | 38 return groupsList; |
| 39 } | 39 } |
| 40 | 40 |
| 41 int groupCount() { | 41 int groupCount() { |
| 42 return regexp._groupCount; | 42 return regexp._groupCount; |
| 43 } | 43 } |
| 44 | 44 |
| 45 final RegExp regexp; | 45 final RegExp regexp; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |