muParserX  2.0.0
Features

Feature overview

  • Supported data types: double, integer, complex, boolean, string, array
  • Extensible with custom operators (binary, infix or postfix)
  • Extensible with custom functions with an arbitrary number of function arguments
  • Support for an unlimited number of variables and constants
  • No limit on expression complexity
  • Reads binary, hexadecimal, complex, integer and string values from expressions and can be extended to read user defined values as well.
  • Supports a large variety of predefined Predefined Operators, Predefined Functions and Predefined Constants.

Predefined Constants

By default the parser supports the following mathematical constants:

  • The eulerian number with:
    e = 2.718281828459045235360287
     
  • The mathematical constant equal to a circle's circumference divided by its diameter.
    pi = 3.141592653589793238462643
     
  • The imaginary unit with:
    i = sqrt(-1)
     


Predefined Operators

Binary operators:

  • Standard operators:
    "+", "-", "*", "/", "^"
     
  • Assignment operators:
    "=", "+=", "-=", "*=", "/="
     
  • Logical operators:
    "and", "or", "xor","==", "!=", ">", "<", "<=", ">="
     
  • Bit manipulation:
    "&", "|", "<<", ">>"
     
  • String concatenation:
    "//"
     

Postfix operators:

  • Unit postfixes (nano, micro, milli, kilo, giga, mega):
    "{n}", "{mu}", "{m}", "{k}", "{G}", "{M}"
     

Infix operators:

  • Sign operator and type conversions:
    "-", "(float)", "(int)"
     

Predefined Functions

  • Standard functions:
    abs, sin, cos, tan, sinh, cosh, tanh, ln, log, log10, exp, sqrt
     
  • Unlimited number of arguments:
    min, max, sum
     
  • String functions:
    str2dbl, strlen, toupper
     
  • Complex functions:
    real, imag, conj, arg, norm
     
  • Array functions:
    sizeof
     


