|
Colobot
|
Class for one CBot instruction. More...
#include <src/CBot/CBotInstr/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... | |
| 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... | |
| virtual bool | HasReturn () |
| Check a list of instructions for a return statement. 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::CBotLogicExpr, CBot::CBotListExpression, CBot::CBotExprUnaire, CBot::CBotExpression, CBot::CBotWhile, CBot::CBotTry, CBot::CBotThrow, CBot::CBotSwitch, CBot::CBotReturn, CBot::CBotRepeat, CBot::CBotPreIncExpr, CBot::CBotPostIncExpr, CBot::CBotNew, CBot::CBotListInstr, CBot::CBotLeftExprVar, CBot::CBotInstrMethode, CBot::CBotInstrCall, CBot::CBotIf, CBot::CBotFor, CBot::CBotExprVar, CBot::CBotExprRetVar, CBot::CBotExprLitString, CBot::CBotExprLitNum< T >, CBot::CBotExprLitNull, CBot::CBotExprLitNan, CBot::CBotExprLitChar, CBot::CBotExprLitBool, CBot::CBotDo, CBot::CBotDefString, CBot::CBotDefInt, CBot::CBotDefFloat, CBot::CBotDefClass, CBot::CBotDefBoolean, CBot::CBotDefArray, CBot::CBotCatch, CBot::CBotCase, and CBot::CBotBreak.
|
virtual |
RestoreState.
| pj | |
| bMain |
Reimplemented in CBot::CBotWhile, CBot::CBotTwoOpExpr, CBot::CBotTry, CBot::CBotThrow, CBot::CBotSwitch, CBot::CBotReturn, CBot::CBotRepeat, CBot::CBotPreIncExpr, CBot::CBotPostIncExpr, CBot::CBotNew, CBot::CBotLogicExpr, CBot::CBotListInstr, CBot::CBotListExpression, CBot::CBotListArray, CBot::CBotLeftExprVar, CBot::CBotInstrCall, CBot::CBotIf, CBot::CBotFor, CBot::CBotExprVar, CBot::CBotExprUnaire, CBot::CBotExprRetVar, CBot::CBotExprLitString, CBot::CBotExprLitNum< T >, CBot::CBotExprLitNull, CBot::CBotExprLitNan, CBot::CBotExprLitChar, CBot::CBotExprLitBool, CBot::CBotExpression, CBot::CBotDo, CBot::CBotDefString, CBot::CBotDefInt, CBot::CBotDefFloat, CBot::CBotDefClass, CBot::CBotDefBoolean, CBot::CBotDefArray, CBot::CBotCatch, CBot::CBotCase, and CBot::CBotBreak.
|
virtual |
ExecuteVar.
| pVar | |
| pile |
Reimplemented in CBot::CBotLeftExpr, CBot::CBotIndexExpr, and CBot::CBotFieldExpr.
|
virtual |
ExecuteVar.
| pVar | |
| pile | |
| prevToken | |
| bStep | |
| bExtend |
Reimplemented in CBot::CBotInstrMethode, CBot::CBotIndexExpr, and CBot::CBotFieldExpr.
|
virtual |
RestoreStateVar.
| pile | |
| bMain |
Reimplemented in CBot::CBotInstrMethode, CBot::CBotIndexExpr, CBot::CBotFieldExpr, CBot::CBotExprVar, and CBot::CBotLeftExpr.
| 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 |
|
virtual |
Check a list of instructions for a return statement.
Reimplemented in CBot::CBotReturn, CBot::CBotListInstr, CBot::CBotIf, and CBot::CBotFunction.
|
protectedpure virtual |
Returns the name of this class.
Implemented in CBot::CBotWhile, CBot::CBotTwoOpExpr, CBot::CBotTry, CBot::CBotThrow, CBot::CBotSwitch, CBot::CBotReturn, CBot::CBotRepeat, CBot::CBotPreIncExpr, CBot::CBotPostIncExpr, CBot::CBotNew, CBot::CBotLogicExpr, CBot::CBotListInstr, CBot::CBotListExpression, CBot::CBotListArray, CBot::CBotLeftExprVar, CBot::CBotLeftExpr, CBot::CBotInstrMethode, CBot::CBotInstrCall, CBot::CBotIndexExpr, CBot::CBotIf, CBot::CBotFunction, CBot::CBotFor, CBot::CBotFieldExpr, CBot::CBotExprVar, CBot::CBotExprUnaire, CBot::CBotExprRetVar, CBot::CBotExprLitString, CBot::CBotExprLitNum< T >, CBot::CBotExprLitNull, CBot::CBotExprLitNan, CBot::CBotExprLitChar, CBot::CBotExprLitBool, CBot::CBotExpression, CBot::CBotEmpty, CBot::CBotDo, CBot::CBotDefString, CBot::CBotDefInt, CBot::CBotDefFloat, CBot::CBotDefClass, CBot::CBotDefBoolean, CBot::CBotDefArray, CBot::CBotCatch, CBot::CBotCase, and CBot::CBotBreak.
|
inlineprotectedvirtual |
Returns additional data associated with this instruction for debugging purposes.
Reimplemented in CBot::CBotWhile, CBot::CBotTwoOpExpr, CBot::CBotRepeat, CBot::CBotNew, CBot::CBotLeftExprVar, CBot::CBotLeftExpr, CBot::CBotInstrMethode, CBot::CBotInstrCall, CBot::CBotFunction, CBot::CBotFor, CBot::CBotFieldExpr, CBot::CBotExprVar, CBot::CBotExprRetVar, CBot::CBotExprLitString, CBot::CBotExprLitNum< T >, CBot::CBotExprLitNull, CBot::CBotExprLitNan, CBot::CBotExprLitChar, CBot::CBotDo, CBot::CBotDefArray, and CBot::CBotBreak.
|
protectedvirtual |
Returns a map of all instructions connected with this one
Reimplemented in CBot::CBotWhile, CBot::CBotTwoOpExpr, CBot::CBotTry, CBot::CBotThrow, CBot::CBotSwitch, CBot::CBotReturn, CBot::CBotRepeat, CBot::CBotPreIncExpr, CBot::CBotPostIncExpr, CBot::CBotNew, CBot::CBotLogicExpr, CBot::CBotListInstr, CBot::CBotListExpression, CBot::CBotListArray, CBot::CBotInstrMethode, CBot::CBotInstrCall, CBot::CBotIndexExpr, CBot::CBotIf, CBot::CBotFunction, CBot::CBotFor, CBot::CBotExprUnaire, CBot::CBotExpression, CBot::CBotDo, CBot::CBotDefString, CBot::CBotDefInt, CBot::CBotDefFloat, CBot::CBotDefClass, CBot::CBotDefBoolean, CBot::CBotDefArray, CBot::CBotCatch, and CBot::CBotCase.
|
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.