}
}
- public JS callMethod(JS method_, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
- if(!JS.isString(method_)) return super.callMethod(method_, a0, a1, a2, rest, nargs);
- String method = JS.toString(method_);
+ public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
switch(nargs) {
case 1: {
- //#switch(method)
+ //#jswitch(method)
case "exec": {
String s = JS.toString(a0);
int start = global ? lastIndex : 0;
break;
}
case 2: {
- //#switch(method)
+ //#jswitch(method)
case "stringReplace": return stringReplace(a0, a1,a2);
//#end
break;
}
}
- return super.callMethod(method_, a0, a1, a2, rest, nargs);
+ return super.callMethod(method, a0, a1, a2, rest, nargs);
}
- public JS get(JS key_) throws JSExn {
- if(!JS.isString(key_)) return super.get(key_);
- String key = JS.toString(key_);
- //#switch(key)
+ public JS get(JS key) throws JSExn {
+ //#jswitch(key)
case "exec": return METHOD;
case "test": return METHOD;
case "toString": return METHOD;
case "ignoreCase": return B(flags & RE.REG_ICASE);
case "multiline": return B(flags & RE.REG_MULTILINE);
//#end
- return super.get(key_);
+ return super.get(key);
}
public void put(JS key, JS value) throws JSExn {
return sb.toString();
}
- public static JS stringMatch(JS o, JS arg0) throws JSExn {
+ static JS stringMatch(JS o, JS arg0) throws JSExn {
String s = JS.toString(o);
RE re;
JSRegexp regexp = null;
return ret;
}
- public static JS stringSearch(JS o, JS arg0) throws JSExn {
+ static JS stringSearch(JS o, JS arg0) throws JSExn {
String s = JS.toString(o);
RE re = arg0 instanceof JSRegexp ? ((JSRegexp)arg0).re : newRE(JS.toString(arg0),0);
REMatch match = re.getMatch(s);
return match == null ? N(-1) : N(match.getStartIndex());
}
- public static JS stringReplace(JS o, JS arg0, JS arg1) throws JSExn {
+ static JS stringReplace(JS o, JS arg0, JS arg1) throws JSExn {
String s = JS.toString(o);
RE re;
JSFunction replaceFunc = null;
}
- public static JS stringSplit(JS s_, JS arg0, JS arg1, int nargs) throws JSExn {
+ static JS stringSplit(JS s_, JS arg0, JS arg1, int nargs) throws JSExn {
String s = JS.toString(s_);
int limit = nargs < 2 ? Integer.MAX_VALUE : JS.toInt(arg1);
if(limit < 0) limit = Integer.MAX_VALUE;
return ret;
}
- public static RE newRE(String pattern, int flags) throws JSExn {
+ private static RE newRE(String pattern, int flags) throws JSExn {
try {
return new RE(pattern,flags,RESyntax.RE_SYNTAX_PERL5);
} catch(REException e) {