Package org.mozilla.javascript.regexp
Class NativeRegExpCtor
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.IdScriptableObject
org.mozilla.javascript.BaseFunction
org.mozilla.javascript.regexp.NativeRegExpCtor
- All Implemented Interfaces:
Serializable
,Callable
,ConstProperties
,Constructable
,DebuggableObject
,Function
,IdFunctionCall
,Scriptable
,SymbolScriptable
This class implements the RegExp constructor 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.11
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private int
private static final int
private int
private static final long
private int
private int
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall
(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Should be overridden.construct
(Context cx, Scriptable scope, Object[] args) Call the function as a constructor.protected int
Map name to id of instance property.int
getArity()
private static RegExpImpl
getImpl()
protected String
getInstanceIdName
(int id) Map id back to property name it defines.protected Object
getInstanceIdValue
(int id) Get id value.int
protected int
Get maximum id findInstanceIdInfo can generate.protected void
setInstanceIdAttributes
(int id, int attr) Update the attributes of the given instance property.protected void
setInstanceIdValue
(int id, Object value) Set or delete id value.Methods inherited from class org.mozilla.javascript.BaseFunction
createObject, execIdCall, fillConstructorProperties, findPrototypeId, getClassName, getClassPrototype, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, initPrototypeId, isGeneratorFunction, setImmunePrototypeProperty, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototype
Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes
Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.mozilla.javascript.Scriptable
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
Id_multiline
private static final int Id_multiline- See Also:
-
Id_STAR
private static final int Id_STAR- See Also:
-
Id_input
private static final int Id_input- See Also:
-
Id_UNDERSCORE
private static final int Id_UNDERSCORE- See Also:
-
Id_lastMatch
private static final int Id_lastMatch- See Also:
-
Id_AMPERSAND
private static final int Id_AMPERSAND- See Also:
-
Id_lastParen
private static final int Id_lastParen- See Also:
-
Id_PLUS
private static final int Id_PLUS- See Also:
-
Id_leftContext
private static final int Id_leftContext- See Also:
-
Id_BACK_QUOTE
private static final int Id_BACK_QUOTE- See Also:
-
Id_rightContext
private static final int Id_rightContext- See Also:
-
Id_QUOTE
private static final int Id_QUOTE- See Also:
-
DOLLAR_ID_BASE
private static final int DOLLAR_ID_BASE- See Also:
-
Id_DOLLAR_1
private static final int Id_DOLLAR_1- See Also:
-
Id_DOLLAR_2
private static final int Id_DOLLAR_2- See Also:
-
Id_DOLLAR_3
private static final int Id_DOLLAR_3- See Also:
-
Id_DOLLAR_4
private static final int Id_DOLLAR_4- See Also:
-
Id_DOLLAR_5
private static final int Id_DOLLAR_5- See Also:
-
Id_DOLLAR_6
private static final int Id_DOLLAR_6- See Also:
-
Id_DOLLAR_7
private static final int Id_DOLLAR_7- See Also:
-
Id_DOLLAR_8
private static final int Id_DOLLAR_8- See Also:
-
Id_DOLLAR_9
private static final int Id_DOLLAR_9- See Also:
-
MAX_INSTANCE_ID
private static final int MAX_INSTANCE_ID- See Also:
-
multilineAttr
private int multilineAttr -
starAttr
private int starAttr -
inputAttr
private int inputAttr -
underscoreAttr
private int underscoreAttr
-
-
Constructor Details
-
NativeRegExpCtor
NativeRegExpCtor()
-
-
Method Details
-
getFunctionName
- Overrides:
getFunctionName
in classBaseFunction
-
getLength
public int getLength()- Overrides:
getLength
in classBaseFunction
-
getArity
public int getArity()- Overrides:
getArity
in classBaseFunction
-
call
Description copied from class:BaseFunction
Should be overridden.- Specified by:
call
in interfaceCallable
- Specified by:
call
in interfaceFunction
- Overrides:
call
in classBaseFunction
- Parameters:
cx
- the current Context for this threadscope
- the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.thisObj
- the JavaScriptthis
objectargs
- the array of arguments- Returns:
- the result of the call
-
construct
Description copied from interface:Function
Call the function as a constructor.This method is invoked by the runtime in order to satisfy a use of the JavaScript
new
operator. This method is expected to create a new object and return it.- Specified by:
construct
in interfaceConstructable
- Specified by:
construct
in interfaceFunction
- Overrides:
construct
in classBaseFunction
- Parameters:
cx
- the current Context for this threadscope
- an enclosing scope of the caller except when the function is called from a closure.args
- the array of arguments- Returns:
- the allocated object
-
getImpl
-
getMaxInstanceId
protected int getMaxInstanceId()Description copied from class:IdScriptableObject
Get maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceId
in classBaseFunction
-
findInstanceIdInfo
Description copied from class:IdScriptableObject
Map name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int)
.- Overrides:
findInstanceIdInfo
in classBaseFunction
-
getInstanceIdName
Description copied from class:IdScriptableObject
Map id back to property name it defines.- Overrides:
getInstanceIdName
in classBaseFunction
-
getInstanceIdValue
Description copied from class:IdScriptableObject
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 classBaseFunction
-
setInstanceIdValue
Description copied from class:IdScriptableObject
Set or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.- Overrides:
setInstanceIdValue
in classBaseFunction
-
setInstanceIdAttributes
protected void setInstanceIdAttributes(int id, int attr) Description copied from class:IdScriptableObject
Update the attributes of the given instance property. Classes which want to support changing property attributes via Object.defineProperty must override this method. The default implementation throws InternalError.- Overrides:
setInstanceIdAttributes
in classBaseFunction
- Parameters:
id
- the instance property idattr
- the new attribute bitset
-