feat(RegExp): expose match indexes in Dart
This commit is contained in:
@ -137,14 +137,24 @@ class RegExpWrapper {
|
||||
}
|
||||
|
||||
class RegExpMatcherWrapper {
|
||||
static Match next(Iterator<Match> matcher) {
|
||||
static _JSLikeMatch next(Iterator<Match> matcher) {
|
||||
if (matcher.moveNext()) {
|
||||
return matcher.current;
|
||||
return new _JSLikeMatch(matcher.current);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class _JSLikeMatch {
|
||||
Match _m;
|
||||
|
||||
_JSLikeMatch(this._m);
|
||||
|
||||
String operator[](index) => _m[index];
|
||||
int get index => _m.start;
|
||||
int get length => _m.groupCount + 1;
|
||||
}
|
||||
|
||||
class FunctionWrapper {
|
||||
static apply(Function fn, posArgs) {
|
||||
return Function.apply(fn, posArgs);
|
||||
|
Reference in New Issue
Block a user