mup::IToken::GetCode
ECmdCode GetCode() const
return the token code.
Definition: mpIToken.cpp:205
mup::HexValReader::IsValue
virtual bool IsValue(const char_type *a_szExpr, int &a_iPos, Value &a_fVal)
Try to read a hex value from a given position in the expression.
Definition: mpValReader.cpp:168
mup::ParserXBase
Implementation of the parser engine.
Definition: mpParserBase.h:67
mup::oprt_ifx_maptype
std::map< string_type, ptr_tok_type > oprt_ifx_maptype
Type of a map for storing infix operators by their name.
Definition: mpTypes.h:142
mup::IValue::IsString
bool IsString() const
Returns true if this value is a string value.
Definition: mpIValue.h:172
mup::sfALLOW_NONE
@ sfALLOW_NONE
All of he above flags set.
Definition: mpTypes.h:240
mup::ParserTester::ParserTester
ParserTester(const ParserTester &a_Obj)
Copy constructor is deactivated.
Definition: mpTest.h:78
mup::PackageMatrix
Package for installing complex functions and operators.
Definition: mpPackageMatrix.h:45
mup::RPN::Finalize
void Finalize()
Definition: mpRPN.cpp:118
mup::IValueReader::Clone
virtual IValueReader * Clone(TokenReader *pParent) const =0
Clone this ValueReader object.
mup::OprtLE
Callback object class for the "Less or equal" operator.
Definition: mpOprtBinCommon.h:119
mup::ErrorContext::Errc
EErrorCodes Errc
Additional message
Definition: mpError.h:91
mup::ParserError::GetPos
int GetPos() const
Return the expression position related to the error.
Definition: mpError.cpp:248
mup::OprtLT
Callback object class for the "Less than" operator.
Definition: mpOprtBinCommon.h:93
mup::cmEOE
@ cmEOE
End of expression.
Definition: mpTypes.h:170
mup::OprtAssignDiv
Assignement operator.
Definition: mpOprtBinAssign.h:115
mup::ecDIV_BY_ZERO
@ ecDIV_BY_ZERO
Division by zero (currently unused)
Definition: mpTypes.h:337
mup::g_sCmdCode
const char_type * g_sCmdCode[]
Strings assigned to the enum codes of ECmdCode.
Definition: mpParserBase.cpp:52
mup::noNEWLINE
@ noNEWLINE
to avoid i.e. "a+\nb" or "sin(\na)"
Definition: mpTypes.h:237
mup::FunCmplxReal
Parser callback object for returning the real part of a complex number.
Definition: mpFuncCmplx.h:52
mup::BoolValReader::IsValue
virtual bool IsValue(const char_type *a_szExpr, int &a_iPos, Value &a_fVal)
Check a certain position in an expression for the presence of a value.
Definition: mpValReader.cpp:120
mup::prMUL_DIV
@ prMUL_DIV
multiplication/division
Definition: mpTypes.h:280
mup::ParserXBase::DefineConst
void DefineConst(const string_type &ident, const Value &val)
Define a parser Constant.
Definition: mpParserBase.cpp:428
mup::ValueCache
The ValueCache class provides a simple mechanism to recycle unused value items.
Definition: mpValueCache.h:54
mup::ParserMessageProviderBase
Base class for Parser Message providing classes.
Definition: mpParserMessageProvider.h:16
mup::FunParserID
Parser function callback for determining the size of an array.
Definition: mpFuncCommon.h:48
mup::cmSCRIPT_FOR
@ cmSCRIPT_FOR
Reserved for future use.
Definition: mpTypes.h:179
mup::FunCmplxSin
Definition: mpFuncCmplx.h:129
mup::ParserXBase::ClearOprt
void ClearOprt()
Clear all user defined binary operators.
Definition: mpParserBase.cpp:1228
mup::ICallback::SetParent
void SetParent(parent_type *a_pParent)
Assign a parser object to the callback.
Definition: mpICallback.cpp:106
mup::FunCos
Definition: mpFuncNonCmplx.h:59
mup::Stack::push
void push(const value_type &a_Val)
Push an object into the stack.
Definition: mpStack.h:111
su
Namespace containing utility functions and classes for string processing.
Definition: suSortPred.h:40
mup::ecOVERFLOW
@ ecOVERFLOW
Overflow (possibly) occurred.
Definition: mpTypes.h:345
mup::cmELSE
@ cmELSE
Ternary if then else operator.
Definition: mpTypes.h:162
su::TokenNotFound
Definition: suStringTokens.h:49
mup::noCBC
@ noCBC
No opening closing bracket.
Definition: mpTypes.h:226
mup::TokenReader::GetPos
int GetPos() const
Return the current position of the token reader in the formula string.
Definition: mpTokenReader.cpp:205
mup::noIFX
@ noIFX
to avoid i.e. "++4" "!!4"
Definition: mpTypes.h:233
mup::cmBC
@ cmBC
Operator item: closing bracket.
Definition: mpTypes.h:155
mup::FunAbs
Definition: mpFuncNonCmplx.h:82
mup::ParserXBase::m_PostOprtDef
oprt_pfx_maptype m_PostOprtDef
Postfix operator callbacks.
Definition: mpParserBase.h:153
mup::Variable::Variable
Variable(IValue *pVal)
Create a variable and bind a value to it.
Definition: mpVariable.cpp:51
mup::oprt_pfx_maptype
std::map< string_type, ptr_tok_type > oprt_pfx_maptype
Type of a map for storing postfix operators by their name.
Definition: mpTypes.h:139
mup::ParserXBase::DefineNameChars
void DefineNameChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of functions, variables, constants.
Definition: mpParserBase.cpp:258
mup::ecUNDEFINED
@ ecUNDEFINED
Undefined message, placeholder to detect unassigned error messages.
Definition: mpTypes.h:363
mup::IOprtInfix
Interface for unary infix operators.
Definition: mpIOprt.h:97
mup::ecUNEXPECTED_VAR
@ ecUNEXPECTED_VAR
An unexpected variable token has been found.
Definition: mpTypes.h:300
mup::FunAtan2
Definition: mpFuncNonCmplx.h:97
mup::OprtColon
Definition: mpOprtMatrix.h:71
mup::ParserXBase::GetConst
const val_maptype & GetConst() const
Return a map containing all parser constants.
Definition: mpParserBase.cpp:597
mup::noOPT
@ noOPT
to avoid i.e. "(+)"
Definition: mpTypes.h:231
mup::Stack::top
value_type & top()
Return reference to the top object in the stack.
Definition: mpStack.h:135
mup::ParserXBase::GetFunDef
const fun_maptype & GetFunDef() const
Return prototypes of all parser functions.
Definition: mpParserBase.cpp:613
mup::FunStrToDbl
Parse string to a floating point value.
Definition: mpFuncStr.h:83
mup::val_maptype
std::map< string_type, ptr_tok_type > val_maptype
type of a container used to store parser values.
Definition: mpTypes.h:127
mup::IValueReader::SetParent
virtual void SetParent(TokenReader *pTokenReader)
Assign this value reader object to a token reader object.
Definition: mpIValReader.cpp:59
mup::EErrorCodes
EErrorCodes
Error codes.
Definition: mpTypes.h:293
mup::FunMatrixEye
Parser callback object for creating unity matrices.
Definition: mpFuncMatrix.h:78
mup::Variable
The variable class represents a parser variable.
Definition: mpVariable.h:52
mup::BoolValReader::Clone
virtual IValueReader * Clone(TokenReader *pTokenReader) const
Clone this ValueReader object.
Definition: mpValReader.cpp:141
mup::prPOW
@ prPOW
power operator priority (highest)
Definition: mpTypes.h:281
mup::PackageNonCmplx
Package for installing complex functions and operators.
Definition: mpPackageNonCmplx.h:45
mup::ecUNEXPECTED_CURLY_BRACKET
@ ecUNEXPECTED_CURLY_BRACKET
Invalid use of the index operator.
Definition: mpTypes.h:322
mup::IToken::GetIdent
const string_type & GetIdent() const
Return the token identifier string.
Definition: mpIToken.cpp:212
mup::FunACosH
Definition: mpFuncNonCmplx.h:71
mup::OprtIndex
Default implementation of a multidimensional index operator.
Definition: mpOprtIndex.h:55
mup::cmFUNC
@ cmFUNC
Code for a function item.
Definition: mpTypes.h:166
mup::FunCmplxConj
Parser callback object for returning the complex conjugate of the complex number.
Definition: mpFuncCmplx.h:80
mup::cmSCRIPT_IF
@ cmSCRIPT_IF
Reserved for future use.
Definition: mpTypes.h:180
mup::cmSCRIPT_ENDIF
@ cmSCRIPT_ENDIF
Reserved for future use.
Definition: mpTypes.h:183
mup::Variable::GetPtr
IValue * GetPtr() const
Returns the Value pointer bound to this variable.
Definition: mpVariable.cpp:194
mup::FunTanH
Definition: mpFuncNonCmplx.h:68
mup::ecCONSTANT_DEFINED
@ ecCONSTANT_DEFINED
Constant is already defined.
Definition: mpTypes.h:355
mup::ParserXBase::ValidOprtChars
const char_type * ValidOprtChars() const
Virtual function that defines the characters allowed in operator definitions.
Definition: mpParserBase.cpp:299
mup::OprtCastToInt
Callback for an operator allowing to cast values to integer values.
Definition: mpOprtBinCommon.h:237
mup::OprtMilli
Definition: mpPackageUnit.h:53
mup::FunSizeOf
Parser function callback for determining the size of an array.
Definition: mpFuncCommon.h:100
mup::FunCmplxSqrt
Definition: mpFuncCmplx.h:179
mup::IValue::IsScalar
bool IsScalar() const
Returns true if the type is not a vector and not a string.
Definition: mpIValue.h:133
mup::OprtSignPos
Callback for the positive sign operator for noncomplex values.
Definition: mpOprtNonCmplx.h:69
mup::ParserXBase::operator=
ParserXBase & operator=(const ParserXBase &a_Parser)
Assignement operator.
Definition: mpParserBase.cpp:177
mup::OprtMul
Callback object for implementing the multiplications of noncomplex values.
Definition: mpOprtNonCmplx.h:108
mup::FunCmplxArg
Parser callback object for returning the phase angle (or angular component) of a complex number,...
Definition: mpFuncCmplx.h:95
mup::TokenReader::GetUsedVar
const var_maptype & GetUsedVar() const
Return a map containing the used variables only.
Definition: mpTokenReader.cpp:223
mup::OprtMicro
Definition: mpPackageUnit.h:52
mup::ParserXBase::GetVersion
static string_type GetVersion()
Get the version number of muParserX.
Definition: mpParserBase.cpp:629
mup::StrValReader
A class for reading strings from an expression string.
Definition: mpValReader.h:125
mup::FunPow
Definition: mpFuncNonCmplx.h:95
mup::IOprtBin
Interface for binary operators.
Definition: mpIOprt.h:57
mup::cmOPRT_POSTFIX
@ cmOPRT_POSTFIX
Postfix operator.
Definition: mpTypes.h:169
mup::ParserMessageProviderEnglish
English versions of parser messages.
Definition: mpParserMessageProvider.h:40
mup::Stack::size
unsigned size() const
Return the number of stored elements.
Definition: mpStack.h:118
mup::ParserXBase::AddValueReader
void AddValueReader(IValueReader *a_pReader)
Add a value reader object to muParserX.
Definition: mpParserBase.cpp:358
mup::ParserXBase::ValidNameChars
const char_type * ValidNameChars() const
Virtual function that defines the characters allowed in name identifiers.
Definition: mpParserBase.cpp:289
mup::ErrorContext::Type2
char_type Type2
For type conflicts only! This is the type that was actually found.
Definition: mpError.h:93
mup::cmOPRT_INFIX
@ cmOPRT_INFIX
Infix operator.
Definition: mpTypes.h:168
mup::FunLog2
Definition: mpFuncNonCmplx.h:76
mup::console_in
std::istream & console_in()
Encapsulate cin.
Definition: mpTypes.h:397
mup::FunCmplxLn
Definition: mpFuncCmplx.h:200
mup::ParserXBase::ClearVar
void ClearVar()
Clear all user defined variables.
Definition: mpParserBase.cpp:1173
mup::noBO
@ noBO
to avoid i.e. "cos(7)("
Definition: mpTypes.h:221
mup::ecINVALID_FUN_PTR
@ ecINVALID_FUN_PTR
Invalid callback function pointer.
Definition: mpTypes.h:326
mup::FunMin::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
Returns the minimum value of all values.
Definition: mpFuncCommon.cpp:142
mup::ptr_tok_type
TokenPtr< IToken > ptr_tok_type
Type of a managed pointer storing parser tokens.
Definition: mpTypes.h:71
mup::FunSin
Definition: mpFuncNonCmplx.h:58
mup::prRELATIONAL2
@ prRELATIONAL2
Relational operators "<", "<=", ">", ">=".
Definition: mpTypes.h:274
mup::prSHIFT
@ prSHIFT
Shift operators "<<", ">>".
Definition: mpTypes.h:275
mup::FunLog10
Definition: mpFuncNonCmplx.h:75
mup::ecUNEXPECTED_OPERATOR
@ ecUNEXPECTED_OPERATOR
Unexpected binary operator found.
Definition: mpTypes.h:295
mup::console
std::ostream & console()
Encapsulate cout.
Definition: mpTypes.h:388
mup::ecSTRING_EXPECTED
@ ecSTRING_EXPECTED
A string function has been called with a different type of argument.
Definition: mpTypes.h:305
mup::ParserXBase::ParserXBase
ParserXBase()
Default constructor.
Definition: mpParserBase.cpp:108
mup::ECmdCode
ECmdCode
Bytecode values.
Definition: mpTypes.h:150
mup::TokenReader::SetExpr
void SetExpr(const string_type &a_sExpr)
Initialize the token Reader.
Definition: mpTokenReader.cpp:234
mup::Variable::GetType
virtual char_type GetType() const
Returns a character representing the type of the variable.
Definition: mpVariable.cpp:185
mup::noPFX
@ noPFX
to avoid i.e. "(5!!)" "sin!"
Definition: mpTypes.h:232
mup::ecINTERNAL_ERROR
@ ecINTERNAL_ERROR
Internal error of any kind.
Definition: mpTypes.h:359
mup::ParserXBase::CheckName
void CheckName(const string_type &a_sName, const string_type &a_CharSet) const
Check if a given name contains invalid characters.
Definition: mpParserBase.cpp:369
mup::ParserXBase::GetExprVar
const var_maptype & GetExprVar() const
Return a map containing the used variables only.
Definition: mpParserBase.cpp:578
mup::var_maptype
std::map< string_type, ptr_tok_type > var_maptype
type for the parser variable storage.
Definition: mpTypes.h:124
mup::cmVAL
@ cmVAL
value item
Definition: mpTypes.h:165
mup::EOprtAsct
EOprtAsct
Binary operator associativity values.
Definition: mpTypes.h:246
mup::noIO
@ noIO
No opening bracket "[".
Definition: mpTypes.h:223
mup::BoolValReader
A class for reading boolean values from an expression string.
Definition: mpValReader.h:72
mup::ecMISSING_PARENS
@ ecMISSING_PARENS
Missing parens. (Example: "3*sin(3")
Definition: mpTypes.h:307
mup::StrValReader::IsValue
virtual bool IsValue(const char_type *a_szExpr, int &a_iPos, Value &a_fVal)
Check a certain position in an expression for the presence of a value.
Definition: mpValReader.cpp:329
mup::TokenPtr
Definition: mpFwdDecl.h:51
mup::prRELATIONAL1
@ prRELATIONAL1
For "==", "!=".
Definition: mpTypes.h:273
mup::OprtMulCmplx
Callback object for implementing the multiplications of complex values.
Definition: mpOprtCmplx.h:95
mup::ParserError::GetToken
const string_type & GetToken() const
Return string related with this token (if available).
Definition: mpError.cpp:255
mup::int_type
int int_type
Parser datatype for integer valuse.
Definition: mpTypes.h:97
mup::PackageCommon
Package for installing operators and functions which are always present.
Definition: mpPackageCommon.h:47
mup::ICallback::GetParent
parent_type * GetParent()
Returns a pointer to the parser object owning this callback.
Definition: mpICallback.cpp:77
mup::char_type
string_type::value_type char_type
Character type of the parser.
Definition: mpTypes.h:116
mup::OprtNano
Definition: mpPackageUnit.h:51
mup::ParserError
Error class of the parser.
Definition: mpError.h:105
mup::IValueReader
Interface for custom value reader objects.
Definition: mpIValReader.h:59
mup::ecTOO_FEW_PARAMS
@ ecTOO_FEW_PARAMS
Too few function parameters. (Example: "ite(1<2,2)")
Definition: mpTypes.h:313
mup::OprtShl
Callback class for the shift left operator.
Definition: mpOprtBinCommon.h:197
mup::FunCmplxLog2
Definition: mpFuncCmplx.h:230
mup::noEND
@ noEND
to avoid unexpected end of expression
Definition: mpTypes.h:234
mup::OprtMega
Definition: mpPackageUnit.h:55
mup::cmIO
@ cmIO
Operator item: index operator opening.
Definition: mpTypes.h:156
mup::ptr_val_type
TokenPtr< IValue > ptr_val_type
Type of a managed pointer storing value tokens.
Definition: mpTypes.h:80
mup::IValue::IsInteger
bool IsInteger() const
Returns true if this value is a noncomplex integer.
Definition: mpIValue.h:143
mup::cmIC
@ cmIC
Operator item: index operator closing.
Definition: mpTypes.h:157
mup::OprtEQ
Callback object for testing if two values are equal.
Definition: mpOprtBinCommon.h:66
mup::IValue::IsComplex
bool IsComplex() const
Returns true if this value is a complex value.
Definition: mpIValue.h:163
mup::cmARG_SEP
@ cmARG_SEP
Operator item: comma.
Definition: mpTypes.h:160
mup::PackageStr
Package for installing unit postfix operators into muParserX.
Definition: mpPackageStr.h:46
mup::cmUNKNOWN
@ cmUNKNOWN
uninitialized item
Definition: mpTypes.h:187
mup::FunMax
Determine maximal value from the parameter list.
Definition: mpFuncCommon.h:61
mup::Stack
Parser stack implementation.
Definition: mpStack.h:54
mup::prPOSTFIX
@ prPOSTFIX
Postfix operator priority (currently unused)
Definition: mpTypes.h:285
mup::ecUNEXPECTED_PARENS
@ ecUNEXPECTED_PARENS
Unexpected Parenthesis, opening or closing.
Definition: mpTypes.h:301
mup::ParserXBase::ClearFun
void ClearFun()
Clear all function definitions.
Definition: mpParserBase.cpp:1196
mup::ParserXBase::GetOprtDef
const char_type ** GetOprtDef() const
Return the strings of all Operator identifiers.
Definition: mpParserBase.cpp:249
mup::float_type
double float_type
Parser datatype for floating point value.
Definition: mpTypes.h:94
mup::ecTYPE_CONFLICT_FUN
@ ecTYPE_CONFLICT_FUN
Function argument type conflict.
Definition: mpTypes.h:315
mup::FunCmplxPow
Definition: mpFuncCmplx.h:251
mup::ParserTester::~ParserTester
~ParserTester()
Destructor (trivial).
Definition: mpTest.h:75
mup::ParserXBase::DefinePostfixOprt
void DefinePostfixOprt(const TokenPtr< IOprtPostfix > &oprt)
Add a user defined operator.
Definition: mpParserBase.cpp:473
mup::OprtAssignMul
Assignement operator.
Definition: mpOprtBinAssign.h:101
mup::FunCmplxTanH
Definition: mpFuncCmplx.h:169
mup::Value::GetComplex
virtual const cmplx_type & GetComplex() const
Returns this value as a complex number.
Definition: mpValue.cpp:662
mup::DblValReader
A class for reading floating point values from an expression string.
Definition: mpValReader.h:54
mup::ParserXBase::m_InfixOprtDef
oprt_ifx_maptype m_InfixOprtDef
Infix operator callbacks.
Definition: mpParserBase.h:154
mup::cmCBO
@ cmCBO
Operator item: curly bracket (opening)
Definition: mpTypes.h:158
mup::ecVAL_EXPECTED
@ ecVAL_EXPECTED
A numerical function has been called with a non value type of argument.
Definition: mpTypes.h:306
mup::ESynCodes
ESynCodes
Syntax codes.
Definition: mpTypes.h:220
mup::FunCbrt
Definition: mpFuncNonCmplx.h:80
mup::FunLog
Definition: mpFuncNonCmplx.h:74
mup::ErrorContext::Arg
int Arg
For type conflicts only! This is the type that was expected.
Definition: mpError.h:94
mup::OprtIndex::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *arg, int argc)
Index operator implementation.
Definition: mpOprtIndex.cpp:53
mup::ecUNEXPECTED_EOF
@ ecUNEXPECTED_EOF
Unexpected end of expression. (Example: "2+sin(")
Definition: mpTypes.h:297
mup::operator<<
std::ostream & operator<<(std::ostream &a_Stream, const IToken &tok)
Overloaded streaming operator for outputting the value type into an std::ostream.
Definition: mpIToken.cpp:60
mup::cmENDIF
@ cmENDIF
Ternary if then else operator.
Definition: mpTypes.h:163
mup::StrValReader::Clone
virtual IValueReader * Clone(TokenReader *pTokenReader) const
Clone this ValueReader object.
Definition: mpValReader.cpp:340
mup::TokenReader::~TokenReader
~TokenReader()
Destructor (trivial).
Definition: mpTokenReader.cpp:149
mup::Value::operator*=
virtual IValue & operator*=(const IValue &val)
Assign a value with multiplication.
Definition: mpValue.cpp:528
mup::ecUNEXPECTED_FUN
@ ecUNEXPECTED_FUN
Unexpected function found. (Example: "sin(8)cos(9)")
Definition: mpTypes.h:310
mup::cmCBC
@ cmCBC
Operator item: curly bracket (closing)
Definition: mpTypes.h:159
mup::ParserXBase::ValidInfixOprtChars
const char_type * ValidInfixOprtChars() const
Virtual function that defines the characters allowed in infix operator definitions.
Definition: mpParserBase.cpp:309
mup::IValue::IsMatrix
bool IsMatrix() const
Returns true if this value is an array.
Definition: mpIValue.h:154
mup::OprtPowCmplx
Raise x to the power of y.
Definition: mpOprtCmplx.h:121
mup::ICallback::GetArgc
int GetArgc() const
Returns the m´number of arguments required by this callback.
Definition: mpICallback.cpp:93
mup::PackageUnit
Package for installing unit postfix operators into muParserX.
Definition: mpPackageUnit.h:63
mup::FunCmplxLog10
Definition: mpFuncCmplx.h:220
mup::cmSCRIPT_WHILE
@ cmSCRIPT_WHILE
Reserved for future use.
Definition: mpTypes.h:176
mup::noCBO
@ noCBO
No opening curly bracket.
Definition: mpTypes.h:225
mup::ecNOT_AN_ARRAY
@ ecNOT_AN_ARRAY
Using the index operator on a scalar variable.
Definition: mpTypes.h:320
mup::ParserError::GetCode
EErrorCodes GetCode() const
Return the error code.
Definition: mpError.cpp:262
mup::ecTYPE_CONFLICT
@ ecTYPE_CONFLICT
Generic type conflict.
Definition: mpTypes.h:314
mup::ErrorContext::ErrorContext
ErrorContext(EErrorCodes a_iErrc=ecUNDEFINED, int a_iPos=-1, string_type a_sIdent=string_type())
Creates an empty ErrorContext object.
Definition: mpError.cpp:87
mup::FunATan
Definition: mpFuncNonCmplx.h:64
mup::TokenReader::Clone
TokenReader * Clone(ParserXBase *a_pParent) const
Create instance of a ParserTokenReader identical with this and return its pointer.
Definition: mpTokenReader.cpp:173
mup::Value
Value class of muParserX.
Definition: mpValue.h:56
mup::string_type
std::string string_type
Parser datatype for strings.
Definition: mpTypes.h:113
mup::OprtGiga
Definition: mpPackageUnit.h:56
mup::TokenReader::ReInit
void ReInit()
Reset the token reader to the start of the formula.
Definition: mpTokenReader.cpp:249
mup::ParserXBase::ClearConst
void ClearConst()
Clear all user defined constants.
Definition: mpParserBase.cpp:1208
mup::ecCOUNT
@ ecCOUNT
This is no error code, It just stores just the total number of error codes.
Definition: mpTypes.h:362
mup::oprt_bin_maptype
std::map< string_type, ptr_tok_type, su::pred::SortByLength< string_type > > oprt_bin_maptype
Type of a container that binds Callback object pointer to operator identifiers.
Definition: mpTypes.h:136
mup::FunStrToUpper
Convert a string to upper case letters.
Definition: mpFuncStr.h:57
mup::OprtFact
Calculate factorial of a non-negative integer.
Definition: mpOprtPostfixCommon.h:25
mup::ecASSIGNEMENT_TO_VALUE
@ ecASSIGNEMENT_TO_VALUE
Assignment to operator (3=4 instead of a=4)
Definition: mpTypes.h:333
mup::noBC
@ noBC
to avoid i.e. "sin)" or "()"
Definition: mpTypes.h:222
mup::IValue::GetDim
int GetDim() const
Returns the dimension of the value represented by a value object.
Definition: mpIValue.h:111
mup::TokenIfThenElse
A class for encapsulation if-then-else tokens.
Definition: mpIfThenElse.h:52
mup
Namespace for mathematical applications.
Definition: mpError.cpp:36
mup::ParserXBase::GetExpr
const string_type & GetExpr() const
Retrieve the mathematical expression.
Definition: mpParserBase.cpp:620
mup::cmSCRIPT_GOTO
@ cmSCRIPT_GOTO
Reserved for future use.
Definition: mpTypes.h:177
mup::Value::GetType
virtual char_type GetType() const
Returns a character representing the type of this value instance.
Definition: mpValue.cpp:578
mup::OprtPow
Raise x to the power of y.
Definition: mpOprtNonCmplx.h:134
mup::PackageCmplx
Package for installing complex functions and operators.
Definition: mpPackageCmplx.h:45
mup::fun_maptype
std::map< string_type, ptr_tok_type > fun_maptype
Type of a container that binds Callback object pointer to operator identifiers.
Definition: mpTypes.h:131
mup::ecUNTERMINATED_STRING
@ ecUNTERMINATED_STRING
unterminated string constant. (Example: "3*valueof("hello)")
Definition: mpTypes.h:311
mup::ecUNEXPECTED_COMMA
@ ecUNEXPECTED_COMMA
An unexpected comma has been found. (Example: "1,23")
Definition: mpTypes.h:298
mup::FunMatrixZeros
Parser callback object for creating matrices consisting entirely of zeros.
Definition: mpFuncMatrix.h:64
mup::ParserXBase::DefineOprt
void DefineOprt(const TokenPtr< IOprtBin > &oprt)
Define a binary operator.
Definition: mpParserBase.cpp:458
mup::ParserErrorMsg
Definition: mpError.h:49
mup::IValueReader::IsValue
virtual bool IsValue(const char_type *a_szExpr, int &a_iPos, Value &a_Val)=0
Check a certain position in an expression for the presence of a value.
mup::ParserXBase::~ParserXBase
virtual ~ParserXBase()
Destructor.
Definition: mpParserBase.cpp:160
mup::IValue::IsNonComplexScalar
bool IsNonComplexScalar() const
Returns true if the type is either floating point or interger.
Definition: mpIValue.h:123
mup::ecGENERIC
@ ecGENERIC
Generic error.
Definition: mpTypes.h:338
mup::ecINVALID_PARAMETER
@ ecINVALID_PARAMETER
Invalid function parameter.
Definition: mpTypes.h:328
mup::ICallback
Interface for callback objects.
Definition: mpICallback.h:54
mup::OprtLOr
Callback class for a logical or operator.
Definition: mpOprtBinCommon.h:171
mup::OprtAssignSub
Assignement operator.
Definition: mpOprtBinAssign.h:87
mup::cmIF
@ cmIF
Ternary if then else operator.
Definition: mpTypes.h:161
mup::OprtPercentage
Returns percentage of given number.
Definition: mpOprtPostfixCommon.h:40
mup::ParserXBase::EnableDebugDump
static void EnableDebugDump(bool bDumpCmd, bool bDumpRPN)
Enable the dumping of bytecode amd stack content on the console.
Definition: mpParserBase.cpp:1263
su::pred::SortByLength
Sort two strings based on their length.
Definition: suSortPred.h:48
mup::RPN
A class representing the reverse polnish notation of the expression.
Definition: mpRPN.h:46
mup::HexValReader
A class for reading hex values from an expression string.
Definition: mpValReader.h:90
mup::FunCmplxNorm
Parser callback object for returning the norm value of the complex number phase angle.
Definition: mpFuncCmplx.h:109
mup::OprtStrAdd
Definition: mpOprtBinCommon.h:53
mup::noIC
@ noIC
No closing bracket "]".
Definition: mpTypes.h:224
mup::ParserXBase::m_FunDef
fun_maptype m_FunDef
Function definitions.
Definition: mpParserBase.h:152
mup::FunATanH
Definition: mpFuncNonCmplx.h:72
mup::OprtLAnd
Callback class for a logical and operator.
Definition: mpOprtBinCommon.h:184
mup::FunCmplxSinH
Definition: mpFuncCmplx.h:149
mup::ecINVALID_TYPECAST
@ ecINVALID_TYPECAST
Invalid Value token cast.
Definition: mpTypes.h:318
mup::OprtDivCmplx
Callback object for implementing the division of complex values.
Definition: mpOprtCmplx.h:108
mup::OprtNEQ
Callback object for testing if two values are not equal.
Definition: mpOprtBinCommon.h:80
mup::FunCmplxCos
Definition: mpFuncCmplx.h:119
mup::noFUN
@ noFUN
to avoid i.e. "sqrt cos" or "(1)sin"
Definition: mpTypes.h:230
mup::FunCmplxTan
Definition: mpFuncCmplx.h:159
mup::ParserXBase::SetExpr
void SetExpr(const string_type &a_sExpr)
Set the mathematical expression.
Definition: mpParserBase.cpp:388
MatrixError
Definition: mpMatrixError.h:41
mup::TokenNewline
A class for encapsulation a newline token.
Definition: mpScriptTokens.h:47
mup::FunASinH
Definition: mpFuncNonCmplx.h:70
mup::ParserXBase::m_varDef
var_maptype m_varDef
user defind variables.
Definition: mpParserBase.h:157
utils::scoped_setter
Definition: utGeneric.h:39
mup::FunCosH
Definition: mpFuncNonCmplx.h:67
mup::ParserXBase::DefineOprtChars
void DefineOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of binary operators and postfix operators.
Definition: mpParserBase.cpp:269
mup::ParserXBase::ClearInfixOprt
void ClearInfixOprt()
Clear the user defined Prefix operators.
Definition: mpParserBase.cpp:1238
mup::OprtDiv::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int)
Implements the Division operator.
Definition: mpOprtNonCmplx.cpp:353
mup::noVAL
@ noVAL
to avoid i.e. "tan 2" or "sin(8)3.14"
Definition: mpTypes.h:227
mup::OprtTranspose
Definition: mpOprtMatrix.h:49
mup::OprtAdd
Parser callback for implementing an addition of two noncomplex values.
Definition: mpOprtNonCmplx.h:82
mup::FunStrLen
Callback object for determining the length of a string.
Definition: mpFuncStr.h:44
su::StringTokens
Definition: suStringTokens.h:69
mup::Value::Value
Value(char_type cType='v')
Construct an empty value object of a given type.
Definition: mpValue.cpp:44
mup::OprtSubCmplx
Parser callback for implementing the subtraction of two complex values.
Definition: mpOprtCmplx.h:82
mup::TokenReader
Token reader for the ParserXBase class.
Definition: mpTokenReader.h:58
mup::ParserX
The parser implementation.
Definition: mpParser.h:53
mup::ecINDEX_OUT_OF_BOUNDS
@ ecINDEX_OUT_OF_BOUNDS
Array index is out of bounds.
Definition: mpTypes.h:340
mup::FunStrToLower
Convert a string to lower case letters.
Definition: mpFuncStr.h:70
mup::FunSqrt
Definition: mpFuncNonCmplx.h:79
mup::ParserXBase::Eval
const IValue & Eval() const
Evaluate the expression.
Definition: mpParserBase.cpp:237
mup::OprtAssign
Assignement operator.
Definition: mpOprtBinAssign.h:57
mup::ecNAME_CONFLICT
@ ecNAME_CONFLICT
Name conflict.
Definition: mpTypes.h:331
mup::prCOLON
@ prCOLON
Colon operator.
Definition: mpTypes.h:277
mup::ecUNEXPECTED_SQR_BRACKET
@ ecUNEXPECTED_SQR_BRACKET
Invalid use of the index operator.
Definition: mpTypes.h:321
mup::EOprtPrecedence
EOprtPrecedence
Parser operator precedence values.
Definition: mpTypes.h:258
mup::FunSinH
Definition: mpFuncNonCmplx.h:66
mup::cmSCRIPT_NEWLINE
@ cmSCRIPT_NEWLINE
Newline.
Definition: mpTypes.h:174
mup::ErrorContext::Ident
string_type Ident
The expression string.
Definition: mpError.h:89
mup::ecINVALID_NAME
@ ecINVALID_NAME
Invalid function, variable or constant name.
Definition: mpTypes.h:324
mup::Value::GetInteger
virtual int_type GetInteger() const
Return the value as an integer.
Definition: mpValue.cpp:590
mup::ErrorContext::Pos
int Pos
The number of arguments that were expected.
Definition: mpError.h:95
mup::ErrorContext::Type1
char_type Type1
The error code
Definition: mpError.h:92
mup::ErrorContext
Error context class.
Definition: mpError.h:72
mup::cmSCRIPT_ELSEIF
@ cmSCRIPT_ELSEIF
Reserved for future use.
Definition: mpTypes.h:182
mup::ecBUILTIN_OVERLOAD
@ ecBUILTIN_OVERLOAD
Trying to overload builtin operator.
Definition: mpTypes.h:325
mup::ParserMessageProviderGerman
German versions of parser messages.
Definition: mpParserMessageProvider.h:51
mup::ecTYPE_CONFLICT_IDX
@ ecTYPE_CONFLICT_IDX
Function argument type conflict.
Definition: mpTypes.h:316
mup::OprtSign
Callback for the negative sign operator for noncomplex values.
Definition: mpOprtNonCmplx.h:56
mup::ParserXBase::AddPackage
void AddPackage(IPackage *p)
Adds a new package to the parser.
Definition: mpParserBase.cpp:349
mup::TokenReader::ReadNextToken
ptr_tok_type ReadNextToken()
Read the next token from the string.
Definition: mpTokenReader.cpp:300
mup::OprtDiv
Callback object for implementing the division of noncomplex values.
Definition: mpOprtNonCmplx.h:121
mup::IOprtPostfix
Interface for unary postfix operators.
Definition: mpIOprt.h:83
mup::cmJMP
@ cmJMP
Reserved for future use.
Definition: mpTypes.h:164
mup::noVAR
@ noVAR
to avoid i.e. "sin a" or "sin(8)a"
Definition: mpTypes.h:228
mup::cmOPRT_BIN
@ cmOPRT_BIN
Binary operator.
Definition: mpTypes.h:167
mup::FunCmplxAbs
Definition: mpFuncCmplx.h:240
mup::val_vec_type
std::vector< ptr_val_type > val_vec_type
Type for a vector of value items.
Definition: mpTypes.h:89
mup::FunFmod
Definition: mpFuncNonCmplx.h:98
mup::ecVARIABLE_DEFINED
@ ecVARIABLE_DEFINED
Variable is already defined.
Definition: mpTypes.h:354
mup::FunMatrixSize
Determines the dimensions of a matrix.
Definition: mpFuncMatrix.h:93
mup::bool_type
bool bool_type
Parser boolean datatype.
Definition: mpTypes.h:107
mup::OprtAddCmplx
Parser callback for implementing an addition of two complex values.
Definition: mpOprtCmplx.h:69
mup::ecFUNOPRT_DEFINED
@ ecFUNOPRT_DEFINED
Function/operator is already defined.
Definition: mpTypes.h:356
mup::FunSum::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
Returns the minimum value of all values.
Definition: mpFuncCommon.cpp:198
mup::OprtOr
Callback class for a logic or operator.
Definition: mpOprtBinCommon.h:158
mup::FunCmplxCosH
Definition: mpFuncCmplx.h:139
mup::OprtShr
Callback class for the shift right operator.
Definition: mpOprtBinCommon.h:210
mup::cmSCRIPT_LABEL
@ cmSCRIPT_LABEL
Reserved for future use.
Definition: mpTypes.h:178
mup::OprtCreateArray::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *arg, int argc)
Index operator implementation.
Definition: mpOprtMatrix.cpp:88
mup::ecMISSING_SQR_BRACKET
@ ecMISSING_SQR_BRACKET
The index operator was not closed properly (i.e. "v[3")
Definition: mpTypes.h:342
mup::BinValReader
A class for reading binary values from an expression string.
Definition: mpValReader.h:107
mup::readervec_type
std::vector< IValueReader * > readervec_type
Type of a vector holding pointers to value reader objects.
Definition: mpTypes.h:121
mup::Stack::empty
bool empty() const
Returns true if stack is empty false otherwise.
Definition: mpStack.h:125
mup::ecUNASSIGNABLE_TOKEN
@ ecUNASSIGNABLE_TOKEN
Token cant be identified.
Definition: mpTypes.h:296
mup::ParserTester
Test cases for unit testing the parser framework.
Definition: mpTest.h:45
mup::cmplx_type
std::complex< float_type > cmplx_type
The basic type used for representing complex numbers.
Definition: mpTypes.h:100
mup::cmCOUNT
@ cmCOUNT
Dummy entry for counting the enum values.
Definition: mpTypes.h:188
mup::cmSCRIPT_ELSE
@ cmSCRIPT_ELSE
Reserved for future use.
Definition: mpTypes.h:181
mup::GenericToken
Default token implentation.
Definition: mpIToken.h:138
mup::cmSCRIPT_FUNCTION
@ cmSCRIPT_FUNCTION
Reserved for future use.
Definition: mpTypes.h:184
mup::ParserXBase::m_OprtDef
oprt_bin_maptype m_OprtDef
Binary operator callbacks.
Definition: mpParserBase.h:155
mup::OprtCreateArray
On the fly array creation using the curly bracket operator.
Definition: mpOprtMatrix.h:61
mup::FunSizeOf::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
Returns the number of elements stored in the first parameter.
Definition: mpFuncCommon.cpp:254
mup::ParserXBase::DefineInfixOprt
void DefineInfixOprt(const TokenPtr< IOprtInfix > &oprt)
Add a user defined operator.
Definition: mpParserBase.cpp:488
mup::ecARRAY_SIZE_MISMATCH
@ ecARRAY_SIZE_MISMATCH
Array size mismatch during a vector operation.
Definition: mpTypes.h:319
mup::TokenPtr::Reset
void Reset(token_type tok)
Release the managed pointer and assign a new pointer.
Definition: mpIToken.h:200
mup::Stack::pop
value_type pop()
Pop a value from the stack.
Definition: mpStack.h:89
mup::FunACos
Definition: mpFuncNonCmplx.h:63
mup::FunSum
Parser callback for summing up all function arguments.
Definition: mpFuncCommon.h:87
mup::FunMatrixOnes
Parser callback object for creating matrices consisting entirely of ones.
Definition: mpFuncMatrix.h:49
mup::ParserXBase::m_valDef
val_maptype m_valDef
Definition of parser constants.
Definition: mpParserBase.h:156
mup::FunCmplxImag
Parser callback object for returning the imaginary part of a complex number.
Definition: mpFuncCmplx.h:66
Matrix
Definition: mpMatrix.h:48
mup::BinValReader::Clone
virtual IValueReader * Clone(TokenReader *pTokenReader) const
Clone this ValueReader object.
Definition: mpValReader.cpp:254
mup::prADD_SUB
@ prADD_SUB
addition
Definition: mpTypes.h:279
mup::FunHypot
Definition: mpFuncNonCmplx.h:96
mup::IPrecedence
Interface for binary and ternary operators.
Definition: mpIPrecedence.h:52
mup::FunCmplxExp
Definition: mpFuncCmplx.h:190
mup::ecTOO_MANY_PARAMS
@ ecTOO_MANY_PARAMS
Too many function parameters.
Definition: mpTypes.h:312
mup::FunTan
Definition: mpFuncNonCmplx.h:60
mup::ecINVALID_VAR_PTR
@ ecINVALID_VAR_PTR
Invalid variable pointer.
Definition: mpTypes.h:327
mup::ecOPT_PRI
@ ecOPT_PRI
Invalid operator priority.
Definition: mpTypes.h:332
mup::ParserXBase::DefineInfixOprtChars
void DefineInfixOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of infix operators.
Definition: mpParserBase.cpp:280
mup::OprtGE
Callback object class for the "Greater or or equal" operator.
Definition: mpOprtBinCommon.h:132
mup::OprtCastToFloat
Callback for an operator allowing to cast values to floating point values.
Definition: mpOprtBinCommon.h:224
mup::OprtGT
Callback object class for the "Greater than" operator.
Definition: mpOprtBinCommon.h:106
mup::HexValReader::Clone
virtual IValueReader * Clone(TokenReader *pTokenReader) const
Clone this ValueReader object.
Definition: mpValReader.cpp:201
mup::OprtSignCmplx
Callback for the negative sign operator.
Definition: mpOprtCmplx.h:56
mup::FunASin
Definition: mpFuncNonCmplx.h:62
mup::OprtAssignAdd
Assignement operator.
Definition: mpOprtBinAssign.h:73
mup::FunRemainder
Definition: mpFuncNonCmplx.h:99
mup::IPackage
Definition: mpIPackage.h:47
mup::prINFIX
@ prINFIX
Signs have a higher priority than ADD_SUB, but lower than power operator.
Definition: mpTypes.h:284
mup::noCOMMA
@ noCOMMA
to avoid i.e. ",," or "+," ...
Definition: mpTypes.h:229
mup::ErrorContext::Hint
string_type Hint
The identifier of the token that caused the error.
Definition: mpError.h:90
mup::ecEVAL
@ ecEVAL
Error while evaluating function / operator.
Definition: mpTypes.h:344
mup::OprtDivCmplx::Eval
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int)
Implements the Division operator.
Definition: mpOprtCmplx.cpp:252
mup::token_vec_type
std::vector< ptr_tok_type > token_vec_type
Type for a vector of tokens.
Definition: mpTypes.h:86
mup::ParserXBase::ClearPostfixOprt
void ClearPostfixOprt()
Clear all user defined postfix operators.
Definition: mpParserBase.cpp:1218
mup::FunMin
Determine minimal value from the parameter list.
Definition: mpFuncCommon.h:74
mup::ecUNEXPECTED_VAL
@ ecUNEXPECTED_VAL
An unexpected value token has been found.
Definition: mpTypes.h:299
mup::ParserXBase::DefineFun
void DefineFun(const ptr_cal_type &fun)
Add a callback object to the parser.
Definition: mpParserBase.cpp:445
mup::TokenReader::GetExpr
const string_type & GetExpr() const
Return a reference to the formula.
Definition: mpTokenReader.cpp:216
mup::ParserXBase::GetVar
const var_maptype & GetVar() const
Return a map containing the used variables only.
Definition: mpParserBase.cpp:590
mup::IValue
Interface to be implemented by all classes representing values.
Definition: mpIValue.h:53
mup::IToken
Generic token interface for expression tokens.
Definition: mpIToken.h:55
mup::Value::GetImag
virtual float_type GetImag() const
Get the imaginary part of the value.
Definition: mpValue.cpp:628
mup::ParserXBase::DefineVar
void DefineVar(const string_type &ident, const Variable &var)
Add a user defined variable.
Definition: mpParserBase.cpp:399
mup::ecUNEXPECTED_STR
@ ecUNEXPECTED_STR
A string has been found at an inapropriate position.
Definition: mpTypes.h:302
mup::FunCmplxLog
Definition: mpFuncCmplx.h:210
mup::FunExp
Definition: mpFuncNonCmplx.h:81
mup::ecDOMAIN_ERROR
@ ecDOMAIN_ERROR
Trying to use func/oprtr with out-of-domain input args.
Definition: mpTypes.h:336
mup::OprtKilo
Definition: mpPackageUnit.h:54
mup::FunLn
Definition: mpFuncNonCmplx.h:77
mup::BinValReader::IsValue
virtual bool IsValue(const char_type *a_szExpr, int &a_iPos, Value &a_fVal)
Check a certain position in an expression for the presence of a value.
Definition: mpValReader.cpp:223
mup::OprtAnd
Callback class for a logic and operator.
Definition: mpOprtBinCommon.h:145
mup::OprtSub
Parser callback for implementing the subtraction of two noncomplex values.
Definition: mpOprtNonCmplx.h:95
mup::cmBO
@ cmBO
Operator item: opening bracket.
Definition: mpTypes.h:154
mup::matrix_type
Matrix< Value > matrix_type
The parsers underlying matrix type.
Definition: mpTypes.h:110


muParserX documentation - (C) 2010 Ingo Berg