muParserX 2.0.0
Loading...
Searching...
No Matches
mup Namespace Reference

Namespace for mathematical applications. More...

Classes

class  BinValReader
 A class for reading binary values from an expression string. More...
 
class  BoolValReader
 A class for reading boolean values from an expression string. More...
 
class  DblValReader
 A class for reading floating point values from an expression string. More...
 
struct  ErrorContext
 Error context class. More...
 
class  FunAbs
 
class  FunACos
 
class  FunACosH
 
class  FunASin
 
class  FunASinH
 
class  FunATan
 
class  FunAtan2
 
class  FunATanH
 
class  FunCbrt
 
class  FunCmplxAbs
 
class  FunCmplxArg
 Parser callback object for returning the phase angle (or angular component) of a complex number, expressed in radians. More...
 
class  FunCmplxConj
 Parser callback object for returning the complex conjugate of the complex number. More...
 
class  FunCmplxCos
 
class  FunCmplxCosH
 
class  FunCmplxExp
 
class  FunCmplxImag
 Parser callback object for returning the imaginary part of a complex number. More...
 
class  FunCmplxLn
 
class  FunCmplxLog
 
class  FunCmplxLog10
 
class  FunCmplxLog2
 
class  FunCmplxNorm
 Parser callback object for returning the norm value of the complex number phase angle. More...
 
class  FunCmplxPow
 
class  FunCmplxReal
 Parser callback object for returning the real part of a complex number. More...
 
class  FunCmplxSin
 
class  FunCmplxSinH
 
class  FunCmplxSqrt
 
class  FunCmplxTan
 
class  FunCmplxTanH
 
class  FunCos
 
class  FunCosH
 
class  FunExp
 
class  FunFmod
 
class  FunHypot
 
class  FunLn
 
class  FunLog
 
class  FunLog10
 
class  FunLog2
 
class  FunMatrixEye
 Parser callback object for creating unity matrices. More...
 
class  FunMatrixOnes
 Parser callback object for creating matrices consisting entirely of ones. More...
 
class  FunMatrixSize
 Determines the dimensions of a matrix. More...
 
class  FunMatrixZeros
 Parser callback object for creating matrices consisting entirely of zeros. More...
 
class  FunMax
 Determine maximal value from the parameter list. More...
 
class  FunMin
 Determine minimal value from the parameter list. More...
 
class  FunParserID
 Parser function callback for determining the size of an array. More...
 
class  FunPow
 
class  FunRemainder
 
class  FunSin
 
class  FunSinH
 
class  FunSizeOf
 Parser function callback for determining the size of an array. More...
 
class  FunSqrt
 
class  FunStrLen
 Callback object for determining the length of a string. More...
 
class  FunStrToDbl
 Parse string to a floating point value.
More...
 
class  FunStrToLower
 Convert a string to lower case letters. More...
 
class  FunStrToUpper
 Convert a string to upper case letters.
More...
 
class  FunSum
 Parser callback for summing up all function arguments. More...
 
class  FunTan
 
class  FunTanH
 
class  GenericToken
 Default token implentation. More...
 
class  HexValReader
 A class for reading hex values from an expression string. More...
 
class  ICallback
 Interface for callback objects. More...
 
class  IOprtBin
 Interface for binary operators. More...
 
class  IOprtBinShortcut
 A class for encapsulation if-then-else tokens. More...
 
class  IOprtInfix
 Interface for unary infix operators. More...
 
class  IOprtPostfix
 Interface for unary postfix operators. More...
 
class  IPackage
 
class  IPrecedence
 Interface for binary and ternary operators. More...
 
class  IToken
 Generic token interface for expression tokens. More...
 
class  IValue
 Interface to be implemented by all classes representing values. More...
 
class  IValueReader
 Interface for custom value reader objects. More...
 
class  OprtAdd
 Parser callback for implementing an addition of two noncomplex values. More...
 
class  OprtAddCmplx
 Parser callback for implementing an addition of two complex values. More...
 
class  OprtAnd
 Callback class for a logic and operator. More...
 
class  OprtAssign
 Assignement operator. More...
 
class  OprtAssignAdd
 Assignement operator. More...
 
