26#ifndef MU_PARSER_TOKEN_H
27#define MU_PARSER_TOKEN_H
60 template<
typename TBase,
typename TString>
150 assert(a_iType !=
cmVAR);
151 assert(a_iType !=
cmVAL);
152 assert(a_iType !=
cmFUNC);
228 m_iIdx =
static_cast<int>(a_iSize);
Encapsulation of prototypes for a numerical parser function.
void * GetAddr() const
Get the callback address for the parser function.
ECmdCode GetCode() const
Return the callback code.
Error class of the parser.
Encapsulation of the data for a single formula token.
ParserToken()
Constructor (default).
ECmdCode GetCode() const
Return the token type.
ParserToken(const ParserToken &a_Tok)
Create token from another one.
int m_iIdx
An otional index to an external buffer storing the token data.
ParserToken & operator=(const ParserToken &a_Tok)
Assignement operator.
void Assign(const ParserToken &a_Tok)
Copy token information from argument.
std::unique_ptr< ParserCallback > m_pCallback
ParserToken & SetString(const TString &a_strTok, std::size_t a_iSize)
Make this token a variable token.
void * m_pTok
Stores Token pointer; not applicable for all tokens.
TString m_strVal
Value for string variables.
ParserToken & SetVar(TBase *a_pVar, const TString &a_strTok)
make this token a variable token.
bool IsOptimizable() const
TBase * GetVar() const
Get address of a variable token.
ParserToken & Set(const ParserCallback &a_pCallback, const TString &a_sTok)
Set Callback type.
int GetArgCount() const
Return the number of function arguments.
generic_fun_type GetFuncAddr() const
Return the address of the callback function assoziated with function and operator tokens.
ParserToken & SetVal(TBase a_fVal, const TString &a_strTok=TString())
Make this token a value token.
TString m_strTok
Token string.
ETypeCode GetType() const
int GetIdx() const
Return Index associated with the token related data.
void SetIdx(int a_iIdx)
Set an index associated with the token related data.
ParserToken & Set(ECmdCode a_iType, const TString &a_strTok=TString())
Assign a token type.
value_type m_fVal
the value
const TString & GetAsString() const
Return the token identifier.
EOprtAssociativity GetAssociativity() const
ECmdCode m_iCode
Type of the token; The token type is a constant of type ECmdCode.
Definition of the parser callback class.
This file defines the error class used by the parser.
Namespace for mathematical applications.
MUP_BASETYPE value_type
The numeric datatype used by the parser.
@ cmSTRING
Code for a string token.
@ cmOPRT_INFIX
code for infix operators
@ cmOPRT_BIN
user defined binary operator
@ cmUNKNOWN
uninitialized item
@ cmFUNC
Code for a generic function item.
ETypeCode
Types internally used by the parser.
@ tpDBL
Floating point variables.
@ tpSTR
String type (Function arguments and constants only, no string variables)
@ ecVAL_EXPECTED
A numerical function has been called with a non value type of argument.
@ ecINTERNAL_ERROR
Internal error of any kind.
value_type(* generic_fun_type)()
Callback type used for functions without arguments.
EOprtAssociativity
Parser operator precedence values.