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 (skInterpreter *owner)
 Constructor for implementation class.

 ~P_Interpreter ()
 Destructor for implementation class.

skRValue evaluate (skStackFrame &frame, skExprNode *n)
 this method evaluates an arbitrary Simkin expression

skRValue evalMethod (skStackFrame &frame, skIdListNode *ids)
 this method evaluates the given method

void makeMethodCall (skStackFrame &frame, skRValue &robject, const skString &method_name, skExprNode *array_index, const skString &attribute, skExprListNode *exprs, skRValue &ret)
 this method actually executes a method

void executeAssignStat (skStackFrame &frame, skAssignNode *n)
 This method executes an assignment statement.

bool executeStat (skStackFrame &frame, skStatNode *pstat, skRValue &r)
 This method executes a statement.

bool executeStats (skStackFrame &frame, skStatListNode *n, skRValue &r)
 This method executes a list of statements.

bool executeReturnStat (skStackFrame &frame, skReturnNode *n, skRValue &r)
 This method executes a return statement.

bool executeIfStat (skStackFrame &frame, skIfNode *n, skRValue &r)
 This method executes an if statement.

bool executeWhileStat (skStackFrame &frame, skWhileNode *n, skRValue &r)
 This method executes a while statement.

bool executeSwitchStat (skStackFrame &frame, skSwitchNode *n, skRValue &r)
 This method executes a switch statement.

bool executeForEachStat (skStackFrame &frame, skForEachNode *n, skRValue &r)
 This method executes a foreach statement.

bool executeForStat (skStackFrame &frame, skForNode *n, skRValue &r)
 This method executes a for statement.

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

skString checkIndirectId (skStackFrame &frame, const skString &name)
 This method checks whether a field name includes the indirection character.

skRValue findValue (skStackFrame &frame, const skString &name, skExprNode *array_index, const skString &attribute)
 This method finds a value associated with a given name.

void runtimeError (skStackFrame &frame, const skString &s)
 This method reports a runtime error by throwing a skRuntimeException.

void followIdList (skStackFrame &frame, skIdListNode *idList, skRValue &object)
 This method follows a dotted list of id's to retrieve the associated value.

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

bool extractFieldArrayValue (skStackFrame &frame, 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.

bool extractArrayValue (skStackFrame &frame, 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.

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

bool insertArrayValue (skStackFrame &frame, skRValue &robject, skExprNode *array_index, const skString &attr, const skRValue &value)
 This method is a wrapper around calling the setValueAt method.

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


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.


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 skStackFrame   frame,
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 skStackFrame   frame,
skIdListNode *    ids
 

this method evaluates the given method

Parameters:
frame - the current stack frame
ids - the parse tree giving the method name

skRValue P_Interpreter::evaluate skStackFrame   frame,
skExprNode *    n
 

this method evaluates an arbitrary Simkin expression

Parameters:
frame - the current stack frame
n - the expression parse tree

void P_Interpreter::executeAssignStat skStackFrame   frame,
skAssignNode *    n
 

This method executes an assignment statement.

Parameters:
frame - the current stack frame
n - the assignment statement parse tree

bool P_Interpreter::executeForEachStat skStackFrame   frame,
skForEachNode *    n,
skRValue   r
 

This method executes a foreach statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skForNode *    n,
skRValue   r
 

This method executes a for statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skIfNode *    n,
skRValue   r
 

This method executes an if statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skReturnNode *    n,
skRValue   r
 

This method executes a return statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skStatNode *    pstat,
skRValue   r
 

This method executes a statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skStatListNode *    n,
skRValue   r
 

This method executes a list of statements.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skSwitchNode *    n,
skRValue   r
 

This method executes a switch statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skWhileNode *    n,
skRValue   r
 

This method executes a while statement.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
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:
frame - the current stack frame
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 skStackFrame   frame,
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:
frame - the current stack frame
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 skStackFrame   frame,
skRValue   robject,
const skString   name,
const skString   attrib,
skRValue   ret
 

This method extracts an instance variable with the given name.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
const skString   name,
skExprNode *    array_index,
const skString   attribute
 

This method finds a value associated with a given name.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
skIdListNode *    idList,
skRValue   object
 

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

Parameters:
frame - the current stack frame
idlist - the list of ids in the dotted name
object - this object receives the value corresponding to the id list

bool P_Interpreter::insertArrayValue skStackFrame   frame,
skRValue   robject,
skExprNode *    array_index,
const skString   attr,
const skRValue   value
 

This method is a wrapper around calling the setValueAt method.

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
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 skStackFrame   frame,
skRValue   robject,
const skString   method_name,
skExprNode *    array_index,
const skString   attribute,
skExprListNode *    exprs,
skRValue   ret
 

this method actually executes a method

Parameters:
frame - the current stack frame
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 skStackFrame   frame,
const skString   s
 

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   s [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 Thu Jan 23 15:25:39 2003 for Simkin by doxygen1.3-rc1