class  OprtAssignDiv
 Assignement operator. More...
 
class  OprtAssignMul
 Assignement operator. More...
 
class  OprtAssignSub
 Assignement operator. More...
 
class  OprtCastToFloat
 Callback for an operator allowing to cast values to floating point values. More...
 
class  OprtCastToInt
 Callback for an operator allowing to cast values to integer values. More...
 
class  OprtColon
 
class  OprtCreateArray
 On the fly array creation using the curly bracket operator. More...
 
class  OprtDiv
 Callback object for implementing the division of noncomplex values. More...
 
class  OprtDivCmplx
 Callback object for implementing the division of complex values. More...
 
class  OprtEQ
 Callback object for testing if two values are equal. More...
 
class  OprtFact
 Calculate factorial of a non-negative integer. More...
 
class  OprtGE
 Callback object class for the "Greater or or equal" operator. More...
 
class  OprtGiga
 
class  OprtGT
 Callback object class for the "Greater than" operator. More...
 
class  OprtIndex
 Default implementation of a multidimensional index operator. More...
 
class  OprtKilo
 
class  OprtLE
 Callback object class for the "Less or equal" operator. More...
 
class  OprtLogicAnd
 Callback class for a logical and operator. More...
 
class  OprtLogicOr
 Callback class for a logical or operator. More...
 
class  OprtLT
 Callback object class for the "Less than" operator. More...
 
class  OprtMega
 
class  OprtMicro
 
class  OprtMilli
 
class  OprtMul
 Callback object for implementing the multiplications of noncomplex values. More...
 
class  OprtMulCmplx
 Callback object for implementing the multiplications of complex values. More...
 
class  OprtNano
 
class  OprtNEQ
 Callback object for testing if two values are not equal. More...
 
class  OprtOr
 Callback class for a logic or operator. More...
 
class  OprtPercentage
 Returns percentage of given number. More...
 
class  OprtPow
 Raise x to the power of y. More...
 
class  OprtPowCmplx
 Raise x to the power of y. More...
 
class  OprtShl
 Callback class for the shift left operator. More...
 
class  OprtShortcutLogicAndBegin
 Callback class for a logical and operator. begin. More...
 
class  OprtShortcutLogicAndEnd
 Callback class for a logical and operator. begin. More...
 
class  OprtShortcutLogicOrBegin
 Callback class for a logical or operator. begin. More...
 
class  OprtShortcutLogicOrEnd
 Callback class for a logical or operator. end. More...
 
class  OprtShr
 Callback class for the shift right operator. More...
 
class  OprtSign
 Callback for the negative sign operator for noncomplex values. More...
 
class  OprtSignCmplx
 Callback for the negative sign operator. More...
 
class  OprtSignPos
 Callback for the positive sign operator for noncomplex values. More...
 
class  OprtStrAdd
 
class  OprtSub
 Parser callback for implementing the subtraction of two noncomplex values. More...
 
class  OprtSubCmplx
 Parser callback for implementing the subtraction of two complex values. More...
 
class  OprtTranspose
 
class  PackageCmplx
 Package for installing complex functions and operators. More...
 
class  PackageCommon
 Package for installing operators and functions which are always present. More...
 
class  PackageMatrix
 Package for installing complex functions and operators. More...
 
class  PackageNonCmplx
 Package for installing complex functions and operators. More...
 
class  PackageStr
 Package for installing unit postfix operators into muParserX. More...
 
class  PackageUnit
 Package for installing unit postfix operators into muParserX. More...
 
class  ParserError
 Error class of the parser. More...
 
class  ParserErrorMsg
 
class  ParserMessageProviderBase
 Base class for Parser Message providing classes. More...
 
class  ParserMessageProviderEnglish
 English versions of parser messages. More...
 
class  ParserMessageProviderGerman
 German versions of parser messages. More...
 
class  ParserTester
 Test cases for unit testing the parser framework. More...
 
class  ParserX
 The parser implementation. More...
 
class  ParserXBase
 Implementation of the parser engine. More...
 
class  RPN
 A class representing the reverse polnish notation of the expression. More...
 
class  Stack
 Parser stack implementation. More...
 
