23 #include "CBot/CBotUtils.h" 100 const std::string& sep =
"",
146 void SetPos(
int start,
int end);
164 static std::unique_ptr<CBotToken>
CompileTokens(
const std::string& prog);
172 static bool DefineNum(
const std::string& name,
long val);
190 static CBotToken* NextToken(
const char*& program,
bool first);
196 long m_keywordId = -1;
199 std::string m_text =
"";
201 std::string m_sep =
"";
209 static std::map<std::string, long> m_defineNum;
216 static int GetKeyWord(
const std::string& w);
224 static bool GetDefineNum(
const std::string& name,
CBotToken* token);
bool IsOfType(CBotToken *&p, int type1, int type2)
Check if this token is of specified type.
Definition: CBotToken.cpp:482
static std::unique_ptr< CBotToken > CompileTokens(const std::string &prog)
Transforms a CBot program from a string to a list of tokens.
Definition: CBotToken.cpp:414
int GetStart()
Return the beginning location of this token in the original program string.
Definition: CBotToken.cpp:226
static bool DefineNum(const std::string &name, long val)
Define a new constant.
Definition: CBotToken.cpp:468
long GetKeywordId()
Get the keyword id.
Definition: CBotToken.cpp:208
int GetEnd()
Return the ending location of this token in the original program string.
Definition: CBotToken.cpp:233
const std::string & LoadString(TokenId id)
Maps given ID to its string equivalent.
Definition: CBotToken.cpp:124
Definition: CBotUtils.h:138
Some enum values used across the CBot engine.
const CBotToken & operator=(const CBotToken &src)
Copy operator.
Definition: CBotToken.cpp:178
std::string GetString()
Return the token string.
Definition: CBotToken.cpp:214
TokenId
This enum contains possible token types.
Definition: CBotEnums.h:73
static void ClearDefineNum()
Clear the list of defined constants.
Definition: CBotToken.cpp:172
int GetType()
Return the token type or the keyword id.
Definition: CBotToken.cpp:200
TokenType
Types of tokens.
Definition: CBotEnums.h:173
bool IsOfTypeList(CBotToken *&p, int type1,...)
Check if this token is of specified type.
Definition: CBotToken.cpp:494
void SetString(const std::string &name)
Set the token string.
Definition: CBotToken.cpp:220
CBot engine.
Definition: CBotCallMethode.cpp:28
CBotToken()
Default constructor.
Definition: CBotToken.cpp:139
a variable name
Definition: CBotEnums.h:179
~CBotToken()
Destructor.
Definition: CBotToken.cpp:167
Class representing one token of a program.
Definition: CBotToken.h:80
void SetPos(int start, int end)
SetPos Set the token position in the CBot program.
Definition: CBotToken.cpp:240