Class NativeRegExpCtor
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.IdScriptableObject
-
- org.htmlunit.corejs.javascript.BaseFunction
-
- org.htmlunit.corejs.javascript.regexp.NativeRegExpCtor
-
- All Implemented Interfaces:
java.io.Serializable
,Callable
,ConstProperties
,Constructable
,DebuggableObject
,Function
,IdFunctionCall
,Scriptable
,SymbolScriptable
class NativeRegExpCtor extends BaseFunction
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.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static int
DOLLAR_ID_BASE
private static int
Id_AMPERSAND
private static int
Id_BACK_QUOTE
private static int
Id_DOLLAR_1
private static int
Id_DOLLAR_2
private static int
Id_DOLLAR_3
private static int
Id_DOLLAR_4
private static int
Id_DOLLAR_5
private static int
Id_DOLLAR_6
private static int
Id_DOLLAR_7
private static int
Id_DOLLAR_8
private static int
Id_DOLLAR_9
private static int
Id_input
private static int
Id_lastMatch
private static int
Id_lastParen
private static int
Id_leftContext
private static int
Id_multiline
private static int
Id_PLUS
private static int
Id_QUOTE
private static int
Id_rightContext
private static int
Id_STAR
private static int
Id_UNDERSCORE
private int
inputAttr
private static int
MAX_INSTANCE_ID
private int
multilineAttr
private static long
serialVersionUID
private int
starAttr
private int
underscoreAttr
-
Fields inherited from class org.htmlunit.corejs.javascript.BaseFunction
Id_arguments, Id_arity, Id_length, Id_name, Id_prototype
-
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Constructor Description NativeRegExpCtor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Should be overridden.Scriptable
construct(Context cx, Scriptable scope, java.lang.Object[] args)
Call the function as a constructor.protected int
findInstanceIdInfo(java.lang.String s)
Map name to id of instance property.int
getArity()
java.lang.String
getFunctionName()
private static RegExpImpl
getImpl()
protected java.lang.String
getInstanceIdName(int id)
Map id back to property name it defines.protected java.lang.Object
getInstanceIdValue(int id)
Get id value.int
getLength()
protected int
getMaxInstanceId()
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, java.lang.Object value)
Set or delete id value.-
Methods inherited from class org.htmlunit.corejs.javascript.BaseFunction
createObject, execIdCall, fillConstructorProperties, findPrototypeId, getClassName, getClassPrototype, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, initPrototypeId, isGeneratorFunction, setImmunePrototypeProperty, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototype
-
Methods inherited from class org.htmlunit.corejs.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.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, 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.htmlunit.corejs.javascript.Scriptable
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
Id_multiline
private static final int Id_multiline
- See Also:
- Constant Field Values
-
Id_STAR
private static final int Id_STAR
- See Also:
- Constant Field Values
-
Id_input
private static final int Id_input
- See Also:
- Constant Field Values
-
Id_UNDERSCORE
private static final int Id_UNDERSCORE
- See Also:
- Constant Field Values
-
Id_lastMatch
private static final int Id_lastMatch
- See Also:
- Constant Field Values
-
Id_AMPERSAND
private static final int Id_AMPERSAND
- See Also:
- Constant Field Values
-
Id_lastParen
private static final int Id_lastParen
- See Also:
- Constant Field Values
-
Id_PLUS
private static final int Id_PLUS
- See Also:
- Constant Field Values
-
Id_leftContext
private static final int Id_leftContext
- See Also:
- Constant Field Values
-
Id_BACK_QUOTE
private static final int Id_BACK_QUOTE
- See Also:
- Constant Field Values
-
Id_rightContext
private static final int Id_rightContext
- See Also:
- Constant Field Values
-
Id_QUOTE
private static final int Id_QUOTE
- See Also:
- Constant Field Values
-
DOLLAR_ID_BASE
private static final int DOLLAR_ID_BASE
- See Also:
- Constant Field Values
-
Id_DOLLAR_1
private static final int Id_DOLLAR_1
- See Also:
- Constant Field Values
-
Id_DOLLAR_2
private static final int Id_DOLLAR_2
- See Also:
- Constant Field Values
-
Id_DOLLAR_3
private static final int Id_DOLLAR_3
- See Also:
- Constant Field Values
-
Id_DOLLAR_4
private static final int Id_DOLLAR_4
- See Also:
- Constant Field Values
-
Id_DOLLAR_5
private static final int Id_DOLLAR_5
- See Also:
- Constant Field Values
-
Id_DOLLAR_6
private static final int Id_DOLLAR_6
- See Also:
- Constant Field Values
-
Id_DOLLAR_7
private static final int Id_DOLLAR_7
- See Also:
- Constant Field Values
-
Id_DOLLAR_8
private static final int Id_DOLLAR_8
- See Also:
- Constant Field Values
-
Id_DOLLAR_9
private static final int Id_DOLLAR_9
- See Also:
- Constant Field Values
-
MAX_INSTANCE_ID
private static final int MAX_INSTANCE_ID
- See Also:
- Constant Field Values
-
multilineAttr
private int multilineAttr
-
starAttr
private int starAttr
-
inputAttr
private int inputAttr
-
underscoreAttr
private int underscoreAttr
-
-
Method Detail
-
getFunctionName
public java.lang.String getFunctionName()
- Overrides:
getFunctionName
in classBaseFunction
-
getLength
public int getLength()
- Overrides:
getLength
in classBaseFunction
-
getArity
public int getArity()
- Overrides:
getArity
in classBaseFunction
-
call
public java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
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
public Scriptable construct(Context cx, Scriptable scope, java.lang.Object[] args)
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
private static RegExpImpl getImpl()
-
getMaxInstanceId
protected int getMaxInstanceId()
Description copied from class:IdScriptableObject
Get maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceId
in classBaseFunction
-
findInstanceIdInfo
protected int findInstanceIdInfo(java.lang.String s)
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
protected java.lang.String getInstanceIdName(int id)
Description copied from class:IdScriptableObject
Map id back to property name it defines.- Overrides:
getInstanceIdName
in classBaseFunction
-
getInstanceIdValue
protected java.lang.Object getInstanceIdValue(int id)
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
protected void setInstanceIdValue(int id, java.lang.Object value)
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
-
-