class  StrValReader
 A class for reading strings from an expression string. More...
 
class  TokenIfThenElse
 A class for encapsulation if-then-else tokens. More...
 
class  TokenNewline
 A class for encapsulation a newline token. More...
 
class  TokenPtr
 
class  TokenReader
 Token reader for the ParserXBase class. More...
 
class  Value
 Value class of muParserX. More...
 
class  ValueCache
 The ValueCache class provides a simple mechanism to recycle unused value items. More...
 
class  Variable
 The variable class represents a parser variable. More...
 

Typedefs

typedef TokenPtr< ITokenptr_tok_type
 Type of a managed pointer storing parser tokens.
 
typedef TokenPtr< ICallbackptr_cal_type
 Type of a managed pointer storing callback tokens.
 
typedef TokenPtr< IValueptr_val_type
 Type of a managed pointer storing value tokens.
 
typedef TokenPtr< IOprtBinptr_binop_type
 Type of a managed pointer storing binary operator tokens.
 
typedef std::vector< ptr_tok_typetoken_vec_type
 Type for a vector of tokens.
 
typedef std::vector< ptr_val_typeval_vec_type
 Type for a vector of value items.
 
typedef double float_type
 Parser datatype for floating point value.
 
typedef int64_t int_type
 Parser datatype for integer valuse.
 
typedef std::complex< float_typecmplx_type
 The basic type used for representing complex numbers.
 
typedef bool bool_type
 Parser boolean datatype.
 
typedef Matrix< Valuematrix_type
 The parsers underlying matrix type.
 
typedef std::string string_type
 Parser datatype for strings.
 
typedef string_type::value_type char_type
 Character type of the parser.
 
typedef std::vector< IValueReader * > readervec_type
 Type of a vector holding pointers to value reader objects.
 
typedef std::map< string_type, ptr_tok_typevar_maptype
 type for the parser variable storage.
 
typedef std::map< string_type, ptr_tok_typeval_maptype
 type of a container used to store parser values.

 
typedef std::map< string_type, ptr_tok_typefun_maptype
 Type of a container that binds Callback object pointer to operator identifiers.
 
typedef std::map< string_type, ptr_tok_typeoprt_bin_shortcut_maptype
 Type of a container that short circuit operator object pointer.
 
typedef 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.
 
typedef std::map< string_type, ptr_tok_typeoprt_pfx_maptype
 Type of a map for storing postfix operators by their name.
 
typedef std::map< string_type, ptr_tok_typeoprt_ifx_maptype
 Type of a map for storing infix operators by their name.
 

Enumerations

enum  ECmdCode {
  cmBO = 0 , cmBC = 1 , cmIO = 2 , cmIC = 3 ,
  cmCBO = 4 , cmCBC = 5 , cmARG_SEP = 6 , cmIF = 7 ,
  cmELSE = 8 , cmENDIF = 9 , cmJMP = 10 , cmVAL = 11 ,
  cmFUNC = 12 , cmOPRT_BIN = 13 , cmOPRT_INFIX = 14 , cmOPRT_POSTFIX = 15 ,
  cmSHORTCUT_BEGIN = 16 , cmSHORTCUT_END = 17 , cmEOE = 18 , cmSCRIPT_NEWLINE = 19 ,
  cmSCRIPT_COMMENT = 20 , cmSCRIPT_WHILE = 21 , cmSCRIPT_GOTO = 22 , cmSCRIPT_LABEL = 23 ,
  cmSCRIPT_FOR = 24 , cmSCRIPT_IF = 25 , cmSCRIPT_ELSE = 26 , cmSCRIPT_ELSEIF = 27 ,
  cmSCRIPT_ENDIF = 28 , cmSCRIPT_FUNCTION = 29 , cmUNKNOWN = 30 , cmCOUNT
}
 Bytecode values. More...
 
