org.mozilla.javascript.regexp.NativeRegExpInstantiator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhino-runtime Show documentation
Show all versions of rhino-runtime Show documentation
Rhino JavaScript runtime jar, excludes tools & JSR-223 Script Engine wrapper.
The newest version!
package org.mozilla.javascript.regexp;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
public class NativeRegExpInstantiator {
private NativeRegExpInstantiator() {}
static NativeRegExp withLanguageVersion(int languageVersion) {
if (languageVersion < Context.VERSION_ES6) {
return new NativeRegExpCallable();
} else {
return new NativeRegExp();
}
}
static NativeRegExp withLanguageVersionScopeCompiled(
int languageVersion, Scriptable scope, RECompiled compiled) {
if (languageVersion < Context.VERSION_ES6) {
return new NativeRegExpCallable(scope, compiled);
} else {
return new NativeRegExp(scope, compiled);
}
}
}