Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: runtime/lib/regexp_patch.dart

Issue 16206008: Fix-up RegExp implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix 8334 too Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/js_string.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/js_string.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698