enum  ESynCodes {
  noBO = 1 << 0 , noBC = 1 << 1 , noIO = 1 << 2 , noIC = 1 << 3 ,
  noCBO = 1 << 4 , noCBC = 1 << 5 , noVAL = 1 << 6 , noVAR = 1 << 7 ,
  noCOMMA = 1 << 8 , noFUN = 1 << 9 , noOPT = 1 << 10 , noPFX = 1 << 11 ,
  noIFX = 1 << 12 , noEND = 1 << 13 , noIF = 1 << 14 , noELSE = 1 << 15 ,
  noNEWLINE = 1 << 16 , sfSTART_OF_LINE = noOPT | noBC | noPFX | noCOMMA | noIO | noIC | noIF | noELSE , sfALLOW_NONE = ~0
}
 Syntax codes. More...
 
enum  EOprtAsct
 Binary operator associativity values.
 
enum  EOprtPrecedence {
}
 Parser operator precedence values. More...
 
enum  EErrorCodes {
  ecUNEXPECTED_OPERATOR = 0 , ecUNASSIGNABLE_TOKEN = 1 , ecUNEXPECTED_EOF = 2 , ecUNEXPECTED_COMMA = 3 ,
  ecUNEXPECTED_VAL = 4 , ecUNEXPECTED_VAR = 5 , ecUNEXPECTED_PARENS = 6 , ecUNEXPECTED_STR = 7 ,
  ecUNEXPECTED_CONDITIONAL = 8 , ecUNEXPECTED_NEWLINE = 9 , ecSTRING_EXPECTED = 10 , ecVAL_EXPECTED = 11 ,
  ecMISSING_PARENS = 12 , ecMISSING_ELSE_CLAUSE = 13 , ecMISPLACED_COLON = 14 , ecUNEXPECTED_FUN = 15 ,
  ecUNTERMINATED_STRING = 16 , ecTOO_MANY_PARAMS = 17 , ecTOO_FEW_PARAMS = 18 , ecTYPE_CONFLICT = 19 ,
  ecTYPE_CONFLICT_FUN = 20 , ecTYPE_CONFLICT_IDX = 21 , ecINVALID_TYPE = 22 , ecINVALID_TYPECAST = 23 ,
  ecARRAY_SIZE_MISMATCH = 24 , ecNOT_AN_ARRAY = 25 , ecUNEXPECTED_SQR_BRACKET = 26 , ecUNEXPECTED_CURLY_BRACKET = 27 ,
  ecINVALID_NAME = 28 , ecBUILTIN_OVERLOAD = 29 , ecINVALID_FUN_PTR = 30 , ecINVALID_VAR_PTR = 31 ,
  ecINVALID_PARAMETER = 32 , ecINVALID_NUMBER_OF_PARAMETERS = 33 , ecNAME_CONFLICT = 34 , ecOPT_PRI = 35 ,
  ecASSIGNEMENT_TO_VALUE = 36 , ecDOMAIN_ERROR = 37 , ecDIV_BY_ZERO = 38 , ecGENERIC = 39 ,
  ecINDEX_OUT_OF_BOUNDS = 40 , ecINDEX_DIMENSION = 41 , ecMISSING_SQR_BRACKET = 42 , ecMISSING_CURLY_BRACKET = 43 ,
  ecEVAL = 44 , ecOVERFLOW = 45 , ecMATRIX_DIMENSION_MISMATCH = 46 , ecUNKNOWN_ESCAPE_SEQUENCE = 47 ,
  ecVARIABLE_DEFINED = 48 , ecCONSTANT_DEFINED = 49 , ecFUNOPRT_DEFINED = 50 , ecINTERNAL_ERROR = 51 ,
  ecCOUNT , ecUNDEFINED = -1
}
 Error codes. More...
 

Functions

std::ostream & operator<< (std::ostream &a_Stream, const IToken &tok)
 Overloaded streaming operator for outputting the value type into an std::ostream.
 
std::ostream & operator<< (std::ostream &a_Stream, const IValue &a_Val)
 Overloaded streaming operator for outputting the value type into an std::ostream.
 
std::ostream & console ()
 Encapsulate cout.
 
std::istream & console_in ()
 Encapsulate cin.
 

Variables

const char_typeg_sCmdCode []
 Strings assigned to the enum codes of ECmdCode.
 

Detailed Description

Namespace for mathematical applications.

Typedef Documentation

◆ bool_type

typedef bool mup::bool_type

Parser boolean datatype.

