org.mozilla.javascript.regexp
Class NativeRegExp
java.lang.Object
|
+--org.mozilla.javascript.ScriptableObject
|
+--org.mozilla.javascript.IdScriptable
|
+--org.mozilla.javascript.regexp.NativeRegExp
- All Implemented Interfaces:
- Function, IdFunctionMaster, Scriptable, java.io.Serializable
- public class NativeRegExp
- extends IdScriptable
- 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
- Author:
- Brendan Eich, Norris Boyd
- See Also:
- Serialized Form
Method Summary |
java.lang.Object |
call(Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.Object[] args)
Call the function.
|
Scriptable |
construct(Context cx,
Scriptable scope,
java.lang.Object[] args)
Call the function as a constructor.
|
java.lang.Object |
execMethod(int methodId,
IdFunction f,
Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.Object[] args)
'thisObj' will be null if invoked as constructor, in which case
instance of Scriptable should be returned. |
java.lang.String |
getClassName()
Get the name of the set of objects implemented by this Java class.
|
byte |
getFlags()
|
static void |
init(Context cx,
Scriptable scope,
boolean sealed)
|
void |
init(Context cx,
Scriptable scope,
java.lang.String source,
java.lang.String global,
boolean flat)
|
static boolean |
isDigit(char c)
|
int |
methodArity(int methodId)
Get arity or defined argument count for method with given id.
|
java.lang.String |
toString()
|
Methods inherited from class org.mozilla.javascript.ScriptableObject |
callMethod, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, get, getAllIds, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, has, hasInstance, hasProperty, hasProperty, isSealed, put, putProperty, putProperty, sealObject, setAttributes, setParentScope, setPrototype |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mozilla.javascript.Scriptable |
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype |
GLOB
public static final int GLOB
FOLD
public static final int FOLD
MULTILINE
public static final int MULTILINE
TEST
public static final int TEST
MATCH
public static final int MATCH
PREFIX
public static final int PREFIX
NativeRegExp
public NativeRegExp(Context cx,
Scriptable scope,
java.lang.String source,
java.lang.String global,
boolean flat)
NativeRegExp
public NativeRegExp()
init
public static void init(Context cx,
Scriptable scope,
boolean sealed)
init
public void init(Context cx,
Scriptable scope,
java.lang.String source,
java.lang.String global,
boolean flat)
getClassName
public java.lang.String getClassName()
- Description copied from interface:
Scriptable
- Get the name of the set of objects implemented by this Java class.
This corresponds to the [[Class]] operation in ECMA and is used
by Object.prototype.toString() in ECMA.
See ECMA 8.6.2 and 15.2.4.2.
- Specified by:
getClassName
in interface Scriptable
- Overrides:
getClassName
in class ScriptableObject
call
public java.lang.Object call(Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.Object[] args)
- Description copied from interface:
Function
- Call the function.
Note that the array of arguments is not guaranteed to have
length greater than 0.
- Specified by:
call
in interface Function
- Following copied from interface:
org.mozilla.javascript.Function
- 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 JavaScript this
objectargs
- the array of arguments- Returns:
- the result of the call
- Throws:
JavaScriptException
- if an uncaught exception
occurred while executing the function
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 interface Function
- Following copied from interface:
org.mozilla.javascript.Function
- 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
- Throws:
JavaScriptException
- if an uncaught exception
occurred while executing the constructor
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
isDigit
public static boolean isDigit(char c)
getFlags
public byte getFlags()
methodArity
public int methodArity(int methodId)
- Description copied from class:
IdScriptable
- Get arity or defined argument count for method with given id.
Should return -1 if methodId is not known or can not be used
with execMethod call.
- Overrides:
methodArity
in class IdScriptable
execMethod
public java.lang.Object execMethod(int methodId,
IdFunction f,
Context cx,
Scriptable scope,
Scriptable thisObj,
java.lang.Object[] args)
throws JavaScriptException
- Description copied from class:
IdScriptable
- 'thisObj' will be null if invoked as constructor, in which case
instance of Scriptable should be returned.
- Overrides:
execMethod
in class IdScriptable