26 #ifndef MU_PARSER_TOKEN_H
27 #define MU_PARSER_TOKEN_H
60 template<
typename TBase,
typename TString>
72 std::auto_ptr<ParserCallback> m_pCallback;
127 m_iCode = a_Tok.m_iCode;
128 m_pTok = a_Tok.m_pTok;
129 m_strTok = a_Tok.m_strTok;
130 m_iIdx = a_Tok.m_iIdx;
131 m_strVal = a_Tok.m_strVal;
132 m_iType = a_Tok.m_iType;
133 m_fVal = a_Tok.m_fVal;
135 m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0);
152 assert(a_iType!=
cmVAR);
153 assert(a_iType!=
cmVAL);
171 m_iCode = a_pCallback.
GetCode();
197 m_pCallback.reset(0);
214 m_pTok = (
void*)a_pVar;
215 m_pCallback.reset(0);
230 m_iIdx =
static_cast<int>(a_iSize);
233 m_pCallback.reset(0);
276 if (m_pCallback.get())
278 return m_pCallback->GetCode();
289 if (m_pCallback.get())
291 return m_pCallback->GetType();
302 if ( !m_pCallback.get())
308 return m_pCallback->GetPri();
314 if (m_pCallback.get()==NULL || m_pCallback->GetCode()!=
cmOPRT_BIN)
317 return m_pCallback->GetAssociativity();
350 case cmVAL:
return m_fVal;
351 case cmVAR:
return *((TBase*)m_pTok);
367 return (TBase*)m_pTok;
377 assert(m_pCallback.get());
379 if (!m_pCallback->GetAddr())
382 return m_pCallback->GetArgc();
user defined binary operator
ParserToken & SetVar(TBase *a_pVar, const TString &a_strTok)
make this token a variable token.
int GetArgCount() const
Return the number of function arguments.
TBase * GetVar() const
Get address of a variable token.
Internal error of any kind.
ParserToken & SetVal(TBase a_fVal, const TString &a_strTok=TString())
Make this token a value token.
void Assign(const ParserToken &a_Tok)
Copy token information from argument.
ParserToken & operator=(const ParserToken &a_Tok)
Assignement operator.
ECmdCode GetCode() const
Return the callback code.
ParserToken & SetString(const TString &a_strTok, std::size_t a_iSize)
Make this token a variable token.
Code for a generic function item.
EOprtAssociativity
Parser operator precedence values.
int GetIdx() const
Return Index associated with the token related data.
ETypeCode
Types internally used by the parser.
ParserToken()
Constructor (default).
Error class of the parser.
MUP_BASETYPE value_type
The numeric datatype used by the parser.
String type (Function arguments and constants only, no string variables)
A numerical function has been called with a non value type of argument.
ECmdCode GetCode() const
Return the token type.
Namespace for mathematical applications.
ParserToken & Set(ECmdCode a_iType, const TString &a_strTok=TString())
Assign a token type.
value_type(* generic_fun_type)()
Callback type used for functions without arguments.
Definition of the parser callback class.
void * GetAddr() const
Get the callback address for the parser function.
void SetIdx(int a_iIdx)
Set an index associated with the token related data.
Encapsulation of the data for a single formula token.
const TString & GetAsString() const
Return the token identifier.
generic_fun_type GetFuncAddr() const
Return the address of the callback function assoziated with function and operator tokens...
Floating point variables.
ParserToken(const ParserToken &a_Tok)
Create token from another one.
Encapsulation of prototypes for a numerical parser function.
ParserToken & Set(const ParserCallback &a_pCallback, const TString &a_sTok)
Set Callback type.
This file defines the error class used by the parser.