This must be bool! The only reason for this typedef is that I need the name bool_type for a preprocessor macro definition to avoid inconsistent naming of the macro parameters.

Enumeration Type Documentation

◆ ECmdCode

Bytecode values.

Attention
The order of the operator entries must match the order in ParserXBase::c_DefaultOprt!
Enumerator
cmBO 

Operator item: opening bracket.

cmBC 

Operator item: closing bracket.

cmIO 

Operator item: index operator opening.

cmIC 

Operator item: index operator closing.

cmCBO 

Operator item: curly bracket (opening)

cmCBC 

Operator item: curly bracket (closing)

cmARG_SEP 

Operator item: comma.

cmIF 

Ternary if then else operator.

cmELSE 

Ternary if then else operator.

cmENDIF 

Ternary if then else operator.

cmJMP 

Reserved for future use.

cmVAL 

value item

cmFUNC 

Code for a function item.

cmOPRT_BIN 

Binary operator.

cmOPRT_INFIX 

Infix operator.

cmOPRT_POSTFIX 

Postfix operator.

cmSHORTCUT_BEGIN 

Short circuit operator && / ||.

cmSHORTCUT_END 

Short circuit operator && / ||.

cmEOE 

End of expression.

cmSCRIPT_NEWLINE 

Newline.

cmSCRIPT_WHILE 

Reserved for future use.

cmSCRIPT_GOTO 

Reserved for future use.

cmSCRIPT_LABEL 

Reserved for future use.

cmSCRIPT_FOR 

Reserved for future use.

cmSCRIPT_IF 

Reserved for future use.

cmSCRIPT_ELSE 

Reserved for future use.

cmSCRIPT_ELSEIF 

Reserved for future use.

cmSCRIPT_ENDIF 

Reserved for future use.

cmSCRIPT_FUNCTION 

Reserved for future use.

cmUNKNOWN 

uninitialized item

cmCOUNT 

Dummy entry for counting the enum values.

◆ EErrorCodes

Error codes.

This is the complete list of all error codes used by muparserx

Enumerator
ecUNEXPECTED_OPERATOR 

Unexpected binary operator found.

ecUNASSIGNABLE_TOKEN 

Token cant be identified.

ecUNEXPECTED_EOF 

Unexpected end of expression. (Example: "2+sin(")

ecUNEXPECTED_COMMA 

An unexpected comma has been found. (Example: "1,23")

ecUNEXPECTED_VAL 

An unexpected value token has been found.

ecUNEXPECTED_VAR 

An unexpected variable token has been found.

ecUNEXPECTED_PARENS 

Unexpected Parenthesis, opening or closing.

ecUNEXPECTED_STR 

A string has been found at an inapropriate position.

ecSTRING_EXPECTED 

A string function has been called with a different type of argument.

ecVAL_EXPECTED 

A numerical function has been called with a non value type of argument.

ecMISSING_PARENS 

Missing parens. (Example: "3*sin(3")

ecUNEXPECTED_FUN 

Unexpected function found. (Example: "sin(8)cos(9)")

ecUNTERMINATED_STRING 

unterminated string constant. (Example: "3*valueof("hello)")

ecTOO_MANY_PARAMS 

Too many function parameters.

ecTOO_FEW_PARAMS 

Too few function parameters. (Example: "ite(1<2,2)")

ecTYPE_CONFLICT 

Generic type conflict.

ecTYPE_CONFLICT_FUN 

Function argument type conflict.

ecTYPE_CONFLICT_IDX 

Function argument type conflict.

ecINVALID_TYPECAST 

Invalid Value token cast.

ecARRAY_SIZE_MISMATCH 

Array size mismatch during a vector operation.

ecNOT_AN_ARRAY 

Using the index operator on a scalar variable.

ecUNEXPECTED_SQR_BRACKET 

Invalid use of the index operator.

ecUNEXPECTED_CURLY_BRACKET 

Invalid use of the index operator.

ecINVALID_NAME 

Invalid function, variable or constant name.

ecBUILTIN_OVERLOAD 

Trying to overload builtin operator.

ecINVALID_FUN_PTR 

Invalid callback function pointer.

ecINVALID_VAR_PTR 

Invalid variable pointer.

