| 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 start() { |
| 9 return _start(0); | 9 return _start(0); |
| 10 } | 10 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 String group(int groupIdx) { | 24 String group(int groupIdx) { |
| 25 if (groupIdx < 0 || groupIdx > regexp._groupCount) { | 25 if (groupIdx < 0 || groupIdx > regexp._groupCount) { |
| 26 throw new IndexOutOfRangeException(groupIdx); | 26 throw new IndexOutOfRangeException(groupIdx); |
| 27 } | 27 } |
| 28 int startIndex = _start(groupIdx); | 28 int startIndex = _start(groupIdx); |
| 29 int endIndex = _end(groupIdx); | 29 int endIndex = _end(groupIdx); |
| 30 if (startIndex == -1) { | 30 if (startIndex == -1) { |
| 31 assert(endIndex == -1); | 31 assert(endIndex == -1); |
| 32 return null; | 32 return null; |
| 33 } | 33 } |
| 34 return str.substringUnchecked_(startIndex, endIndex); | 34 return str._substringUnchecked(startIndex, endIndex); |
| 35 } | 35 } |
| 36 | 36 |
| 37 String operator [](int groupIdx) { | 37 String operator [](int groupIdx) { |
| 38 return this.group(groupIdx); | 38 return this.group(groupIdx); |
| 39 } | 39 } |
| 40 | 40 |
| 41 List<String> groups(List<int> groupsSpec) { | 41 List<String> groups(List<int> groupsSpec) { |
| 42 var groupsList = new List<String>(groupsSpec.length); | 42 var groupsList = new List<String>(groupsSpec.length); |
| 43 for (int i = 0; i < groupsSpec.length; i++) { | 43 for (int i = 0; i < groupsSpec.length; i++) { |
| 44 groupsList[i] = group(groupsSpec[i]); | 44 groupsList[i] = group(groupsSpec[i]); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 /* patch */ bool hasMatch(String str) { | 98 /* patch */ bool hasMatch(String str) { |
| 99 List match = _ExecuteMatch(str, 0); | 99 List match = _ExecuteMatch(str, 0); |
| 100 return (match === null) ? false : true; | 100 return (match === null) ? false : true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 /* patch */ String stringMatch(String str) { | 103 /* patch */ String stringMatch(String str) { |
| 104 List match = _ExecuteMatch(str, 0); | 104 List match = _ExecuteMatch(str, 0); |
| 105 if (match === null) { | 105 if (match === null) { |
| 106 return null; | 106 return null; |
| 107 } | 107 } |
| 108 return str.substringUnchecked_(match[0], match[1]); | 108 return str._substringUnchecked(match[0], match[1]); |
| 109 } | 109 } |
| 110 | 110 |
| 111 /* patch */ String get pattern() native "JSSyntaxRegExp_getPattern"; | 111 /* patch */ String get pattern() native "JSSyntaxRegExp_getPattern"; |
| 112 | 112 |
| 113 /* patch */ bool get multiLine() native "JSSyntaxRegExp_multiLine"; | 113 /* patch */ bool get multiLine() native "JSSyntaxRegExp_multiLine"; |
| 114 | 114 |
| 115 /* patch */ bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase"; | 115 /* patch */ bool get ignoreCase() native "JSSyntaxRegExp_ignoreCase"; |
| 116 | 116 |
| 117 int get _groupCount() native "JSSyntaxRegExp_getGroupCount"; | 117 int get _groupCount() native "JSSyntaxRegExp_getGroupCount"; |
| 118 | 118 |
| 119 List _ExecuteMatch(String str, int start_index) | 119 List _ExecuteMatch(String str, int start_index) |
| 120 native "JSSyntaxRegExp_ExecuteMatch"; | 120 native "JSSyntaxRegExp_ExecuteMatch"; |
| 121 } | 121 } |
| OLD | NEW |