Colobot
|
Class for one CBot instruction. More...
#include <CBotInstr.h>
Public Member Functions | |
CBotInstr () | |
Constructor. More... | |
virtual | ~CBotInstr () |
Destructor. More... | |
virtual bool | Execute (CBotStack *&pj) |
Execute. More... | |
virtual bool | Execute (CBotStack *&pj, CBotVar *pVar) |
Execute. More... | |
virtual void | RestoreState (CBotStack *&pj, bool bMain) |
RestoreState. More... | |
virtual bool | ExecuteVar (CBotVar *&pVar, CBotCStack *&pile) |
ExecuteVar. More... | |
virtual bool | ExecuteVar (CBotVar *&pVar, CBotStack *&pile, CBotToken *prevToken, bool bStep, bool bExtend) |
ExecuteVar. More... | |
virtual void | RestoreStateVar (CBotStack *&pile, bool bMain) |
RestoreStateVar. More... | |
virtual bool | CompCase (CBotStack *&pj, int val) |
CompCase This routine is defined only for the subclass CBotCase this allows to make the call on all instructions CompCase to see if it's a case to the desired value.. More... | |
void | SetToken (CBotToken *p) |
SetToken Set the token corresponding to the instruction. More... | |
int | GetTokenType () |
GetTokenType Return the type of the token assicated with the instruction. More... | |
CBotToken * | GetToken () |
GetToken Return associated token. More... | |
void | AddNext (CBotInstr *n) |
AddNext Adds the statement following the other. More... | |
CBotInstr * | GetNext () |
GetNext Returns next statement. More... | |
void | AddNext3 (CBotInstr *n) |
AddNext3. More... | |
CBotInstr * | GetNext3 () |
GetNext3. More... | |
void | AddNext3b (CBotInstr *n) |
AddNext3b. More... | |
CBotInstr * | GetNext3b () |
GetNext3b. More... | |
Static Public Member Functions | |
static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack) |
Compile an instruction. More... | |
static CBotInstr * | CompileArray (CBotToken *&p, CBotCStack *pStack, CBotTypResult type, bool first=true) |
CompileArray. More... | |
static void | IncLvl (std::string &label) |
IncLvl Adds a level with a label. More... | |
static void | IncLvl () |
IncLvl Adds a level (switch statement). More... | |
static void | DecLvl () |
DecLvl Free a level. More... | |
static bool | ChkLvl (const std::string &label, int type) |
ChkLvl Control validity of break and continue. More... | |
Protected Member Functions | |
virtual const std::string | GetDebugName ()=0 |
Returns the name of this class. More... | |
virtual std::string | GetDebugData () |
Returns additional data associated with this instruction for debugging purposes. More... | |
virtual std::map< std::string, CBotInstr * > | GetDebugLinks () |
Protected Attributes | |
CBotToken | m_token |
Keeps the token. More... | |
CBotInstr * | m_next |
Linked command. More... | |
CBotInstr * | m_next2b |
Second list definition chain. More... | |
CBotInstr * | m_next3 |
Third list for indices and fields. More... | |
CBotInstr * | m_next3b |
Necessary for reporting tables. More... | |
Static Protected Attributes | |
static int | m_LoopLvl = 0 |
Counter of nested loops, to determine the break and continue valid. More... | |
Friends | |
class | CBotDebug |
class | CBotDefClass |
class | CBotDefInt |
class | CBotListArray |
Class for one CBot instruction.
For example, for program:
the following structure is generated:
CBot::CBotInstr::CBotInstr | ( | ) |
Constructor.
|
virtual |
Destructor.
|
static |
Compile an instruction.
Supported instructions are:
[in,out] | p | Token to start at, updated to point at the next token |
pStack | Compilation stack |
|
static |
CompileArray.
p | |
pStack | |
type | |
first |
|
virtual |
Execute.
pj |
Reimplemented in CBot::CBotTwoOpExpr, CBot::CBotExprVar, CBot::CBotListExpression, CBot::CBotDefClass, CBot::CBotExpression, CBot::CBotCatch, CBot::CBotWhile, CBot::CBotDefArray, CBot::CBotCase, CBot::CBotExprLitNum, CBot::CBotTry, CBot::CBotDefBoolean, CBot::CBotDefFloat, CBot::CBotDefInt, CBot::CBotDefString, CBot::CBotInstrCall, CBot::CBotSwitch, CBot::CBotBreak, CBot::CBotIf, CBot::CBotInstrMethode, CBot::CBotListInstr, CBot::CBotDo, CBot::CBotExprLitBool, CBot::CBotExprLitString, CBot::CBotExprUnaire, CBot::CBotFor, CBot::CBotNew, CBot::CBotReturn, CBot::CBotThrow, CBot::CBotLeftExprVar, CBot::CBotLogicExpr, CBot::CBotPostIncExpr, CBot::CBotPreIncExpr, CBot::CBotExprLitNan, and CBot::CBotExprLitNull.
|
virtual |
RestoreState.
pj | |
bMain |
Reimplemented in CBot::CBotTwoOpExpr, CBot::CBotExprVar, CBot::CBotListExpression, CBot::CBotDefClass, CBot::CBotExpression, CBot::CBotCatch, CBot::CBotWhile, CBot::CBotDefArray, CBot::CBotCase, CBot::CBotExprLitNum, CBot::CBotTry, CBot::CBotDefBoolean, CBot::CBotDefFloat, CBot::CBotDefInt, CBot::CBotDefString, CBot::CBotInstrCall, CBot::CBotListArray, CBot::CBotSwitch, CBot::CBotBreak, CBot::CBotIf, CBot::CBotListInstr, CBot::CBotDo, CBot::CBotExprLitBool, CBot::CBotExprLitString, CBot::CBotExprUnaire, CBot::CBotFor, CBot::CBotNew, CBot::CBotReturn, CBot::CBotThrow, CBot::CBotLeftExprVar, CBot::CBotLogicExpr, CBot::CBotPostIncExpr, CBot::CBotPreIncExpr, CBot::CBotExprLitNan, and CBot::CBotExprLitNull.
|
virtual |
ExecuteVar.
pVar | |
pile |
Reimplemented in CBot::CBotLeftExpr, CBot::CBotFieldExpr, and CBot::CBotIndexExpr.
|
virtual |
ExecuteVar.
pVar | |
pile | |
prevToken | |
bStep | |
bExtend |
Reimplemented in CBot::CBotInstrMethode, CBot::CBotFieldExpr, and CBot::CBotIndexExpr.
|
virtual |
RestoreStateVar.
pile | |
bMain |
Reimplemented in CBot::CBotExprVar, CBot::CBotLeftExpr, CBot::CBotInstrMethode, CBot::CBotFieldExpr, and CBot::CBotIndexExpr.
|
virtual |
CompCase This routine is defined only for the subclass CBotCase this allows to make the call on all instructions CompCase to see if it's a case to the desired value..
pj | |
val |
Reimplemented in CBot::CBotCase.
void CBot::CBotInstr::SetToken | ( | CBotToken * | p | ) |
SetToken Set the token corresponding to the instruction.
p |
int CBot::CBotInstr::GetTokenType | ( | ) |
GetTokenType Return the type of the token assicated with the instruction.
CBotToken * CBot::CBotInstr::GetToken | ( | ) |
GetToken Return associated token.
void CBot::CBotInstr::AddNext | ( | CBotInstr * | n | ) |
AddNext Adds the statement following the other.
n |
CBotInstr * CBot::CBotInstr::GetNext | ( | ) |
GetNext Returns next statement.
void CBot::CBotInstr::AddNext3 | ( | CBotInstr * | n | ) |
AddNext3.
n |
CBotInstr * CBot::CBotInstr::GetNext3 | ( | ) |
GetNext3.
void CBot::CBotInstr::AddNext3b | ( | CBotInstr * | n | ) |
AddNext3b.
n |
CBotInstr * CBot::CBotInstr::GetNext3b | ( | ) |
GetNext3b.
|
static |
IncLvl Adds a level with a label.
label |
|
static |
IncLvl Adds a level (switch statement).
|
static |
DecLvl Free a level.
|
static |
ChkLvl Control validity of break and continue.
label | |
type |
|
protectedpure virtual |
Returns the name of this class.
Implemented in CBot::CBotFunction, CBot::CBotExprVar, CBot::CBotLeftExpr, CBot::CBotTwoOpExpr, CBot::CBotCatch, CBot::CBotListExpression, CBot::CBotDefClass, CBot::CBotCase, CBot::CBotInstrMethode, CBot::CBotExpression, CBot::CBotFieldExpr, CBot::CBotWhile, CBot::CBotDefArray, CBot::CBotIndexExpr, CBot::CBotExprLitNum, CBot::CBotTry, CBot::CBotDefBoolean, CBot::CBotDefFloat, CBot::CBotDefInt, CBot::CBotDefString, CBot::CBotInstrCall, CBot::CBotListArray, CBot::CBotSwitch, CBot::CBotBreak, CBot::CBotIf, CBot::CBotListInstr, CBot::CBotDo, CBot::CBotExprLitBool, CBot::CBotExprLitString, CBot::CBotExprUnaire, CBot::CBotFor, CBot::CBotNew, CBot::CBotReturn, CBot::CBotThrow, CBot::CBotLeftExprVar, CBot::CBotLogicExpr, CBot::CBotPostIncExpr, CBot::CBotPreIncExpr, CBot::CBotExprLitNan, CBot::CBotExprLitNull, and CBot::CBotEmpty.
|
inlineprotectedvirtual |
Returns additional data associated with this instruction for debugging purposes.
Reimplemented in CBot::CBotFunction, CBot::CBotExprVar, CBot::CBotLeftExpr, CBot::CBotTwoOpExpr, CBot::CBotInstrMethode, CBot::CBotFieldExpr, CBot::CBotWhile, CBot::CBotDefArray, CBot::CBotExprLitNum, CBot::CBotInstrCall, CBot::CBotBreak, CBot::CBotDo, CBot::CBotExprLitString, CBot::CBotFor, CBot::CBotNew, CBot::CBotLeftExprVar, CBot::CBotExprLitNan, and CBot::CBotExprLitNull.
|
protectedvirtual |
Returns a map of all instructions connected with this one
Reimplemented in CBot::CBotFunction, CBot::CBotTwoOpExpr, CBot::CBotCatch, CBot::CBotListExpression, CBot::CBotDefClass, CBot::CBotInstrMethode, CBot::CBotCase, CBot::CBotExpression, CBot::CBotWhile, CBot::CBotDefArray, CBot::CBotIndexExpr, CBot::CBotInstrCall, CBot::CBotTry, CBot::CBotDefBoolean, CBot::CBotDefFloat, CBot::CBotDefInt, CBot::CBotDefString, CBot::CBotListArray, CBot::CBotSwitch, CBot::CBotDo, CBot::CBotFor, CBot::CBotIf, CBot::CBotListInstr, CBot::CBotNew, CBot::CBotExprUnaire, CBot::CBotReturn, CBot::CBotThrow, CBot::CBotLogicExpr, CBot::CBotPostIncExpr, and CBot::CBotPreIncExpr.
|
protected |
Keeps the token.
|
protected |
Linked command.
|
protected |
Second list definition chain.
|
protected |
Third list for indices and fields.
|
protected |
Necessary for reporting tables.
|
staticprotected |
Counter of nested loops, to determine the break and continue valid.