|
@@ -40,20 +40,20 @@
|
|
|
|
|
|
public function matchedLeft() : String {
|
|
|
if( result == null ) throw "No string matched";
|
|
|
- var s : String = untyped result.input;
|
|
|
- return s.substr(0,untyped result["index"]);
|
|
|
+ var s : String = result.input;
|
|
|
+ return s.substr(0, result.index);
|
|
|
}
|
|
|
|
|
|
public function matchedRight() : String {
|
|
|
if( result == null ) throw "No string matched";
|
|
|
- var rl = (result[untyped "index"] : Int) + (result[0] : String).length;
|
|
|
- var s : String = untyped result.input;
|
|
|
+ var rl = (result.index : Int) + (result[0] : String).length;
|
|
|
+ var s : String = result.input;
|
|
|
return s.substr(rl,s.length - rl);
|
|
|
}
|
|
|
|
|
|
public function matchedPos() : { pos : Int, len : Int } {
|
|
|
if( result == null ) throw "No string matched";
|
|
|
- return { pos : result[untyped "index"], len : (result[0] : String).length };
|
|
|
+ return { pos : result.index, len : (result[0] : String).length };
|
|
|
}
|
|
|
|
|
|
public function matchSub( s : String, pos : Int, len : Int = -1):Bool {
|
|
@@ -62,14 +62,14 @@
|
|
|
result = r.exec(len < 0 ? s : s.substr(0, pos + len));
|
|
|
var b = result != null;
|
|
|
if (b) {
|
|
|
- untyped result.input = s;
|
|
|
+ result.input = s;
|
|
|
}
|
|
|
b;
|
|
|
} else {
|
|
|
var b = match( len < 0 ? s.substr(pos) : s.substr(pos,len) );
|
|
|
if (b) {
|
|
|
- untyped result.input = s;
|
|
|
- untyped result["index"] += pos;
|
|
|
+ result.input = s;
|
|
|
+ result.index += pos;
|
|
|
}
|
|
|
b;
|
|
|
}
|
|
@@ -78,12 +78,12 @@
|
|
|
public function split( s : String ) : Array<String> {
|
|
|
// we can't use directly s.split because it's ignoring the 'g' flag
|
|
|
var d = "#__delim__#";
|
|
|
- var s : String = untyped s.replace(r, d);
|
|
|
+ var s : String = (cast s).replace(r, d);
|
|
|
return s.split(d);
|
|
|
}
|
|
|
|
|
|
public function replace( s : String, by : String ) : String {
|
|
|
- return untyped s.replace(r,by);
|
|
|
+ return (cast s).replace(r,by);
|
|
|
}
|
|
|
|
|
|
public function map( s : String, f : EReg -> String ) : String {
|