Chromium Code Reviews| Index: runtime/lib/regexp_patch.dart |
| diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart |
| index e365f30e5bb7356b983b7fb503cd1707dc223e4c..fa0cba96e5970f67969bc21562d862f5e8ff2996 100644 |
| --- a/runtime/lib/regexp_patch.dart |
| +++ b/runtime/lib/regexp_patch.dart |
| @@ -13,21 +13,21 @@ patch class RegExp { |
| } |
| class _JSRegExpMatch implements Match { |
| - _JSRegExpMatch(this.regexp, this.str, this._match); |
| + _JSRegExpMatch(this._regexp, this.str, this._match); |
| int get start => _start(0); |
| int get end => _end(0); |
| int _start(int groupIdx) { |
| - return _match[(groupIdx * MATCH_PAIR)]; |
| + return _match[(groupIdx * _MATCH_PAIR)]; |
| } |
| int _end(int groupIdx) { |
| - return _match[(groupIdx * MATCH_PAIR) + 1]; |
| + return _match[(groupIdx * _MATCH_PAIR) + 1]; |
| } |
| String group(int groupIdx) { |
| - if (groupIdx < 0 || groupIdx > regexp._groupCount) { |
| + if (groupIdx < 0 || groupIdx > _regexp._groupCount) { |
| throw new RangeError.value(groupIdx); |
| } |
| int startIndex = _start(groupIdx); |
| @@ -51,14 +51,14 @@ class _JSRegExpMatch implements Match { |
| return groupsList; |
| } |
| - int get groupCount => regexp._groupCount; |
| + int get groupCount => _regexp._groupCount; |
| - String get pattern => regexp.pattern; |
| + Pattern get pattern => _regexp; |
| - final RegExp regexp; |
| + final RegExp _regexp; |
| final String str; |
| final List<int> _match; |
| - static const int MATCH_PAIR = 2; |
| + static const int _MATCH_PAIR = 2; |
| } |
| @@ -87,13 +87,13 @@ class _JSSyntaxRegExp implements RegExp { |
| break; |
| } |
| result.add(new _JSRegExpMatch(this, str, match)); |
| - int endIndex = match[1]; |
| - if (endIndex == length) { |
| - break; |
| - } else if (match[0] == endIndex) { |
| - ++startIndex; // empty match, advance and restart |
| - } else { |
| - startIndex = endIndex; |
| + startIndex = match[1]; |
|
floitsch
2013/06/06 11:30:02
Add comment that you set up the startIndex for the
|
| + if (match[0] == startIndex) { |
| + // Zero-length match. |
| + if (startIndex == length) { |
| + break; |
| + } |
| + startIndex++; |
| } |
| } |
| return result; |