Colobot
Loading...
Searching...
No Matches
CBot::CBotCStack Class Reference

The CBotCStack class Management of the stack of compilation. More...

#include <src/CBot/CBotCStack.h>

Classes

struct  Data

Public Member Functions

 CBotCStack (CBotCStack *ppapa)
 CBotCStack.
 ~CBotCStack ()
 CBotCStack Destructor.
bool IsOk ()
 IsOk.
CBotError GetError ()
 GetError.
CBotError GetError (int &start, int &end)
 GetError Gives error number.
void SetType (CBotTypResult &type)
 SetType Set the type of instruction on the stack.
CBotTypResult GetTypResult (CBotVar::GetTypeMode mode=CBotVar::GetTypeMode::NORMAL)
 GetTypResult Gives the type of value on the stack. Type of instruction on the stack.
int GetType (CBotVar::GetTypeMode mode=CBotVar::GetTypeMode::NORMAL)
 GetType Gives the type of value on the stack.
CBotClassGetClass ()
 GetClass Gives the class of the value on the stack.
void AddVar (CBotVar *p)
 AddVar Adds a local variable.
void CreateVarThis (CBotClass *pClass)
 Create 'this' as a local variable.
void CreateVarSuper (CBotClass *pClass)
 Create 'super' as a local variable.
void CreateMemberVars (CBotClass *pClass, bool setDefined)
 Create member variables of the current class as local variables.
CBotVarFindVar (CBotToken *&p)
 FindVar Finds a variable. Seeks a variable on the stack the token may be a result of TokenTypVar (object of a class) or a pointer in the source.
CBotVarFindVar (CBotToken &Token)
 FindVar.
bool CheckVarLocal (CBotToken *&pToken)
 CheckVarLocal Test whether a variable is already defined locally.
CBotVarCopyVar (CBotToken &Token)
 CopyVar Finds and makes a copy.
CBotCStackTokenStack (CBotToken *pToken=nullptr, bool bBlock=false)
 TokenStack Used only at compile.
void DeleteNext ()
 Deletes all subsequent stack frames created by TokenStack.
CBotInstrReturn (CBotInstr *p, CBotCStack *pParent)
 Return Transmits the result upper.
CBotFunctionReturnFunc (CBotFunction *p, CBotCStack *pParent)
 ReturnFunc Transmits the result upper.
void SetVar (CBotVar *var)
 SetVar.
void SetCopyVar (CBotVar *var)
 SetCopyVar Puts on the stack a copy of a variable.
CBotVarGetVar ()
 GetVar.
void SetStartError (int pos)
 SetStartError.
void SetError (CBotError n, int pos)
 SetError.
void SetError (CBotError n, CBotToken *p)
 SetError.
void ResetError (CBotError n, int start, int end)
 ResetError.
void SetRetType (CBotTypResult &type)
 SetRetType.
CBotTypResult GetRetType ()
 GetRetType.
void SetProgram (CBotProgram *p)
 SetProgram.
CBotProgramGetProgram ()
 GetProgram.
CBotTypResult CompileCall (CBotToken *&p, CBotVar **ppVars, long &nIdent)
 CompileCall.
bool CheckCall (CBotToken *&pToken, CBotDefParam *pParam, const std::string &className)
 CheckCall Test if a procedure name is already defined somewhere.
bool NextToken (CBotToken *&p)
 NextToken.

Detailed Description

The CBotCStack class Management of the stack of compilation.

Constructor & Destructor Documentation

◆ CBotCStack()

CBot::CBotCStack::CBotCStack ( CBotCStack * ppapa)

CBotCStack.

Parameters
ppapa

◆ ~CBotCStack()

CBot::CBotCStack::~CBotCStack ( )

CBotCStack Destructor.

Member Function Documentation

◆ IsOk()

bool CBot::CBotCStack::IsOk ( )

IsOk.

Returns

◆ GetError() [1/2]

CBotError CBot::CBotCStack::GetError ( )

GetError.

Returns

◆ GetError() [2/2]

CBotError CBot::CBotCStack::GetError ( int & start,
int & end )

GetError Gives error number.

Parameters
start
end
Returns

◆ SetType()

void CBot::CBotCStack::SetType ( CBotTypResult & type)

SetType Set the type of instruction on the stack.

Parameters
type

◆ GetTypResult()

CBotTypResult CBot::CBotCStack::GetTypResult ( CBotVar::GetTypeMode mode = CBotVar::GetTypeMode::NORMAL)

GetTypResult Gives the type of value on the stack. Type of instruction on the stack.

Parameters
mode
Returns

◆ GetType()

int CBot::CBotCStack::GetType ( CBotVar::GetTypeMode mode = CBotVar::GetTypeMode::NORMAL)

GetType Gives the type of value on the stack.

Parameters
mode
Returns

