Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

P_Interpreter Class Reference

Interpreter implementation class. More...

#include <skInterpreterp.h>

List of all members.

Public Methods

 P_Interpreter ()
 Constructor for implementation class.

 ~P_Interpreter ()
 Destructor for implementation class.

skRValue evaluate (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skExprNode *n)
 this method evaluates an arbitrary Simkin expression. More...

skRValue evalMethod (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skIdListNode *ids)
 this method evaluates the given method. More...

void makeMethodCall (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skRValue &robject, const skString &method_name, skExprNode *array_index, const skString &attribute, skExprListNode *exprs, skRValue &ret)
 this method actually executes a method. More...

void executeAssignStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skAssignNode *n)
 This method executes an assignment statement. More...

bool executeStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skStatNode *pstat, skRValue &r)
 This method executes a statement. More...

bool executeStats (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skStatListNode *n, skRValue &r)
 This method executes a list of statements. More...

bool executeReturnStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skReturnNode *n, skRValue &r)
 This method executes a return statement. More...

bool executeIfStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skIfNode *n, skRValue &r)
 This method executes an if statement. More...

bool executeWhileStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skWhileNode *n, skRValue &r)
 This method executes a while statement. More...

bool executeSwitchStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skSwitchNode *n, skRValue &r)
 This method executes a switch statement. More...

bool executeForEachStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skForEachNode *n, skRValue &r)
 This method executes a foreach statement. More...

bool executeForStat (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skForNode *n, skRValue &r)
 This method executes a for statement. More...

void addLocalVariable (skRValueTable &var, const skString &name, skRValue value)
 Adds a new local variable to the current list. More...

skString checkIndirectId (skContext &ctxt, skiExecutable *obj, skRValueTable &var, const skString &name)
 This method checks whether a field name includes the indirection character. More...

skRValue findValue (skContext &ctxt, skiExecutable *obj, skRValueTable &var, const skString &name, skExprNode *array_index, const skString &attribute)
 This method finds a value associated with a given name. More...

void runtimeError (skContext &ctxt, const skString &s)
 This method reports a runtime error by throwing a skRuntimeException. More...

void followIdList (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skIdListNode *idList, skRValue &object)
 This method follows a dotted list of id's to retrieve the associated value. More...

void trace (const skString &s)
 This method sends a message to the tracer output. More...

bool extractFieldArrayValue (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skRValue &robject, const skString &field_name, skExprNode *array_index, const skString &attrib, skRValue &ret)
 This method extracts a value of the form foo[1] - first dereferencing foo. More...

bool extractArrayValue (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skRValue &robject, skExprNode *array_index, const skString &attrib, skRValue &ret)
 This method extracts a value of the form robject[1] - assumes robject is already a collection object. More...

bool extractValue (skContext &ctxt, skRValue &robject, const skString &name, const skString &attrib, skRValue &ret)
 This method extracts an instance variable with the given name. More...

bool insertArrayValue (skContext &ctxt, skiExecutable *obj, skRValueTable &var, skRValue &robject, skExprNode *array_index, const skString &attr, const skRValue &value)
 This method is a wrapper around calling the setValueAt method. More...

bool insertValue (skContext &ctxt, skRValue &robject, const skString &name, const skString &attr, const skRValue &value)
 This method is a wrapper around calling the setValue method. More...


Public Attributes

skRValueTable m_GlobalVars
 this is the list of global variables.

bool m_Tracing
 this flag controls whether the interpreter outputs tracing information about the execution of statements.

skTraceCallbackm_TraceCallback
 This variable points to an associated object for capturing tracing output.

skStatementStepperm_StatementStepper
 This variable points to an associated object which receives information about which statements are being executed.


Static Public Attributes

THREAD skInterpreterg_GlobalInterpreter
 This variable holds a global instance of the interpreter.


Detailed Description

Interpreter implementation class.


Member Function Documentation

void P_Interpreter::addLocalVariable skRValueTable   var,
const skString   name,
skRValue    value
 

Adds a new local variable to the current list.

Parameters:
var  - the local variables
name  - the name of the variable
value  - the value of the variable

skString P_Interpreter::checkIndirectId skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
const skString   name
[inline]
 

This method checks whether a field name includes the indirection character.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
name  - the name being checked

skRValue P_Interpreter::evalMethod skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skIdListNode *    ids
 

this method evaluates the given method.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
ids  - the parse tree giving the method name

skRValue P_Interpreter::evaluate skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skExprNode *    n
 

this method evaluates an arbitrary Simkin expression.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the expression parse tree

void P_Interpreter::executeAssignStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skAssignNode *    n
 

