class Interpreter

Interpreter objects can be used to evaluate ECMAScript code. More...

Full nameKJS::Interpreter
Definition#include </opt/kde3/include/kjs/interpreter.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

Interpreter objects can be used to evaluate ECMAScript code. Each interpreter has a global object which is used for the purposes of code evaluation, and also provides access to built-in properties such as " Object" and "Number".

 Interpreter (const Object &global)

Interpreter

Creates a new interpreter. The supplied object will be used as the global object for all scripts executed with this interpreter. During constuction, all the standard properties such as "Object" and "Number" will be added to the global object.

Note: You should not use the same global object for multiple interpreters.

This is due do the fact that the built-in properties are set in the constructor, and if these objects have been modified from another interpreter (e.g. a script modifying String.prototype), the changes will be overridden.

Parameters:
globalThe object to use as the global object for this interpreter

 Interpreter ()

Interpreter

Creates a new interpreter. A global object will be created and initialized with the standard global properties.

 ~Interpreter ()

~Interpreter

Object  globalObject ()

globalObject

[const]

Returns the object that is used as the global object during all script execution performed by this interpreter

ExecState * globalExec ()

globalExec

Returns the execution state object which can be used to execute scripts using this interpreter at a the "global" level, i.e. one with a execution context that has the global object as the "this" value, and who's scope chain contains only the global object.

Note: this pointer remains constant for the life of the interpreter and should not be manually deleted.

Returns: The interpreter global execution state object

bool  checkSyntax (const UString &code)

checkSyntax

Parses the supplied ECMAScript code and checks for syntax errors.

Parameters:
codeThe code to check

Returns: true if there were no syntax errors in the code, otherwise false

Completion  evaluate (const UString &code, const Value &thisV = Value())

evaluate

Evaluates the supplied ECMAScript code.

Since this method returns a Completion, you should check the type of completion to detect an error or before attempting to access the returned value. For example, if an error occurs during script execution and is not caught by the script, the completion type will be Throw.

If the supplied code is invalid, a SyntaxError will be thrown.

Parameters:
codeThe code to evaluate
thisVThe value to pass in as the "this" value for the script execution. This should either be Null() or an Object.

Returns: A completion object representing the result of the execution.

InterpreterImp * imp ()

imp

Returns the implementation object associated with this interpreter. Only useful for internal KJS operations.

Object  builtinObject ()

builtinObject

[const]

Returns the builtin "Object" object. This is the object that was set as a property of the global object during construction; if the property is replaced by script code, this method will still return the original object.

Returns: The builtin "Object" object

Object  builtinFunction ()

builtinFunction

[const]

Object  builtinArray ()

builtinArray

[const]

Object  builtinBoolean ()

builtinBoolean

[const]

Object  builtinString ()

builtinString

[const]

Object  builtinNumber ()

builtinNumber

[const]

Object  builtinDate ()

builtinDate

[const]

Object  builtinRegExp ()

builtinRegExp

[const]

Object  builtinError ()

builtinError

[const]

Object  builtinObjectPrototype ()

builtinObjectPrototype

[const]

Object  builtinFunctionPrototype ()

builtinFunctionPrototype

[const]

Object  builtinArrayPrototype ()

builtinArrayPrototype

[const]

Object  builtinBooleanPrototype ()

builtinBooleanPrototype

[const]

Object  builtinStringPrototype ()

builtinStringPrototype

[const]

Object  builtinNumberPrototype ()

builtinNumberPrototype

[const]

Object  builtinDatePrototype ()

builtinDatePrototype

[const]

Object  builtinRegExpPrototype ()

builtinRegExpPrototype

[const]

Object  builtinErrorPrototype ()

builtinErrorPrototype

[const]

Object  builtinEvalError ()

builtinEvalError

[const]

Object  builtinRangeError ()

builtinRangeError

[const]

Object  builtinReferenceError ()

builtinReferenceError

[const]

Object  builtinSyntaxError ()

builtinSyntaxError

[const]

Object  builtinTypeError ()

builtinTypeError

[const]

Object  builtinURIError ()

builtinURIError

[const]

Object  builtinEvalErrorPrototype ()

builtinEvalErrorPrototype

[const]

Object  builtinRangeErrorPrototype ()

builtinRangeErrorPrototype

[const]

Object  builtinReferenceErrorPrototype ()

builtinReferenceErrorPrototype

[const]

Object  builtinSyntaxErrorPrototype ()

builtinSyntaxErrorPrototype

[const]

Object  builtinTypeErrorPrototype ()

builtinTypeErrorPrototype

[const]

Object  builtinURIErrorPrototype ()

builtinURIErrorPrototype

[const]

void  finalCheck ()

finalCheck

[static]


Generated by: rich on pegasus on Wed Nov 14 23:15:50 2001, using kdoc 2.0a53.