Loading...
Searching...
No Matches
CBot::CBotParExpr Class Reference

An expression. More...

`#include <src/CBot/CBotInstr/CBotParExpr.h>`

Inheritance diagram for CBot::CBotParExpr:
[legend]

## Static Public Member Functions

static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack, bool bConstExpr=false)
| Compile.
static CBotInstr * | CompileLitExpr (CBotToken *&p, CBotCStack *pStack)
| Compile a literal expression ("string", number, true, false, null, nan, new).
static CBotInstr * | CompileConstExpr (CBotToken *&p, CBotCStack *pStack)
Static Public Member Functions inherited from CBot::CBotInstr
static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack)
| Compile an instruction.
static CBotInstr * | CompileArray (CBotToken *&p, CBotCStack *pStack, CBotTypResult type, bool first=true)
| CompileArray.
static void | IncLvl (std::string &label)
| IncLvl Adds a level with a label.
static void | IncLvl ()
| IncLvl Adds a level (switch statement).
static void | DecLvl ()
| DecLvl Free a level.
static bool | ChkLvl (const std::string &label, int type)
| ChkLvl Control validity of break and continue.

## Additional Inherited Members

Public Member Functions inherited from CBot::CBotInstr
| CBotInstr ()
| Constructor.
virtual | ~CBotInstr ()
| Destructor.
virtual bool | Execute (CBotStack *&pj)
| Execute.
virtual bool | Execute (CBotStack *&pj, CBotVar *pVar)
| Execute.
virtual void | RestoreState (CBotStack *&pj, bool bMain)
| RestoreState.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotCStack *&pile)
| ExecuteVar.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotStack *&pile, CBotToken *prevToken, bool bStep, bool bExtend)
| ExecuteVar.
virtual void | RestoreStateVar (CBotStack *&pile, bool bMain)
| RestoreStateVar.
void | SetToken (CBotToken *p)
| SetToken Set the token corresponding to the instruction.
int | GetTokenType ()
| GetTokenType Return the type of the token assicated with the instruction.
CBotToken * | GetToken ()
| GetToken Return associated token.
void | AddNext (CBotInstr *n)
| AddNext Adds the statement following the other.
CBotInstr * | GetNext ()
| GetNext Returns next statement.
void | AddNext3 (CBotInstr *n)
| AddNext3.
CBotInstr * | GetNext3 ()
| GetNext3.
void | AddNext3b (CBotInstr *n)
| AddNext3b.
CBotInstr * | GetNext3b ()
| GetNext3b.
virtual bool | HasReturn ()
| Check a list of instructions for a return statement.
Protected Member Functions inherited from CBot::CBotInstr
virtual const std::string | GetDebugName ()=0
| Returns the name of this class.
virtual std::string | GetDebugData ()
| Returns additional data associated with this instruction for debugging purposes.
virtual std::map< std::string, CBotInstr * > | GetDebugLinks ()
Protected Attributes inherited from CBot::CBotInstr
CBotToken | m_token
| Keeps the token.
CBotInstr * | m_next
| Linked command.
CBotInstr * | m_next2b
| Second list definition chain.
CBotInstr * | m_next3
| Third list for indices and fields.
CBotInstr * | m_next3b
| Necessary for reporting tables.
Static Protected Attributes inherited from CBot::CBotInstr
static int | m_LoopLvl = 0
| Counter of nested loops, to determine the break and continue valid.

## Detailed Description

An expression.

There is never an instance of this class

Compiles either:

- an arithmetic expression in parentheses – CBotExpression – (...)
- unary operation – CBotExprUnaire – -a, +a, ~a, !a, not a
- a variable name – CBotExprVar
- 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()) – CBotExprLitNum
- string literal – CBotExprLitString
- boolean literal – CBotExprLitBool – true/false
- null – CBotExprLitNull
- nan – CBotExprLitNan
- class instance creation with "new" – CBotNew

## Member Function Documentation

## Compile()

CBotInstr * CBot::CBotParExpr::Compile | ( | CBotToken *& | p,
|  | CBotCStack * | pStack,
|  | bool | bConstExpr = false )

static

Compile.

Parameters

  p |
  pStack |

Returns

## CompileLitExpr()

CBotInstr * CBot::CBotParExpr::CompileLitExpr | ( | CBotToken *& | p,
|  | CBotCStack * | pStack )

static

Compile a literal expression ("string", number, true, false, null, nan, new).

Parameters

  p[in,out] | Pointer to first token of the expression, will be updated to point to first token after the expression
  pStack | Current compilation stack frame

Returns
  The compiled instruction or nullptr on error

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

- src/CBot/CBotInstr/CBotParExpr.h
- src/CBot/CBotInstr/CBotParExpr.cpp