ecINVALID_PARAMETER 

Invalid function parameter.

ecNAME_CONFLICT 

Name conflict.

ecOPT_PRI 

Invalid operator priority.

ecASSIGNEMENT_TO_VALUE 

Assignment to operator (3=4 instead of a=4)

ecDOMAIN_ERROR 

Trying to use func/oprtr with out-of-domain input args.

ecDIV_BY_ZERO 

Division by zero (currently unused)

ecGENERIC 

Generic error.

ecINDEX_OUT_OF_BOUNDS 

Array index is out of bounds.

ecMISSING_SQR_BRACKET 

The index operator was not closed properly (i.e. "v[3")

ecEVAL 

Error while evaluating function / operator.

ecOVERFLOW 

Overflow (possibly) occurred.

ecVARIABLE_DEFINED 

Variable is already defined.

ecCONSTANT_DEFINED 

Constant is already defined.

ecFUNOPRT_DEFINED 

Function/operator is already defined.

ecINTERNAL_ERROR 

Internal error of any kind.

ecCOUNT 

This is no error code, It just stores just the total number of error codes.

ecUNDEFINED 

Undefined message, placeholder to detect unassigned error messages.

◆ EOprtPrecedence

Parser operator precedence values.

These are predefined values for the operator precedence.

Enumerator
prRELATIONAL1 

For "==", "!=".

prRELATIONAL2 

Relational operators "<", "<=", ">", ">=".

prSHIFT 

Shift operators "<<", ">>".

prCOLON 

Colon operator.

prADD_SUB 

addition

prMUL_DIV 

multiplication/division

prPOW 

power operator priority (highest)

prINFIX 

Signs have a higher priority than ADD_SUB, but lower than power operator.

prPOSTFIX 

Postfix operator priority (currently unused)

◆ ESynCodes

Syntax codes.

The syntax codes control the syntax check done during the first time parsing of the expression string. They are flags that indicate which tokens are allowed next if certain tokens are identified.

Enumerator
noBO 

to avoid i.e. "cos(7)("

noBC 

to avoid i.e. "sin)" or "()"

noIO 

No opening bracket "[".

noIC 

No closing bracket "]".

noCBO 

No opening curly bracket.

noCBC 

No opening closing bracket.

noVAL 

to avoid i.e. "tan 2" or "sin(8)3.14"

noVAR 

to avoid i.e. "sin a" or "sin(8)a"

noCOMMA 

to avoid i.e. ",," or "+," ...

noFUN 

to avoid i.e. "sqrt cos" or "(1)sin"

noOPT 

to avoid i.e. "(+)"

noPFX 

to avoid i.e. "(5!!)" "sin!"

noIFX 

to avoid i.e. "++4" "!!4"

noEND 

to avoid unexpected end of expression

noNEWLINE 

to avoid i.e. "a+\nb" or "sin(\na)"

sfALLOW_NONE 

All of he above flags set.

Function Documentation

◆ console()

std::ostream & mup::console ( )
inline

Encapsulate cout.

Used for supporting UNICODE more easily.

Here is the call graph for this function:

◆ console_in()

std::istream & mup::console_in ( )
inline

Encapsulate cin.

Used for supporting UNICODE more easily.

Here is the call graph for this function:

◆ operator<<() [1/2]

std::ostream & mup::operator<< ( std::ostream & a_Stream,
const IToken & tok )

Overloaded streaming operator for outputting the value type into an std::ostream.

Parameters
a_StreamThe stream object
a_ValThe value object to be streamed

This function is only present if MUP_USE_WIDE_STRING is not defined.

◆ operator<<() [2/2]

std::ostream & mup::operator<< ( std::ostream & a_Stream,
const IValue & a_Val )

Overloaded streaming operator for outputting the value type into an std::ostream.

Parameters
a_StreamThe stream object
a_ValThe value object to be streamed

This function is only present if MUP_USE_WIDE_STRING is not defined.

Variable Documentation

◆ g_sCmdCode

const char_type * mup::g_sCmdCode

Strings assigned to the enum codes of ECmdCode.

Used for debugging purposes only.


muParserX documentation - (C) 2010 Ingo Berg