◆ GetClass()

CBotClass * CBot::CBotCStack::GetClass ( )

GetClass Gives the class of the value on the stack.

Returns

◆ AddVar()

void CBot::CBotCStack::AddVar ( CBotVar * p)

AddVar Adds a local variable.

Parameters
p

◆ CreateVarThis()

void CBot::CBotCStack::CreateVarThis ( CBotClass * pClass)

Create 'this' as a local variable.

Parameters
pClassThe current class referred to by 'this'

◆ CreateVarSuper()

void CBot::CBotCStack::CreateVarSuper ( CBotClass * pClass)

Create 'super' as a local variable.

Parameters
pClassThe parent class referred to by 'super'

◆ CreateMemberVars()

void CBot::CBotCStack::CreateMemberVars ( CBotClass * pClass,
bool setDefined )

Create member variables of the current class as local variables.

Parameters
pClassThe current class.
setDefinedWhether to mark the variables as initialized.

◆ FindVar() [1/2]

CBotVar * CBot::CBotCStack::FindVar ( CBotToken *& p)

FindVar Finds a variable. Seeks a variable on the stack the token may be a result of TokenTypVar (object of a class) or a pointer in the source.

Parameters
p
Returns

◆ FindVar() [2/2]

CBotVar * CBot::CBotCStack::FindVar ( CBotToken & Token)

FindVar.

Parameters
Token
Returns

◆ CheckVarLocal()

bool CBot::CBotCStack::CheckVarLocal ( CBotToken *& pToken)

CheckVarLocal Test whether a variable is already defined locally.

Parameters
pToken
Returns

◆ CopyVar()

CBotVar * CBot::CBotCStack::CopyVar ( CBotToken & Token)

CopyVar Finds and makes a copy.

Parameters
Token
Returns

◆ TokenStack()

CBotCStack * CBot::CBotCStack::TokenStack ( CBotToken * pToken = nullptr,
bool bBlock = false )

TokenStack Used only at compile.

Parameters
pToken
bBlock
Returns

◆ DeleteNext()

void CBot::CBotCStack::DeleteNext ( )

Deletes all subsequent stack frames created by TokenStack.

◆ Return()

CBotInstr * CBot::CBotCStack::Return ( CBotInstr * p,
CBotCStack * pParent )

Return Transmits the result upper.

Parameters
p
pParent
Returns

◆ ReturnFunc()

CBotFunction * CBot::CBotCStack::ReturnFunc ( CBotFunction * p,
CBotCStack * pParent )

ReturnFunc Transmits the result upper.

Parameters
p
pParent
Returns

◆ SetVar()

void CBot::CBotCStack::SetVar ( CBotVar * var)

SetVar.

Parameters
var

◆ SetCopyVar()

void CBot::CBotCStack::SetCopyVar ( CBotVar * var)

SetCopyVar Puts on the stack a copy of a variable.

Parameters
var

◆ GetVar()

CBotVar * CBot::CBotCStack::GetVar ( )

GetVar.

Returns

◆ SetStartError()

void CBot::CBotCStack::SetStartError ( int pos)

SetStartError.

Parameters
pos

◆ SetError() [1/2]

void CBot::CBotCStack::SetError ( CBotError n,
int pos )

SetError.

Parameters
n
pos

◆ SetError() [2/2]

void CBot::CBotCStack::SetError ( CBotError n,
CBotToken * p )

SetError.

Parameters
n
p

◆ ResetError()

void CBot::CBotCStack::ResetError ( CBotError n,
int start,
int end )

ResetError.

Parameters
n
start
end

◆ SetRetType()

void CBot::CBotCStack::SetRetType ( CBotTypResult & type)

SetRetType.

Parameters
type

◆ GetRetType()

CBotTypResult CBot::CBotCStack::GetRetType ( )

GetRetType.

Returns

◆ SetProgram()

void CBot::CBotCStack::SetProgram ( CBotProgram * p)

SetProgram.

Parameters
p

◆ GetProgram()

CBotProgram * CBot::CBotCStack::GetProgram ( )

GetProgram.

Returns

◆ CompileCall()

CBotTypResult CBot::CBotCStack::CompileCall ( CBotToken *& p,
CBotVar ** ppVars,
long & nIdent )

CompileCall.

Parameters
p
ppVars
nIdent
Returns

◆ CheckCall()

bool CBot::CBotCStack::CheckCall ( CBotToken *& pToken,
CBotDefParam * pParam,
const std::string & className )

CheckCall Test if a procedure name is already defined somewhere.

Parameters
pTokenToken representing the name of a function.
pParamList of parameters.
classNameName of a class when checking for methods.
Returns

◆ NextToken()

bool CBot::CBotCStack::NextToken ( CBotToken *& p)

NextToken.

Parameters
p
Returns

The documentation for this class was generated from the following files: