org.mozilla.javascript.regexp

Class NativeRegExp

Implemented Interfaces:
Callable, ConstProperties, DebuggableObject, Function, IdFunctionCall, Scriptable, Serializable

public class NativeRegExp
extends IdScriptableObject
implements Function

This class implements the RegExp native object. Revision History: Implementation in C by Brendan Eich Initial port to Java by Norris Boyd from jsregexp.c version 1.36 Merged up to version 1.38, which included Unicode support. Merged bug fixes in version 1.39. Merged JSFUN13_BRANCH changes up to 1.32.2.13
Authors:
Brendan Eich
Norris Boyd

Field Summary

static int
JSREG_FOLD
static int
JSREG_GLOB
static int
JSREG_MULTILINE
static int
MATCH
static int
PREFIX
static int
TEST

Fields inherited from class org.mozilla.javascript.ScriptableObject

CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

Fields inherited from interface org.mozilla.javascript.Scriptable

NOT_FOUND

Method Summary

Object
call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Scriptable
construct(Context cx, Scriptable scope, Object[] args)
Object
execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
protected int
findInstanceIdInfo(String s)
Map name to id of instance property.
protected int
findPrototypeId(String s)
String
getClassName()
protected String
getInstanceIdName(int id)
Map id back to property name it defines.
protected Object
getInstanceIdValue(int id)
Get id value.
protected int
getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate.
static void
init(Context cx, Scriptable scope, boolean sealed)
protected void
initPrototypeId(int id)
protected void
setInstanceIdValue(int id, Object value)
Set or delete id value.
String
toString()

Methods inherited from class org.mozilla.javascript.IdScriptableObject

activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultPut, delete, execIdCall, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, get, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, has, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeId, initPrototypeMethod, initPrototypeValue, instanceIdInfo, put, setAttributes, setInstanceIdValue

Methods inherited from class org.mozilla.javascript.ScriptableObject

associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype

Field Details

JSREG_FOLD

public static final int JSREG_FOLD
Field Value:
2

JSREG_GLOB

public static final int JSREG_GLOB
Field Value:
1

JSREG_MULTILINE

public static final int JSREG_MULTILINE
Field Value:
4

MATCH

public static final int MATCH
Field Value:
1

PREFIX

public static final int PREFIX
Field Value:
2

TEST

public static final int TEST
Field Value:
0

Method Details

call

public Object call(Context cx,
                   Scriptable scope,
                   Scriptable thisObj,
                   Object[] args)
Specified by:
call in interface Function
call in interface Callable

construct

public Scriptable construct(Context cx,
                            Scriptable scope,
                            Object[] args)
Specified by:
construct in interface Function

execIdCall

public Object execIdCall(IdFunctionObject f,
                         Context cx,
                         Scriptable scope,
                         Scriptable thisObj,
                         Object[] args)
'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
Specified by:
execIdCall in interface IdFunctionCall
Overrides:
execIdCall in interface IdScriptableObject

findInstanceIdInfo

protected int findInstanceIdInfo(String s)
Overrides:
findInstanceIdInfo in interface IdScriptableObject

findPrototypeId

protected int findPrototypeId(String s)
Overrides:
findPrototypeId in interface IdScriptableObject

getClassName

public String getClassName()
Specified by:
getClassName in interface Scriptable
Overrides:
getClassName in interface ScriptableObject

getInstanceIdName

protected String getInstanceIdName(int id)
Map id back to property name it defines.
Overrides:
getInstanceIdName in interface IdScriptableObject

getInstanceIdValue

protected Object getInstanceIdValue(int id)
Get id value. If id value is constant, descendant can call cacheIdValue to store value in the permanent cache. Default implementation creates IdFunctionObject instance for given id and cache its value
Overrides:
getInstanceIdValue in interface IdScriptableObject

getMaxInstanceId

protected int getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate.
Overrides:
getMaxInstanceId in interface IdScriptableObject

init

public static void init(Context cx,
                        Scriptable scope,
                        boolean sealed)

initPrototypeId

protected void initPrototypeId(int id)
Overrides:
initPrototypeId in interface IdScriptableObject

setInstanceIdValue

protected void setInstanceIdValue(int id,
                                  Object value)
Set or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.
Overrides:
setInstanceIdValue in interface IdScriptableObject

toString

public String toString()