Renamed some CBotInstr classes

dev-time-step
krzys-h 2015-12-31 14:44:19 +01:00
parent 10b201b9e6
commit fa92605225
36 changed files with 284 additions and 291 deletions

View File

@ -27,7 +27,7 @@
#include "CBot/CBotInstr/CBotListArray.h"
#include "CBot/CBotInstr/CBotEmpty.h"
#include "CBotExternalCall.h"
#include "CBot/CBotExternalCall.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotUtils.h"

View File

@ -17,7 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBotExternalCall.h"
#include "CBot/CBotExternalCall.h"
#include "CBot/CBotToken.h"
#include "CBot/CBotStack.h"

View File

@ -18,7 +18,8 @@
*/
#include "CBot/CBotInstr/CBotCase.h"
#include "CBot/CBotInstr/CBotExprNum.h"
#include "CBot/CBotInstr/CBotExprLitNum.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -50,7 +51,7 @@ CBotInstr* CBotCase::Compile(CBotToken* &p, CBotCStack* pStack)
if ( pp->GetType() == ID_CASE )
{
pp = p;
inst->m_value = CBotExprNum::Compile(p, pStack);
inst->m_value = CBotExprLitNum::Compile(p, pStack);
if (inst->m_value == nullptr )
{
pStack->SetError( CBotErrBadNum, pp );

View File

@ -17,8 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include <sstream>
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotExpression.h"
@ -27,34 +26,35 @@
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotDefines.h"
#include "CBot/CBotVar/CBotVar.h"
#include <sstream>
namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotInstArray::CBotInstArray()
CBotDefArray::CBotDefArray()
{
m_var = nullptr;
m_listass = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstArray::~CBotInstArray()
CBotDefArray::~CBotDefArray()
{
delete m_var;
delete m_listass;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotInstArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResult type)
CBotInstr* CBotDefArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResult type)
{
CBotCStack* pStk = pStack->TokenStack(p);
CBotInstArray* inst = new CBotInstArray();
CBotDefArray* inst = new CBotDefArray();
CBotToken* vartoken = p;
inst->SetToken(vartoken);
@ -107,7 +107,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotInstArray::Execute(CBotStack* &pj)
bool CBotDefArray::Execute(CBotStack* &pj)
{
CBotStack* pile1 = pj->AddStack(this);
@ -187,7 +187,7 @@ bool CBotInstArray::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefArray::RestoreState(CBotStack* &pj, bool bMain)
{
CBotStack* pile1 = pj;
@ -227,14 +227,14 @@ void CBotInstArray::RestoreState(CBotStack* &pj, bool bMain)
if (m_next2b ) m_next2b->RestoreState( pile1, bMain);
}
std::string CBotInstArray::GetDebugData()
std::string CBotDefArray::GetDebugData()
{
std::stringstream ss;
ss << m_typevar.ToString();
return ss.str();
}
std::map<std::string, CBotInstr*> CBotInstArray::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefArray::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -34,11 +34,11 @@ namespace CBot
* bool[] z;
* \endcode
*/
class CBotInstArray : public CBotInstr
class CBotDefArray : public CBotInstr
{
public:
CBotInstArray();
~CBotInstArray();
CBotDefArray();
~CBotDefArray();
/*!
* \brief Compile
@ -64,7 +64,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotInstArray"; }
virtual const std::string GetDebugName() { return "CBotDefArray"; }
virtual std::string GetDebugData();
virtual std::map<std::string, CBotInstr*> GetDebugLinks();

View File

@ -17,10 +17,11 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotBoolean.h"
#include "CBot/CBotInstr/CBotDefBoolean.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -31,31 +32,31 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotBoolean::CBotBoolean()
CBotDefBoolean::CBotDefBoolean()
{
m_var = m_expr = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotBoolean::~CBotBoolean()
CBotDefBoolean::~CBotDefBoolean()
{
delete m_var;
delete m_expr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
{
CBotToken* pp = cont ? nullptr : p;
if (!cont && !IsOfType(p, ID_BOOLEAN, ID_BOOL)) return nullptr;
CBotBoolean* inst = static_cast<CBotBoolean*>(CompileArray(p, pStack, CBotTypBoolean));
CBotDefBoolean* inst = static_cast<CBotDefBoolean*>(CompileArray(p, pStack, CBotTypBoolean));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
inst = new CBotBoolean();
inst = new CBotDefBoolean();
inst->m_expr = nullptr;
@ -74,12 +75,12 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (IsOfType(p, ID_OPBRK))
{
delete inst; // type is not CBotInt
delete inst; // type is not CBotDefInt
p = vartoken; // resutns to the variable name
// compiles an array declaration
inst = static_cast<CBotBoolean*>(CBotInstArray::Compile(p, pStk, CBotTypBoolean));
inst = static_cast<CBotDefBoolean*>(CBotDefArray::Compile(p, pStk, CBotTypBoolean));
if (!pStk->IsOk() )
{
@ -110,7 +111,7 @@ CBotInstr* CBotBoolean::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
suite:
if (IsOfType(p, ID_COMMA))
{
if (nullptr != ( inst->m_next2b = CBotBoolean::Compile(p, pStk, true, noskip)))
if (nullptr != ( inst->m_next2b = CBotDefBoolean::Compile(p, pStk, true, noskip)))
{
return pStack->Return(inst, pStk);
}
@ -130,7 +131,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotBoolean::Execute(CBotStack* &pj)
bool CBotDefBoolean::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);//essential for SetState()
@ -151,7 +152,7 @@ bool CBotBoolean::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotBoolean::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefBoolean::RestoreState(CBotStack* &pj, bool bMain)
{
CBotStack* pile = pj;
if (bMain)
@ -172,7 +173,7 @@ void CBotBoolean::RestoreState(CBotStack* &pj, bool bMain)
m_next2b->RestoreState(pile, bMain); // other(s) definition(s)
}
std::map<std::string, CBotInstr*> CBotBoolean::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefBoolean::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -27,11 +27,11 @@ namespace CBot
/**
* \brief Definition of boolean variable - bool a, b = false
*/
class CBotBoolean : public CBotInstr
class CBotDefBoolean : public CBotInstr
{
public:
CBotBoolean();
~CBotBoolean();
CBotDefBoolean();
~CBotDefBoolean();
/*!
* \brief Compile
@ -58,7 +58,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotBoolean"; }
virtual const std::string GetDebugName() { return "CBotDefBoolean"; }
virtual std::map<std::string, CBotInstr*> GetDebugLinks();
private:

View File

@ -17,13 +17,13 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBotClassInst.h"
#include "CBot/CBotInstr/CBotDefClass.h"
#include "CBot/CBotInstr/CBotInstrUtils.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -36,7 +36,7 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotClassInst::CBotClassInst()
CBotDefClass::CBotDefClass()
{
m_next = nullptr;
m_var = nullptr;
@ -47,13 +47,13 @@ CBotClassInst::CBotClassInst()
}
////////////////////////////////////////////////////////////////////////////////
CBotClassInst::~CBotClassInst()
CBotDefClass::~CBotDefClass()
{
delete m_var;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* pClass)
CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* pClass)
{
// seeks the corresponding classes
if ( pClass == nullptr )
@ -71,12 +71,12 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
bool bIntrinsic = pClass->IsIntrinsic();
CBotTypResult type = CBotTypResult( bIntrinsic ? CBotTypIntrinsic : CBotTypPointer, pClass );
CBotClassInst* inst = static_cast<CBotClassInst*>(CompileArray(p, pStack, type));
CBotDefClass* inst = static_cast<CBotDefClass*>(CompileArray(p, pStack, type));
if ( inst != nullptr || !pStack->IsOk() ) return inst;
CBotCStack* pStk = pStack->TokenStack();
inst = new CBotClassInst();
inst = new CBotDefClass();
/// TODO Need to be revised and fixed after adding unit tests
CBotToken token(pClass->GetName(), std::string(), p->GetStart(), p->GetEnd());
inst->SetToken(&token);
@ -94,12 +94,12 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
if (IsOfType(p, ID_OPBRK)) // with any clues?
{
delete inst; // is not type CBotInt
delete inst; // is not type CBotDefInt
p = vartoken; // returns to the variable name
// compiles declaration an array
inst = static_cast<CBotClassInst*>(CBotInstArray::Compile( p, pStk, type ));
inst = static_cast<CBotDefClass*>(CBotDefArray::Compile(p, pStk, type ));
if (!pStk->IsOk() )
{
@ -202,7 +202,7 @@ CBotInstr* CBotClassInst::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass*
suite:
if (IsOfType(p, ID_COMMA)) // several chained definitions
{
if ( nullptr != ( inst->m_next = CBotClassInst::Compile(p, pStk, pClass) )) // compiles the following
if ( nullptr != ( inst->m_next = CBotDefClass::Compile(p, pStk, pClass) )) // compiles the following
{
return pStack->Return(inst, pStk);
}
@ -222,7 +222,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotClassInst::Execute(CBotStack* &pj)
bool CBotDefClass::Execute(CBotStack* &pj)
{
CBotVar* pThis = nullptr;
@ -357,7 +357,7 @@ bool CBotClassInst::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefClass::RestoreState(CBotStack* &pj, bool bMain)
{
CBotVar* pThis = nullptr;
@ -436,7 +436,7 @@ void CBotClassInst::RestoreState(CBotStack* &pj, bool bMain)
m_next2b->RestoreState(pile, bMain); // other(s) definition(s)
}
std::map<std::string, CBotInstr*> CBotClassInst::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefClass::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -37,12 +37,12 @@ namespace CBot
* ClassName varname1 = new ClassName(), varname2;
* \endcode
*/
class CBotClassInst : public CBotInstr
class CBotDefClass : public CBotInstr
{
public:
CBotClassInst();
~CBotClassInst();
CBotDefClass();
~CBotDefClass();
/*!
* \brief Compile Definition of pointer (s) to an object style CPoint A, B ;

View File

@ -17,10 +17,11 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotFloat.h"
#include "CBot/CBotInstr/CBotDefFloat.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -31,32 +32,32 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotFloat::CBotFloat()
CBotDefFloat::CBotDefFloat()
{
m_var = nullptr;
m_expr = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotFloat::~CBotFloat()
CBotDefFloat::~CBotDefFloat()
{
delete m_var;
delete m_expr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
{
CBotToken* pp = cont ? nullptr : p;
if (!cont && !IsOfType(p, ID_FLOAT)) return nullptr;
CBotFloat* inst = static_cast<CBotFloat*>(CompileArray(p, pStack, CBotTypFloat));
CBotDefFloat* inst = static_cast<CBotDefFloat*>(CompileArray(p, pStack, CBotTypFloat));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
inst = new CBotFloat();
inst = new CBotDefFloat();
inst->m_expr = nullptr;
@ -78,7 +79,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
{
delete inst;
p = vartoken;
inst = static_cast<CBotFloat*>(CBotInstArray::Compile(p, pStk, CBotTypFloat));
inst = static_cast<CBotDefFloat*>(CBotDefArray::Compile(p, pStk, CBotTypFloat));
if (!pStk->IsOk() )
{
@ -109,7 +110,7 @@ CBotInstr* CBotFloat::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool
suite:
if (IsOfType(p, ID_COMMA))
{
if (nullptr != ( inst->m_next2b = CBotFloat::Compile(p, pStk, true, noskip)))
if (nullptr != ( inst->m_next2b = CBotDefFloat::Compile(p, pStk, true, noskip)))
{
return pStack->Return(inst, pStk);
}
@ -129,7 +130,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotFloat::Execute(CBotStack* &pj)
bool CBotDefFloat::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -150,7 +151,7 @@ bool CBotFloat::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotFloat::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefFloat::RestoreState(CBotStack* &pj, bool bMain)
{
CBotStack* pile = pj;
if (bMain)
@ -171,7 +172,7 @@ void CBotFloat::RestoreState(CBotStack* &pj, bool bMain)
m_next2b->RestoreState(pile, bMain);
}
std::map<std::string, CBotInstr*> CBotFloat::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefFloat::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -27,19 +27,11 @@ namespace CBot
/**
* \brief Definition of a float variable - float a, b = 12.4
*/
class CBotFloat : public CBotInstr
class CBotDefFloat : public CBotInstr
{
public:
/*!
* \brief CBotFloat
*/
CBotFloat();
/*!
* \brief ~CBotFloat
*/
~CBotFloat();
CBotDefFloat();
~CBotDefFloat();
/*!
* \brief Compile
@ -66,7 +58,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotFloat"; }
virtual const std::string GetDebugName() { return "CBotDefFloat"; }
virtual std::map<std::string, CBotInstr*> GetDebugLinks();
private:

View File

@ -17,10 +17,10 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotInt.h"
#include "CBot/CBotInstr/CBotDefInt.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotStack.h"
@ -32,7 +32,7 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotInt::CBotInt()
CBotDefInt::CBotDefInt()
{
m_next = nullptr; // for multiple definitions
m_var = nullptr;
@ -40,25 +40,25 @@ CBotInt::CBotInt()
}
////////////////////////////////////////////////////////////////////////////////
CBotInt::~CBotInt()
CBotDefInt::~CBotDefInt()
{
delete m_var;
delete m_expr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
{
CBotToken* pp = cont ? nullptr : p; // no repetition of the token "int"
if (!cont && !IsOfType(p, ID_INT)) return nullptr;
CBotInt* inst = static_cast<CBotInt*>(CompileArray(p, pStack, CBotTypInt));
CBotDefInt* inst = static_cast<CBotDefInt*>(CompileArray(p, pStack, CBotTypInt));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
inst = new CBotInt();
inst = new CBotDefInt();
inst->m_expr = nullptr;
@ -77,12 +77,12 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
if (IsOfType(p, ID_OPBRK))
{
delete inst; // type is not CBotInt
delete inst; // type is not CBotDefInt
p = vartoken; // returns the variable name
// compiles an array declaration
CBotInstr* inst2 = CBotInstArray::Compile(p, pStk, CBotTypInt);
CBotInstr* inst2 = CBotDefArray::Compile(p, pStk, CBotTypInt);
if (!pStk->IsOk() )
{
@ -92,12 +92,12 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
if (IsOfType(p, ID_COMMA)) // several definition chained
{
if (nullptr != ( inst2->m_next2b = CBotInt::Compile(p, pStk, true, noskip))) // compile the next one
if (nullptr != ( inst2->m_next2b = CBotDefInt::Compile(p, pStk, true, noskip))) // compile the next one
{
return pStack->Return(inst2, pStk);
}
}
inst = static_cast<CBotInt*>(inst2);
inst = static_cast<CBotDefInt*>(inst2);
goto suite; // no assignment, variable already created
}
@ -124,7 +124,7 @@ CBotInstr* CBotInt::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool n
if (IsOfType(p, ID_COMMA)) // chained several definitions
{
if (nullptr != ( inst->m_next2b = CBotInt::Compile(p, pStk, true, noskip))) // compile next one
if (nullptr != ( inst->m_next2b = CBotDefInt::Compile(p, pStk, true, noskip))) // compile next one
{
return pStack->Return(inst, pStk);
}
@ -144,7 +144,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotInt::Execute(CBotStack* &pj)
bool CBotDefInt::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this); // essential for SetState()
@ -165,7 +165,7 @@ bool CBotInt::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotInt::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefInt::RestoreState(CBotStack* &pj, bool bMain)
{
CBotStack* pile = pj;
if (bMain)
@ -185,7 +185,7 @@ void CBotInt::RestoreState(CBotStack* &pj, bool bMain)
if (m_next2b) m_next2b->RestoreState(pile, bMain); // other(s) definition(s)
}
std::map<std::string, CBotInstr*> CBotInt::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefInt::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -27,11 +27,11 @@ namespace CBot
/**
* \brief Definition of an integer variable - int a, b = 12
*/
class CBotInt : public CBotInstr
class CBotDefInt : public CBotInstr
{
public:
CBotInt();
~CBotInt();
CBotDefInt();
~CBotDefInt();
/*!
* \brief Compile
@ -58,7 +58,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotInt"; }
virtual const std::string GetDebugName() { return "CBotDefInt"; }
virtual std::map<std::string, CBotInstr*> GetDebugLinks();
private:

View File

@ -17,7 +17,8 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotIString.h"
#include "CBot/CBotInstr/CBotDefString.h"
#include "CBot/CBotInstr/CBotLeftExprVar.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
@ -30,32 +31,32 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotIString::CBotIString()
CBotDefString::CBotDefString()
{
m_var = nullptr;
m_expr = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotIString::~CBotIString()
CBotDefString::~CBotDefString()
{
delete m_var;
delete m_expr;
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
CBotInstr* CBotDefString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bool noskip)
{
CBotToken* pp = cont ? nullptr : p;
if (!cont && !IsOfType(p, ID_STRING)) return nullptr;
CBotIString* inst = static_cast<CBotIString*>(CompileArray(p, pStack, CBotTypString));
CBotDefString* inst = static_cast<CBotDefString*>(CompileArray(p, pStack, CBotTypString));
if (inst != nullptr || !pStack->IsOk()) return inst;
CBotCStack* pStk = pStack->TokenStack(pp);
inst = new CBotIString();
inst = new CBotDefString();
inst->m_expr = nullptr;
@ -93,7 +94,7 @@ CBotInstr* CBotIString::Compile(CBotToken* &p, CBotCStack* pStack, bool cont, bo
if (IsOfType(p, ID_COMMA))
{
if (nullptr != ( inst->m_next2b = CBotIString::Compile(p, pStk, true, noskip)))
if (nullptr != ( inst->m_next2b = CBotDefString::Compile(p, pStk, true, noskip)))
{
return pStack->Return(inst, pStk);
}
@ -113,7 +114,7 @@ error:
}
////////////////////////////////////////////////////////////////////////////////
bool CBotIString::Execute(CBotStack* &pj)
bool CBotDefString::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -134,7 +135,7 @@ bool CBotIString::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotIString::RestoreState(CBotStack* &pj, bool bMain)
void CBotDefString::RestoreState(CBotStack* &pj, bool bMain)
{
CBotStack* pile = pj;
@ -156,7 +157,7 @@ void CBotIString::RestoreState(CBotStack* &pj, bool bMain)
m_next2b->RestoreState(pile, bMain);
}
std::map<std::string, CBotInstr*> CBotIString::GetDebugLinks()
std::map<std::string, CBotInstr*> CBotDefString::GetDebugLinks()
{
auto links = CBotInstr::GetDebugLinks();
links["m_var"] = m_var;

View File

@ -27,19 +27,11 @@ namespace CBot
/**
* \brief Definition of a string variable - string a, b = "text";
*/
class CBotIString : public CBotInstr
class CBotDefString : public CBotInstr
{
public:
/*!
* \brief CBotIString
*/
CBotIString();
/*!
* \brief ~CBotIString
*/
~CBotIString();
CBotDefString();
~CBotDefString();
/*!
* \brief Compile
@ -66,7 +58,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotIString"; }
virtual const std::string GetDebugName() { return "CBotDefString"; }
virtual std::map<std::string, CBotInstr*> GetDebugLinks();
private:

View File

@ -17,7 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotExprBool.h"
#include "CBot/CBotInstr/CBotExprLitBool.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -28,25 +28,25 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprBool::CBotExprBool()
CBotExprLitBool::CBotExprLitBool()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprBool::~CBotExprBool()
CBotExprLitBool::~CBotExprLitBool()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotExprBool::Compile(CBotToken* &p, CBotCStack* pStack)
CBotInstr* CBotExprLitBool::Compile(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
CBotExprBool* inst = nullptr;
CBotExprLitBool* inst = nullptr;
if ( p->GetType() == ID_TRUE ||
p->GetType() == ID_FALSE )
{
inst = new CBotExprBool();
inst = new CBotExprLitBool();
inst->SetToken(p); // stores the operation false or true
p = p->GetNext();
@ -58,7 +58,7 @@ CBotInstr* CBotExprBool::Compile(CBotToken* &p, CBotCStack* pStack)
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprBool::Execute(CBotStack* &pj)
bool CBotExprLitBool::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -74,7 +74,7 @@ bool CBotExprBool::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprBool::RestoreState(CBotStack* &pj, bool bMain)
void CBotExprLitBool::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}

View File

@ -25,13 +25,13 @@ namespace CBot
{
/**
* \brief true/false constants
* \brief A boolean literal - true/false
*/
class CBotExprBool : public CBotInstr
class CBotExprLitBool : public CBotInstr
{
public:
CBotExprBool();
~CBotExprBool();
CBotExprLitBool();
~CBotExprLitBool();
/*!
* \brief Compile
@ -56,7 +56,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotExprBool"; }
virtual const std::string GetDebugName() { return "CBotExprLitBool"; }
};
} // namespace CBot

View File

@ -17,7 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotExprNan.h"
#include "CBot/CBotInstr/CBotExprLitNan.h"
#include "CBot/CBotStack.h"
@ -27,16 +27,16 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprNan::CBotExprNan()
CBotExprLitNan::CBotExprLitNan()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprNan::~CBotExprNan()
CBotExprLitNan::~CBotExprLitNan()
{
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprNan::Execute(CBotStack* &pj)
bool CBotExprLitNan::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -49,7 +49,7 @@ bool CBotExprNan::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprNan::RestoreState(CBotStack* &pj, bool bMain)
void CBotExprLitNan::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}

View File

@ -27,11 +27,11 @@ namespace CBot
/**
* \brief The "nan" constant
*/
class CBotExprNan : public CBotInstr
class CBotExprLitNan : public CBotInstr
{
public:
CBotExprNan();
~CBotExprNan();
CBotExprLitNan();
~CBotExprLitNan();
/*!
* \brief Execute Executes, returns null pointer.
@ -48,7 +48,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotExprNan"; }
virtual const std::string GetDebugName() { return "CBotExprLitNan"; }
virtual std::string GetDebugData() { return "nan"; }
};

View File

@ -17,7 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotExprNull.h"
#include "CBot/CBotInstr/CBotExprLitNull.h"
#include "CBot/CBotStack.h"
@ -27,17 +27,17 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprNull::CBotExprNull()
CBotExprLitNull::CBotExprLitNull()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprNull::~CBotExprNull()
CBotExprLitNull::~CBotExprLitNull()
{
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprNull::Execute(CBotStack* &pj)
bool CBotExprLitNull::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -50,7 +50,7 @@ bool CBotExprNull::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprNull::RestoreState(CBotStack* &pj, bool bMain)
void CBotExprLitNull::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}

View File

@ -27,11 +27,11 @@ namespace CBot
/**
* \brief The "null" constant
*/
class CBotExprNull : public CBotInstr
class CBotExprLitNull : public CBotInstr
{
public:
CBotExprNull();
~CBotExprNull();
CBotExprLitNull();
~CBotExprLitNull();
/*!
* \brief Execute Executes, returns an empty pointer.
@ -48,7 +48,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotExprNull"; }
virtual const std::string GetDebugName() { return "CBotExprLitNull"; }
virtual std::string GetDebugData() { return "null"; }
};

View File

@ -17,35 +17,35 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include <sstream>
#include "CBot/CBotInstr/CBotExprNum.h"
#include "CBot/CBotInstr/CBotExprLitNum.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotVar/CBotVar.h"
#include "CBot/CBotUtils.h"
#include <sstream>
namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprNum::CBotExprNum()
CBotExprLitNum::CBotExprLitNum()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprNum::~CBotExprNum()
CBotExprLitNum::~CBotExprLitNum()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotExprNum::Compile(CBotToken* &p, CBotCStack* pStack)
CBotInstr* CBotExprLitNum::Compile(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
CBotExprNum* inst = new CBotExprNum();
CBotExprLitNum* inst = new CBotExprLitNum();
inst->SetToken(p);
std::string s = p->GetString();
@ -80,7 +80,7 @@ CBotInstr* CBotExprNum::Compile(CBotToken* &p, CBotCStack* pStack)
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprNum::Execute(CBotStack* &pj)
bool CBotExprLitNum::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -103,6 +103,8 @@ bool CBotExprNum::Execute(CBotStack* &pj)
case CBotTypFloat:
var->SetValFloat(m_valfloat);
break;
default:
assert(false);
}
pile->SetVar(var); // place on the stack
@ -110,12 +112,12 @@ bool CBotExprNum::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprNum::RestoreState(CBotStack* &pj, bool bMain)
void CBotExprLitNum::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}
std::string CBotExprNum::GetDebugData()
std::string CBotExprLitNum::GetDebugData()
{
std::stringstream ss;
ss << "(" << (m_numtype == CBotTypFloat ? "float" : "int") << ") " << (m_numtype == CBotTypFloat ? m_valfloat : m_valint);

View File

@ -29,12 +29,12 @@ namespace CBot
*
* Can be of type ::CBotTypInt or ::CBotTypFloat
*/
class CBotExprNum : public CBotInstr
class CBotExprLitNum : public CBotInstr
{
public:
CBotExprNum();
~CBotExprNum();
CBotExprLitNum();
~CBotExprLitNum();
/*!
* \brief Compile
@ -59,7 +59,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotExprNum"; }
virtual const std::string GetDebugName() { return "CBotExprLitNum"; }
virtual std::string GetDebugData();
private:

View File

@ -17,7 +17,7 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotExprAlpha.h"
#include "CBot/CBotInstr/CBotExprLitString.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -28,21 +28,21 @@ namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotExprAlpha::CBotExprAlpha()
CBotExprLitString::CBotExprLitString()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotExprAlpha::~CBotExprAlpha()
CBotExprLitString::~CBotExprLitString()
{
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotExprAlpha::Compile(CBotToken* &p, CBotCStack* pStack)
CBotInstr* CBotExprLitString::Compile(CBotToken* &p, CBotCStack* pStack)
{
CBotCStack* pStk = pStack->TokenStack();
CBotExprAlpha* inst = new CBotExprAlpha();
CBotExprLitString* inst = new CBotExprLitString();
inst->SetToken(p);
p = p->GetNext();
@ -54,7 +54,7 @@ CBotInstr* CBotExprAlpha::Compile(CBotToken* &p, CBotCStack* pStack)
}
////////////////////////////////////////////////////////////////////////////////
bool CBotExprAlpha::Execute(CBotStack* &pj)
bool CBotExprLitString::Execute(CBotStack* &pj)
{
CBotStack* pile = pj->AddStack(this);
@ -73,12 +73,12 @@ bool CBotExprAlpha::Execute(CBotStack* &pj)
}
////////////////////////////////////////////////////////////////////////////////
void CBotExprAlpha::RestoreState(CBotStack* &pj, bool bMain)
void CBotExprLitString::RestoreState(CBotStack* &pj, bool bMain)
{
if (bMain) pj->RestoreStack(this);
}
std::string CBotExprAlpha::GetDebugData()
std::string CBotExprLitString::GetDebugData()
{
return m_token.GetString();
}

View File

@ -25,13 +25,13 @@ namespace CBot
{
/**
* \brief Expression representing a string literal - "Some text"
* \brief A string literal - "Some text"
*/
class CBotExprAlpha : public CBotInstr
class CBotExprLitString : public CBotInstr
{
public:
CBotExprAlpha();
~CBotExprAlpha();
CBotExprLitString();
~CBotExprLitString();
/*!
* \brief Compile
@ -56,7 +56,7 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
protected:
virtual const std::string GetDebugName() { return "CBotExprAlpha"; }
virtual const std::string GetDebugName() { return "CBotExprLitString"; }
virtual std::string GetDebugData();
};

View File

@ -19,22 +19,22 @@
#include "CBot/CBotInstr/CBotInstr.h"
#include "CBot/CBotInstr/CBotFor.h"
#include "CBot/CBotInstr/CBotDo.h"
#include "CBot/CBotInstr/CBotBreak.h"
#include "CBot/CBotInstr/CBotSwitch.h"
#include "CBot/CBotInstr/CBotTry.h"
#include "CBot/CBotInstr/CBotThrow.h"
#include "CBot/CBotInstr/CBotInt.h"
#include "CBot/CBotInstr/CBotFloat.h"
#include "CBot/CBotInstr/CBotWhile.h"
#include "CBot/CBotInstr/CBotIString.h"
#include "CBot/CBotInstr/CBotBoolean.h"
#include "CBot/CBotInstr/CBotDefArray.h"
#include "CBot/CBotInstr/CBotDefBoolean.h"
#include "CBot/CBotInstr/CBotDefClass.h"
#include "CBot/CBotInstr/CBotDefFloat.h"
#include "CBot/CBotInstr/CBotDefInt.h"
#include "CBot/CBotInstr/CBotDefString.h"
#include "CBot/CBotInstr/CBotDo.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotFor.h"
#include "CBot/CBotInstr/CBotIf.h"
#include "CBot/CBotInstr/CBotReturn.h"
#include "CBot/CBotInstr/CBotClassInst.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotInstArray.h"
#include "CBot/CBotInstr/CBotSwitch.h"
#include "CBot/CBotInstr/CBotThrow.h"
#include "CBot/CBotInstr/CBotTry.h"
#include "CBot/CBotInstr/CBotWhile.h"
#include "CBot/CBotVar/CBotVar.h"
@ -209,17 +209,17 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
return CBotThrow::Compile(p, pStack);
case ID_INT:
return CBotInt::Compile(p, pStack);
return CBotDefInt::Compile(p, pStack);
case ID_FLOAT:
return CBotFloat::Compile(p, pStack);
return CBotDefFloat::Compile(p, pStack);
case ID_STRING:
return CBotIString::Compile(p, pStack);
return CBotDefString::Compile(p, pStack);
case ID_BOOLEAN:
case ID_BOOL:
return CBotBoolean::Compile(p, pStack);
return CBotDefBoolean::Compile(p, pStack);
case ID_IF:
return CBotIf::Compile(p, pStack);
@ -254,7 +254,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
if (CBotClass::Find(p) != nullptr) // Does class with this name exist?
{
// Yes, compile the declaration of the instance
return CBotClassInst::Compile(p, pStack);
return CBotDefClass::Compile(p, pStack);
}
}
@ -336,12 +336,12 @@ CBotInstr* CBotInstr::CompileArray(CBotToken* &p, CBotCStack* pStack, CBotTypRes
// compiles an array declaration
if (first) return nullptr ;
CBotInstr* inst = CBotInstArray::Compile(p, pStack, type);
CBotInstr* inst = CBotDefArray::Compile(p, pStack, type);
if (inst == nullptr) return nullptr;
if (IsOfType(p, ID_COMMA)) // several definitions
{
if (nullptr != ( inst->m_next2b = CBotInstArray::CompileArray(p, pStack, type, false))) // compiles next one
if (nullptr != ( inst->m_next2b = CBotDefArray::CompileArray(p, pStack, type, false))) // compiles next one
{
return inst;
}

View File

@ -46,29 +46,29 @@ class CBotDebug;
* instr0000000001530870 [label=<<b>CBotExpression</b>>]
* instr0000000001530920 [label=<<b>CBotLeftExpr</b><br/>x>]
* instr00000000015309D0 [label=<<b>CBotIndexExpr</b>>]
* instr0000000001530DC0 [label=<<b>CBotExprNum</b><br/>(int) 1>]
* instr0000000001530DC0 [label=<<b>CBotExprLitNum</b><br/>(int) 1>]
* instr00000000015309D0 -> instr0000000001530DC0 [label="m_expr" weight=5]
* instr0000000001530920 -> instr00000000015309D0 [label="m_next3" weight=5]
* instr0000000001530870 -> instr0000000001530920 [label="m_leftop" weight=5]
* instr0000000001530E80 [label=<<b>CBotInstrArray</b><br/>int[][]>]
* instr00000000015315F0 [label=<<b>CBotInt</b>>]
* instr00000000015315F0 [label=<<b>CBotDefInt</b>>]
* instr0000000001531C20 [label=<<b>CBotLeftExprVar</b><br/>z>]
* instr00000000015315F0 -> instr0000000001531C20 [label="m_var" weight=5]
* instr0000000001530E80 -> instr00000000015315F0 [label="m_next2b" weight=5]
* { rank=same; instr0000000001530E80; instr00000000015315F0; }
* instr0000000001530B50 [label=<<b>CBotExprVar</b><br/>x>]
* instr0000000001531700 [label=<<b>CBotIndexExpr</b>>]
* instr0000000001531B60 [label=<<b>CBotExprNum</b><br/>(int) 1>]
* instr0000000001531B60 [label=<<b>CBotExprLitNum</b><br/>(int) 1>]
* instr0000000001531700 -> instr0000000001531B60 [label="m_expr" weight=5]
* instr0000000001530B50 -> instr0000000001531700 [label="m_next3" weight=5]
* instr0000000001531A00 [label=<<b>CBotExprNum</b><br/>(int) 10>]
* instr0000000001531A00 [label=<<b>CBotExprLitNum</b><br/>(int) 10>]
* instr0000000001530B50 -> instr0000000001531A00 [label="m_next3b" weight=5]
* instr0000000001530E80 -> instr0000000001530B50 [label="m_next3b" weight=5]
* instr0000000001530A80 [label=<<b>CBotLeftExprVar</b><br/>y>]
* instr0000000001530E80 -> instr0000000001530A80 [label="m_var" weight=5]
* instr0000000001530870 -> instr0000000001530E80 [label="m_next" weight=1]
* { rank=same; instr0000000001530870; instr0000000001530E80; }
* instr0000000001530C80 [label=<<b>CBotExprNum</b><br/>(int) 4>]
* instr0000000001530C80 [label=<<b>CBotExprLitNum</b><br/>(int) 4>]
* instr0000000001530870 -> instr0000000001530C80 [label="m_rightop" weight=5]
* instr00000000015304D0 -> instr0000000001530870 [label="m_next" weight=1]
* { rank=same; instr00000000015304D0; instr0000000001530870; }
@ -313,8 +313,8 @@ protected:
//! Counter of nested loops, to determine the break and continue valid.
static int m_LoopLvl;
friend class CBotClassInst;
friend class CBotInt;
friend class CBotDefClass;
friend class CBotDefInt;
friend class CBotListArray;
private:

View File

@ -17,15 +17,17 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include <sstream>
#include "CBotInstrCall.h"
#include "CBot/CBotInstr/CBotInstrCall.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotVar/CBotVar.h"
#include <sstream>
namespace CBot
{

View File

@ -21,7 +21,7 @@
#include "CBot/CBotInstr/CBotInstrUtils.h"
#include "CBot/CBotInstr/CBotExprNull.h"
#include "CBot/CBotInstr/CBotExprLitNull.h"
#include "CBot/CBotInstr/CBotTwoOpExpr.h"
#include "CBot/CBotStack.h"
@ -53,7 +53,7 @@ CBotInstr* CBotListArray::Compile(CBotToken* &p, CBotCStack* pStack, CBotTypResu
if (IsOfType( p, ID_NULL ))
{
CBotInstr* inst = new CBotExprNull ();
CBotInstr* inst = new CBotExprLitNull();
inst->SetToken(pp);
return pStack->Return(inst, pStk); // ok with empty element
}

View File

@ -17,12 +17,12 @@
* along with this program. If not, see http://gnu.org/licenses
*/
#include "CBot/CBotInstr/CBotListExpression.h"
#include "CBot/CBotInstr/CBotDefBoolean.h"
#include "CBot/CBotInstr/CBotDefFloat.h"
#include "CBot/CBotInstr/CBotDefInt.h"
#include "CBot/CBotInstr/CBotDefString.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotIString.h"
#include "CBot/CBotInstr/CBotFloat.h"
#include "CBotBoolean.h"
#include "CBot/CBotInstr/CBotInt.h"
#include "CBot/CBotInstr/CBotListExpression.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
@ -34,10 +34,10 @@ namespace CBot
/// Seeks a declaration of variable or expression
static CBotInstr* CompileInstrOrDefVar(CBotToken* &p, CBotCStack* pStack)
{
CBotInstr* i = CBotInt::Compile( p, pStack, false, true ); // Is this a declaration of an integer?
if ( i== nullptr ) i = CBotFloat::Compile( p, pStack, false, true ); // or a real number?
if ( i== nullptr ) i = CBotBoolean::Compile( p, pStack, false, true ); // or a boolean?
if ( i== nullptr ) i = CBotIString::Compile( p, pStack, false, true ); // ar a string?
CBotInstr* i = CBotDefInt::Compile(p, pStack, false, true ); // Is this a declaration of an integer?
if ( i== nullptr ) i = CBotDefFloat::Compile(p, pStack, false, true ); // or a real number?
if ( i== nullptr ) i = CBotDefBoolean::Compile(p, pStack, false, true ); // or a boolean?
if ( i== nullptr ) i = CBotDefString::Compile(p, pStack, false, true ); // ar a string?
if ( i== nullptr ) i = CBotExpression::Compile( p, pStack ); // compiles an expression
return i;
}

View File

@ -18,18 +18,19 @@
*/
#include "CBot/CBotInstr/CBotParExpr.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotExprLitBool.h"
#include "CBot/CBotInstr/CBotExprLitNan.h"
#include "CBot/CBotInstr/CBotExprLitNull.h"
#include "CBot/CBotInstr/CBotExprLitNum.h"
#include "CBot/CBotInstr/CBotExprLitString.h"
#include "CBot/CBotInstr/CBotExprUnaire.h"
#include "CBot/CBotInstr/CBotExprVar.h"
#include "CBot/CBotInstr/CBotInstrCall.h"
#include "CBot/CBotInstr/CBotNew.h"
#include "CBot/CBotInstr/CBotPostIncExpr.h"
#include "CBot/CBotInstr/CBotPreIncExpr.h"
#include "CBot/CBotInstr/CBotExprNum.h"
#include "CBot/CBotInstr/CBotExprAlpha.h"
#include "CBot/CBotInstr/CBotExprBool.h"
#include "CBot/CBotInstr/CBotNew.h"
#include "CBot/CBotInstr/CBotExprNull.h"
#include "CBot/CBotInstr/CBotExprNan.h"
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotVar/CBotVar.h"
@ -138,14 +139,14 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if (p->GetType() == TokenTypNum ||
p->GetType() == TokenTypDef )
{
CBotInstr* inst = CBotExprNum::Compile(p, pStk);
CBotInstr* inst = CBotExprLitNum::Compile(p, pStk);
return pStack->Return(inst, pStk);
}
// is this a chaine?
if (p->GetType() == TokenTypString)
{
CBotInstr* inst = CBotExprAlpha::Compile(p, pStk);
CBotInstr* inst = CBotExprLitString::Compile(p, pStk);
return pStack->Return(inst, pStk);
}
@ -153,7 +154,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
if (p->GetType() == ID_TRUE ||
p->GetType() == ID_FALSE )
{
CBotInstr* inst = CBotExprBool::Compile(p, pStk);
CBotInstr* inst = CBotExprLitBool::Compile(p, pStk);
return pStack->Return(inst, pStk);
}
@ -167,7 +168,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
// is a null pointer
if (IsOfType(p, ID_NULL))
{
CBotInstr* inst = new CBotExprNull ();
CBotInstr* inst = new CBotExprLitNull();
inst->SetToken(pp);
CBotVar* var = CBotVar::Create("", CBotTypNullPointer);
pStk->SetVar(var);
@ -177,7 +178,7 @@ CBotInstr* CBotParExpr::Compile(CBotToken* &p, CBotCStack* pStack)
// is a number nan
if (IsOfType(p, ID_NAN))
{
CBotInstr* inst = new CBotExprNan ();
CBotInstr* inst = new CBotExprLitNan();
inst->SetToken(pp);
CBotVar* var = CBotVar::Create("", CBotTypInt);
var->SetInit(CBotVar::InitType::IS_NAN);

View File

@ -36,11 +36,11 @@ namespace CBot
* * pre- or post- incremented or decremented variable -- CBotPreIncExpr, CBotPostIncExpr -- a++, ++a, a--, --a
* * a function call -- CBotInstrCall
* * a class method call -- CBotInstrMethode
* * number literal (or numerical constant from CBotToken::DefineNum()) -- CBotExprNum
* * string literal -- CBotExprAlpha
* * boolean literal -- CBotExprBool -- true/false
* * null -- CBotExprNull
* * nan -- CBotExprNan
* * number literal (or numerical constant from CBotToken::DefineNum()) -- CBotExprLitNum
* * string literal -- CBotExprLitString
* * boolean literal -- CBotExprLitBool -- true/false
* * null -- CBotExprLitNull
* * nan -- CBotExprLitNan
* * class instance creation with "new" -- CBotNew
*/
class CBotParExpr : public CBotInstr

View File

@ -19,7 +19,7 @@
#include "CBot/CBotVar/CBotVar.h"
#include "CBotExternalCall.h"
#include "CBot/CBotExternalCall.h"
#include "CBot/CBotStack.h"
#include "CBot/CBotCStack.h"
#include "CBot/CBotClass.h"

View File

@ -18,7 +18,6 @@
*/
#include "CBot/CBotStack.h"
#include "CBotExternalCall.h"
#include "CBot/CBotInstr/CBotFunction.h"
@ -27,6 +26,7 @@
#include "CBot/CBotFileUtils.h"
#include "CBot/CBotUtils.h"
#include "CBot/CBotExternalCall.h"
#include <cassert>
#include <cstdlib>

View File

@ -466,7 +466,7 @@ private:
CBotStack* m_next;
CBotStack* m_next2;
CBotStack* m_prev;
friend class CBotInstArray;
friend class CBotDefArray;
int m_state;
int m_step;

View File

@ -1,75 +1,75 @@
set(SOURCES
CBotUtils.cpp
CBotFileUtils.cpp
CBotCallMethode.cpp
CBotClass.cpp
CBotCStack.cpp
CBotDebug.cpp
CBotDefParam.cpp
CBotExternalCall.cpp
CBotFileUtils.cpp
CBotProgram.cpp
CBotStack.cpp
CBotCStack.cpp
CBotToken.cpp
CBotExternalCall.cpp
CBotDefParam.cpp
CBotCallMethode.cpp
CBotTypResult.cpp
CBotInstr/CBotInstr.cpp
CBotInstr/CBotInstrUtils.cpp
CBotInstr/CBotWhile.cpp
CBotInstr/CBotDo.cpp
CBotInstr/CBotFor.cpp
CBotInstr/CBotListExpression.cpp
CBotInstr/CBotSwitch.cpp
CBotInstr/CBotCase.cpp
CBotInstr/CBotBreak.cpp
CBotInstr/CBotTry.cpp
CBotInstr/CBotCatch.cpp
CBotInstr/CBotThrow.cpp
CBotInstr/CBotExprAlpha.cpp
CBotInstr/CBotExprNum.cpp
CBotInstr/CBotNew.cpp
CBotInstr/CBotExprNan.cpp
CBotInstr/CBotExprNull.cpp
CBotInstr/CBotExprBool.cpp
CBotInstr/CBotLeftExprVar.cpp
CBotInstr/CBotPreIncExpr.cpp
CBotInstr/CBotPostIncExpr.cpp
CBotInstr/CBotExprVar.cpp
CBotInstr/CBotInstrMethode.cpp
CBotInstr/CBotInstrCall.cpp
CBotInstr/CBotListInstr.cpp
CBotUtils.cpp
CBotInstr/CBotBlock.cpp
CBotInstr/CBotExprUnaire.cpp
CBotInstr/CBotParExpr.cpp
CBotInstr/CBotBoolExpr.cpp
CBotInstr/CBotLogicExpr.cpp
CBotInstr/CBotTwoOpExpr.cpp
CBotInstr/CBotExpression.cpp
CBotInstr/CBotIndexExpr.cpp
CBotInstr/CBotFieldExpr.cpp
CBotInstr/CBotLeftExpr.cpp
CBotInstr/CBotBreak.cpp
CBotInstr/CBotCase.cpp
CBotInstr/CBotCatch.cpp
CBotInstr/CBotCondition.cpp
CBotInstr/CBotClassInst.cpp
CBotInstr/CBotIString.cpp
CBotInstr/CBotFloat.cpp
CBotInstr/CBotBoolean.cpp
CBotInstr/CBotDefArray.cpp
CBotInstr/CBotDefBoolean.cpp
CBotInstr/CBotDefClass.cpp
CBotInstr/CBotDefFloat.cpp
CBotInstr/CBotDefInt.cpp
CBotInstr/CBotDefString.cpp
CBotInstr/CBotDo.cpp
CBotInstr/CBotEmpty.cpp
CBotInstr/CBotReturn.cpp
CBotInstr/CBotIf.cpp
CBotInstr/CBotListArray.cpp
CBotInstr/CBotInstArray.cpp
CBotInstr/CBotInt.cpp
CBotInstr/CBotExpression.cpp
CBotInstr/CBotExprLitBool.cpp
CBotInstr/CBotExprLitNan.cpp
CBotInstr/CBotExprLitNull.cpp
CBotInstr/CBotExprLitNum.cpp
CBotInstr/CBotExprLitString.cpp
CBotInstr/CBotExprUnaire.cpp
CBotInstr/CBotExprVar.cpp
CBotInstr/CBotFieldExpr.cpp
CBotInstr/CBotFor.cpp
CBotInstr/CBotFunction.cpp
CBotInstr/CBotIf.cpp
CBotInstr/CBotIndexExpr.cpp
CBotInstr/CBotInstrCall.cpp
CBotInstr/CBotInstr.cpp
CBotInstr/CBotInstrMethode.cpp
CBotInstr/CBotInstrUtils.cpp
CBotInstr/CBotLeftExpr.cpp
CBotInstr/CBotLeftExprVar.cpp
CBotInstr/CBotListArray.cpp
CBotInstr/CBotListExpression.cpp
CBotInstr/CBotListInstr.cpp
CBotInstr/CBotLogicExpr.cpp
CBotInstr/CBotNew.cpp
CBotInstr/CBotParExpr.cpp
CBotInstr/CBotPostIncExpr.cpp
CBotInstr/CBotPreIncExpr.cpp
CBotInstr/CBotReturn.cpp
CBotInstr/CBotSwitch.cpp
CBotInstr/CBotThrow.cpp
CBotInstr/CBotTry.cpp
CBotInstr/CBotTwoOpExpr.cpp
CBotInstr/CBotWhile.cpp
CBotVar/CBotVarArray.cpp
CBotVar/CBotVarPointer.cpp
CBotVar/CBotVarClass.cpp
CBotVar/CBotVarBoolean.cpp
CBotVar/CBotVarString.cpp
CBotVar/CBotVarClass.cpp
CBotVar/CBotVar.cpp
CBotVar/CBotVarFloat.cpp
CBotVar/CBotVarInt.cpp
CBotVar/CBotVar.cpp
stdlib/FileFunctions.cpp
stdlib/StringFunctions.cpp
stdlib/MathFunctions.cpp
CBotVar/CBotVarPointer.cpp
CBotVar/CBotVarString.cpp
stdlib/Compilation.cpp
stdlib/FileFunctions.cpp
stdlib/MathFunctions.cpp
stdlib/StringFunctions.cpp
)
# Includes