CmdFactory Class Reference

#include <cmd.h>

Collaboration diagram for CmdFactory:

Collaboration graph
[legend]

List of all members.


Detailed Description

Factory for virtual machine related commands.
Note:
design pattern factory

Definition at line 30 of file cmd.h.


Public Types

typedef Value::VType VType
 using Value::VType for type specification

Public Member Functions

 CmdFactory (Vm *vm)
 
Parameters:
vm Initialized virtual machine object to create commands for.

 ~CmdFactory ()
PCmd createAssign (Token, FncDefinition *, VType &dstType)
 assignment
PCmd createIf (Token, PCmd ifCmd, PCmd elseCmd)
 if statement
PCmd createWhile (Token, PCmd whileExpr, PCmd whileStat)
 while statement
PCmd createPush (Token, FncDefinition *, VType &dstType)
 read value (and push to stack)
PCmd createUnary (Token)
 unary operator
PCmd createBinary (Token, VType t1, VType t2, VType &dstType)
 binary operator
PCmd createCall (Token, unsigned nArgs, bool pushResult)
 function call
PCmd createPrint (Token, EToken valType, VType &srcType)
 print() function
PCmd createInput (Token, Value::VType type, bool pushResult)
 intput{int|double|string}() function

Private Attributes

Privated

Classes

struct  Private

Member Typedef Documentation

typedef Value::VType VType

using Value::VType for type specification

Definition at line 32 of file cmd.h.


Constructor & Destructor Documentation

CmdFactory ( Vm vm  ) 

Parameters:
vm Initialized virtual machine object to create commands for.

Definition at line 284 of file cmd.cc.

~CmdFactory (  ) 

Definition at line 288 of file cmd.cc.

References d.


Member Function Documentation

PCmd createAssign ( Token  token,
FncDefinition fnc,
VType dstType 
)

assignment

Definition at line 292 of file cmd.cc.

References FncDeclaration::args, d, StreamDecorator::E_ERROR, ETOKEN_ID, Vm::fileName, Vm::glVars, Var::name, FncDeclaration::self, Token::text, Value::type, Token::type, Value::V_NULL, Var::value, FncDefinition::vars, and CmdFactory::Private::vm.

Referenced by Builder::assign().

Here is the caller graph for this function:

PCmd createIf ( Token  token,
PCmd  ifCmd,
PCmd  elseCmd 
)

if statement

Definition at line 398 of file cmd.cc.

Referenced by Builder::ifLeave().

Here is the caller graph for this function:

PCmd createWhile ( Token  token,
PCmd  whileExpr,
PCmd  whileStat 
)

while statement

Definition at line 402 of file cmd.cc.

Referenced by Builder::whileLeave().

Here is the caller graph for this function:

PCmd createPush ( Token  token,
FncDefinition fnc,
VType dstType 
)

read value (and push to stack)

Definition at line 336 of file cmd.cc.

References FncDeclaration::args, ValueFactory::create(), d, StreamDecorator::E_ERROR, ETOKEN_ID, ETOKEN_NUMBER_DOUBLE, ETOKEN_NUMBER_INT, ETOKEN_STRING, Vm::fileName, Vm::glVars, Var::name, Token::numberDouble, Token::numberInt, FncDeclaration::self, Token::text, Value::type, Token::type, Var::used, Value::V_DOUBLE, Value::V_INT, Value::V_NULL, Value::V_STRING, Var::value, FncDefinition::vars, and CmdFactory::Private::vm.

Referenced by Builder::pushToken().

Here is the call graph for this function:

Here is the caller graph for this function:

PCmd createUnary ( Token  token  ) 

unary operator

Definition at line 406 of file cmd.cc.

References d, StreamDecorator::E_ERROR, ETOKEN_KW_NOT, ETOKEN_OP_MINUS, Vm::fileName, Token::type, and CmdFactory::Private::vm.

Referenced by Builder::evalUnOp().

Here is the caller graph for this function:

PCmd createBinary ( Token  token,
VType  t1,
VType  t2,
VType dstType 
)

binary operator

Definition at line 417 of file cmd.cc.

References d, StreamDecorator::E_ERROR, ETOKEN_KW_AND, ETOKEN_KW_DIV, ETOKEN_KW_EQ, ETOKEN_KW_NEQ, ETOKEN_KW_OR, ETOKEN_OP_GREATER, ETOKEN_OP_GREATER_EQ, ETOKEN_OP_LESS, ETOKEN_OP_LESS_EQ, ETOKEN_OP_MINUS, ETOKEN_OP_PLUS, ETOKEN_OP_SLASH, ETOKEN_OP_STAR, Vm::fileName, SHARED_PTR, Token::type, Value::V_BOOL, Value::V_DOUBLE, Value::V_INT, Value::V_NULL, Value::V_STRING, and CmdFactory::Private::vm.

Referenced by Builder::evalBinOp().

Here is the caller graph for this function:

PCmd createCall ( Token  token,
unsigned  nArgs,
bool  pushResult 
)

function call

Definition at line 487 of file cmd.cc.

Referenced by Builder::fncCall(), and VmRunner::Private::run().

Here is the caller graph for this function:

PCmd createPrint ( Token  token,
EToken  valType,
VType srcType 
)

print() function

Definition at line 491 of file cmd.cc.

References d, StreamDecorator::E_ERROR, ETOKEN_KW_DOUBLE, ETOKEN_KW_INT, ETOKEN_KW_STRING, Vm::fileName, Value::V_DOUBLE, Value::V_INT, Value::V_STRING, and CmdFactory::Private::vm.

Referenced by Builder::fncCallPrint().

Here is the caller graph for this function:

PCmd createInput ( Token  token,
Value::VType  type,
bool  pushResult 
)

intput{int|double|string}() function

Definition at line 511 of file cmd.cc.

Referenced by Builder::fncCall().

Here is the caller graph for this function:


Member Data Documentation

Private* d [private]

Definition at line 48 of file cmd.h.

Referenced by createAssign(), createBinary(), createPrint(), createPush(), createUnary(), and ~CmdFactory().


The documentation for this class was generated from the following files:
Generated on Sat Jul 4 18:33:11 2009 for vyp08 (compiler and interpreter of VYP08 language) by  doxygen 1.5.4