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 ScriptableObject
ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intprivate static final intprivate intprivate static final longprivate intprivate intFields inherited from class ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface 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 intMap name to id of instance property.intgetArity()private static RegExpImplgetImpl()protected StringgetInstanceIdName(int id) Map id back to property name it defines.protected ObjectgetInstanceIdValue(int id) Get id value.intprotected intGet maximum id findInstanceIdInfo can generate.protected voidsetInstanceIdAttributes(int id, int attr) Update the attributes of the given instance property.protected voidsetInstanceIdValue(int id, Object value) Set or delete id value.Methods inherited from class BaseFunction
createObject, execIdCall, fillConstructorProperties, findPrototypeId, getClassName, getClassPrototype, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, initPrototypeId, isGeneratorFunction, setImmunePrototypeProperty, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototypeMethods inherited from class 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, setAttributesMethods inherited from class 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, sizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
getFunctionNamein classBaseFunction
-
getLength
public int getLength()- Overrides:
getLengthin classBaseFunction
-
getArity
public int getArity()- Overrides:
getArityin classBaseFunction
-
call
Description copied from class:BaseFunctionShould be overridden.- Specified by:
callin interfaceCallable- Specified by:
callin interfaceFunction- Overrides:
callin 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 JavaScriptthisobjectargs- the array of arguments- Returns:
- the result of the call
-
construct
Description copied from interface:FunctionCall the function as a constructor.This method is invoked by the runtime in order to satisfy a use of the JavaScript
newoperator. This method is expected to create a new object and return it.- Specified by:
constructin interfaceConstructable- Specified by:
constructin interfaceFunction- Overrides:
constructin 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:IdScriptableObjectGet maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceIdin classBaseFunction
-
findInstanceIdInfo
Description copied from class:IdScriptableObjectMap name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int).- Overrides:
findInstanceIdInfoin classBaseFunction
-
getInstanceIdName
Description copied from class:IdScriptableObjectMap id back to property name it defines.- Overrides:
getInstanceIdNamein classBaseFunction
-
getInstanceIdValue
Description copied from class:IdScriptableObjectGet 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:
getInstanceIdValuein classBaseFunction
-
setInstanceIdValue
Description copied from class:IdScriptableObjectSet or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.- Overrides:
setInstanceIdValuein classBaseFunction
-
setInstanceIdAttributes
protected void setInstanceIdAttributes(int id, int attr) Description copied from class:IdScriptableObjectUpdate 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:
setInstanceIdAttributesin classBaseFunction- Parameters:
id- the instance property idattr- the new attribute bitset
-