This method executes an assignment statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the assignment statement parse tree

bool P_Interpreter::executeForEachStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skForEachNode *    n,
skRValue   r
 

This method executes a foreach statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the foreach statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeForStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skForNode *    n,
skRValue   r
 

This method executes a for statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the for statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeIfStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skIfNode *    n,
skRValue   r
 

This method executes an if statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the if statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeReturnStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skReturnNode *    n,
skRValue   r
 

This method executes a return statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the return statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skStatNode *    pstat,
skRValue   r
 

This method executes a statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
pstat  - the assignment statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeStats skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skStatListNode *    n,
skRValue   r
 

This method executes a list of statements.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the parse tree for the list of statements
r  - the value to receive the return value from the statements
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeSwitchStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skSwitchNode *    n,
skRValue   r
 

This method executes a switch statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the switch statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::executeWhileStat skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skWhileNode *    n,
skRValue   r
 

This method executes a while statement.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
n  - the while statement parse tree
r  - the value to receive the return value from the statement
Returns:
true to halt further processing (i.e. a return statement has been executed)

bool P_Interpreter::extractArrayValue skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skRValue   robject,
skExprNode *    array_index,
const skString   attrib,
skRValue   ret
 

This method extracts a value of the form robject[1] - assumes robject is already a collection object.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
robject  - the object owning the field name
array_index  - the parse tree for the array index (if any)
attrib  - the name of the attribute, if present
ret  - the value to receive the associated value

bool P_Interpreter::extractFieldArrayValue skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skRValue   robject,
const skString   field_name,
skExprNode *    array_index,
const skString   attrib,
skRValue   ret
 

This method extracts a value of the form foo[1] - first dereferencing foo.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
robject  - the object owning the field name
field_name  - the field name being accessed
array_index  - the parse tree for the array index (if any)
attrib  - the name of the attribute, if present
ret  - the value to receive the associated value

bool P_Interpreter::extractValue skContext   ctxt,
skRValue   obj,
const skString   name,
const skString   attrib,
skRValue   ret
 

This method extracts an instance variable with the given name.

Parameters:
ctxt  - the current source code context
robject  - the object owning the field name
name  - the field name being accessed
attrib  - the name of the attribute, if present
ret  - the value to receive the associated value

skRValue P_Interpreter::findValue skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
const skString   name,
skExprNode *    array_index,
const skString   attrib
 

This method finds a value associated with a given name.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
name  - the name being checked
array_index  - the parse tree for the array index (if any)
attribute  - the name of the attribute, if present
Returns:
the value associated with the name

void P_Interpreter::followIdList skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skIdListNode *    idList,
skRValue   object
 

This method follows a dotted list of id's to retrieve the associated value.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
var  - the local variables
idlist  - the list of ids in the dotted name
object  - this object receives the value corresponding to the id list

bool P_Interpreter::insertArrayValue skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skRValue   robject,
skExprNode *    array_index,
const skString   attr,
const skRValue   value
 

This method is a wrapper around calling the setValueAt method.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
robject  - the object owning the field name
array_index  - the parse tree for the array index (if any)
attr  - the name of the attribute, if present
value  - the value to be set

bool P_Interpreter::insertValue skContext   ctxt,
skRValue   robject,
const skString   name,
const skString   attr,
const skRValue   value
 

This method is a wrapper around calling the setValue method.

Parameters:
ctxt  - the current source code context
robject  - the object owning the field name
name  - the field name being accessed
attr  - the name of the attribute, if present
value  - the value to be set

void P_Interpreter::makeMethodCall skContext   ctxt,
skiExecutable   obj,
skRValueTable   var,
skRValue   robject,
const skString   method_name,
skExprNode *    array_index,
const skString   attribute,
skExprListNode *    exprs,
skRValue   ret
 

this method actually executes a method.

Parameters:
ctxt  - the current source code context
obj  - the object owning the current method
robject  - the object that the method is to be called on
method_name  - the name of the method
array_index  - the parse tree for the array index (if any)
attribute  - the name of the attribute, if present
exprs  - the method parameters
ret  - the value to receive the return value from the method

void P_Interpreter::runtimeError skContext   ctxt,
const skString   msg
 

This method reports a runtime error by throwing a skRuntimeException.

Parameters:
ctxt  - the current source code context
s  - a message describing the error

void P_Interpreter::trace const skString   msg [inline]
 

This method sends a message to the tracer output.

Parameters:
s  - the message to sent to the tracer output


The documentation for this class was generated from the following files:
Generated on Tue Nov 20 17:56:21 2001 for Simkin by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001