muParser API -  1.35
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
mu Namespace Reference

Namespace for mathematical applications. More...

Namespaces

 Test
 Namespace for test cases.
 

Classes

struct  CbWithUserData
 
struct  generic_callable_type
 
struct  MathImpl
 A template class for providing wrappers for essential math functions. More...
 
class  Parser
 Mathematical expressions parser. More...
 
class  ParserBase
 Mathematical expressions parser (base parser engine). More...
 
class  ParserByteCode
 Bytecode implementation of the Math Parser. More...
 
class  ParserCallback
 Encapsulation of prototypes for a numerical parser function. More...
 
class  ParserError
 Error class of the parser. More...
 
class  ParserErrorMsg
 A class that handles the error messages. More...
 
class  ParserInt
 Mathematical expressions parser. More...
 
class  ParserToken
 Encapsulation of the data for a single formula token. More...
 
class  ParserTokenReader
 Token reader for the ParserBase class. More...
 
struct  SToken
 
struct  TplCallType
 
struct  TplCallType< 0 >
 
struct  TplCallType< 1 >
 
struct  TplCallType< 10 >
 
struct  TplCallType< 2 >
 
struct  TplCallType< 3 >
 
struct  TplCallType< 4 >
 
struct  TplCallType< 5 >
 
struct  TplCallType< 6 >
 
struct  TplCallType< 7 >
 
struct  TplCallType< 8 >
 
struct  TplCallType< 9 >
 
struct  TypeInfo
 A class singling out integer types at compile time using template meta programming. More...
 
struct  TypeInfo< char >
 
struct  TypeInfo< int >
 
struct  TypeInfo< long >
 
struct  TypeInfo< short >
 
struct  TypeInfo< unsigned char >
 
struct  TypeInfo< unsigned int >
 
struct  TypeInfo< unsigned long >
 
struct  TypeInfo< unsigned short >
 

Typedefs

typedef std::map< string_type, ParserCallbackfunmap_type
 Container for Callback objects.
 
typedef MUP_BASETYPE value_type
 The numeric datatype used by the parser. More...
 
typedef MUP_STRING_TYPE string_type
 The stringtype used by the parser. More...
 
typedef string_type::value_type char_type
 The character type used by the parser. More...
 
typedef std::basic_stringstream< char_type, std::char_traits< char_type >, std::allocator< char_type > > stringstream_type
 Typedef for easily using stringstream that respect the parser stringtype.
 
typedef std::map< string_type, value_type * > varmap_type
 Type used for storing variables.
 
typedef std::map< string_type, value_typevalmap_type
 Type used for storing constants.
 
typedef std::map< string_type, std::size_t > strmap_type
 Type for assigning a string name to an index in the internal string table.
 
typedef void(* erased_fun_type) ()
 Function type used to erase type. Voluntarily needs explicit cast with all other fun_type.
 
typedef value_type(* fun_type0) ()
 Callback type used for functions without arguments.
 
typedef value_type(* fun_type1) (value_type)
 Callback type used for functions with a single arguments.
 
typedef value_type(* fun_type2) (value_type, value_type)
 Callback type used for functions with two arguments.
 
typedef value_type(* fun_type3) (value_type, value_type, value_type)
 Callback type used for functions with three arguments.
 
typedef value_type(* fun_type4) (value_type, value_type, value_type, value_type)
 Callback type used for functions with four arguments.
 
typedef value_type(* fun_type5) (value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with five arguments.
 
typedef value_type(* fun_type6) (value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with six arguments.
 
typedef value_type(* fun_type7) (value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with seven arguments.
 
typedef value_type(* fun_type8) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with eight arguments.
 
typedef value_type(* fun_type9) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with nine arguments.
 
typedef value_type(* fun_type10) (value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with ten arguments.
 
typedef value_type(* fun_userdata_type0) (void *)
 Callback type with user data (not null) used for functions without arguments.
 
typedef value_type(* fun_userdata_type1) (void *, value_type)
 Callback type with user data (not null) used for functions with a single arguments.
 
typedef value_type(* fun_userdata_type2) (void *, value_type, value_type)
 Callback type with user data (not null) used for functions with two arguments.
 
typedef value_type(* fun_userdata_type3) (void *, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with three arguments.
 
typedef value_type(* fun_userdata_type4) (void *, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with four arguments.
 
typedef value_type(* fun_userdata_type5) (void *, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with five arguments.
 
typedef value_type(* fun_userdata_type6) (void *, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with six arguments.
 
typedef value_type(* fun_userdata_type7) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with seven arguments.
 
typedef value_type(* fun_userdata_type8) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with eight arguments.
 
typedef value_type(* fun_userdata_type9) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with nine arguments.
 
typedef value_type(* fun_userdata_type10) (void *, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with ten arguments.
 
typedef value_type(* bulkfun_type0) (int, int)
 Callback type used for functions without arguments.
 
typedef value_type(* bulkfun_type1) (int, int, value_type)
 Callback type used for functions with a single arguments.
 
typedef value_type(* bulkfun_type2) (int, int, value_type, value_type)
 Callback type used for functions with two arguments.
 
typedef value_type(* bulkfun_type3) (int, int, value_type, value_type, value_type)
 Callback type used for functions with three arguments.
 
typedef value_type(* bulkfun_type4) (int, int, value_type, value_type, value_type, value_type)
 Callback type used for functions with four arguments.
 
typedef value_type(* bulkfun_type5) (int, int, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with five arguments.
 
typedef value_type(* bulkfun_type6) (int, int, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with six arguments.
 
typedef value_type(* bulkfun_type7) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with seven arguments.
 
typedef value_type(* bulkfun_type8) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with eight arguments.
 
typedef value_type(* bulkfun_type9) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with nine arguments.
 
typedef value_type(* bulkfun_type10) (int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions with ten arguments.
 
typedef value_type(* bulkfun_userdata_type0) (void *, int, int)
 Callback type with user data (not null) used for functions without arguments.
 
typedef value_type(* bulkfun_userdata_type1) (void *, int, int, value_type)
 Callback type with user data (not null) used for functions with a single arguments.
 
typedef value_type(* bulkfun_userdata_type2) (void *, int, int, value_type, value_type)
 Callback type with user data (not null) used for functions with two arguments.
 
typedef value_type(* bulkfun_userdata_type3) (void *, int, int, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with three arguments.
 
typedef value_type(* bulkfun_userdata_type4) (void *, int, int, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with four arguments.
 
typedef value_type(* bulkfun_userdata_type5) (void *, int, int, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with five arguments.
 
typedef value_type(* bulkfun_userdata_type6) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with six arguments.
 
typedef value_type(* bulkfun_userdata_type7) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with seven arguments.
 
typedef value_type(* bulkfun_userdata_type8) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with eight arguments.
 
typedef value_type(* bulkfun_userdata_type9) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with nine arguments.
 
typedef value_type(* bulkfun_userdata_type10) (void *, int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions with ten arguments.
 
typedef value_type(* multfun_type) (const value_type *, int)
 Callback type used for functions with a variable argument list.
 
typedef value_type(* multfun_userdata_type) (void *, const value_type *, int)
 Callback type with user data (not null) used for functions and a variable argument list.
 
typedef value_type(* strfun_type1) (const char_type *)
 Callback type used for functions taking a string as an argument.
 
typedef value_type(* strfun_type2) (const char_type *, value_type)
 Callback type used for functions taking a string and a value as arguments.
 
typedef value_type(* strfun_type3) (const char_type *, value_type, value_type)
 Callback type used for functions taking a string and two values as arguments.
 
typedef value_type(* strfun_type4) (const char_type *, value_type, value_type, value_type)
 Callback type used for functions taking a string and three values as arguments.
 
typedef value_type(* strfun_type5) (const char_type *, value_type, value_type, value_type, value_type)
 Callback type used for functions taking a string and four values as arguments.
 
typedef value_type(* strfun_type6) (const char_type *, value_type, value_type, value_type, value_type, value_type)
 Callback type used for functions taking a string and five values as arguments.
 
typedef value_type(* strfun_userdata_type1) (void *, const char_type *)
 Callback type with user data (not null) used for functions taking a string as an argument.
 
typedef value_type(* strfun_userdata_type2) (void *, const char_type *, value_type)
 Callback type with user data (not null) used for functions taking a string and a value as arguments.
 
typedef value_type(* strfun_userdata_type3) (void *, const char_type *, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and two values as arguments.
 
typedef value_type(* strfun_userdata_type4) (void *, const char_type *, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and a value as arguments.
 
typedef value_type(* strfun_userdata_type5) (void *, const char_type *, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and two values as arguments.
 
typedef value_type(* strfun_userdata_type6) (void *, const char_type *, value_type, value_type, value_type, value_type, value_type)
 Callback type with user data (not null) used for functions taking a string and five values as arguments.
 
typedef int(* identfun_type) (const char_type *sExpr, int *nPos, value_type *fVal)
 Callback used for functions that identify values in a string.
 
typedef value_type *(* facfun_type) (const char_type *, void *)
 Callback used for variable creation factory functions.
 

Enumerations

enum  ECmdCode {
  cmLE = 0, cmGE = 1, cmNEQ = 2, cmEQ = 3,
  cmLT = 4, cmGT = 5, cmADD = 6, cmSUB = 7,
  cmMUL = 8, cmDIV = 9, cmPOW = 10, cmLAND = 11,
  cmLOR = 12, cmASSIGN = 13, cmBO = 14, cmBC = 15,
  cmIF = 16, cmELSE = 17, cmENDIF = 18, cmARG_SEP = 19,
  cmVAR = 20, cmVAL = 21, cmVARPOW2 = 22, cmVARPOW3 = 23,
  cmVARPOW4 = 24, cmVARMUL = 25, cmFUNC = 26, cmFUNC_STR,
  cmFUNC_BULK, cmSTRING, cmOPRT_BIN, cmOPRT_POSTFIX,
  cmOPRT_INFIX, cmEND, cmUNKNOWN
}
 Bytecode values. More...
 
enum  ETypeCode { tpSTR = 0, tpDBL = 1, tpVOID = 2 }
 Types internally used by the parser. More...
 
enum  EParserVersionInfo { pviBRIEF, pviFULL }
 
enum  EOprtAssociativity { oaLEFT = 0, oaRIGHT = 1, oaNONE = 2 }
 Parser operator precedence values.
 
enum  EOprtPrecedence {
  prLOR = 1, prLAND = 2, prLOGIC = 3, prCMP = 4,
  prADD_SUB = 5, prMUL_DIV = 6, prPOW = 7, prINFIX = 6,
  prPOSTFIX = 6
}
 Parser operator precedence values. More...
 
enum  EErrorCodes {
  ecUNEXPECTED_OPERATOR = 0, ecUNASSIGNABLE_TOKEN = 1, ecUNEXPECTED_EOF = 2, ecUNEXPECTED_ARG_SEP = 3,
  ecUNEXPECTED_ARG = 4, ecUNEXPECTED_VAL = 5, ecUNEXPECTED_VAR = 6, ecUNEXPECTED_PARENS = 7,
  ecUNEXPECTED_STR = 8, ecSTRING_EXPECTED = 9, ecVAL_EXPECTED = 10, ecMISSING_PARENS = 11,
  ecUNEXPECTED_FUN = 12, ecUNTERMINATED_STRING = 13, ecTOO_MANY_PARAMS = 14, ecTOO_FEW_PARAMS = 15,
  ecOPRT_TYPE_CONFLICT = 16, ecSTR_RESULT = 17, ecINVALID_NAME = 18, ecINVALID_BINOP_IDENT = 19,
  ecINVALID_INFIX_IDENT = 20, ecINVALID_POSTFIX_IDENT = 21, ecBUILTIN_OVERLOAD = 22, ecINVALID_FUN_PTR = 23,
  ecINVALID_VAR_PTR = 24, ecEMPTY_EXPRESSION = 25, ecNAME_CONFLICT = 26, ecOPT_PRI = 27,
  ecDOMAIN_ERROR = 28, ecDIV_BY_ZERO = 29, ecGENERIC = 30, ecLOCALE = 31,
  ecUNEXPECTED_CONDITIONAL = 32, ecMISSING_ELSE_CLAUSE = 33, ecMISPLACED_COLON = 34, ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
  ecIDENTIFIER_TOO_LONG = 36, ecEXPRESSION_TOO_LONG = 37, ecINVALID_CHARACTERS_FOUND = 38, ecINTERNAL_ERROR = 39,
  ecCOUNT, ecUNDEFINED = -1
}
 Error codes. More...
 

Functions

std::ostream & console ()
 Encapsulate cout. More...
 
std::istream & console_in ()
 Encapsulate cin. More...
 

Variables

static constexpr int CALLBACK_INTERNAL_VAR_ARGS = 1 << 14
 
static constexpr int CALLBACK_INTERNAL_FIXED_ARGS_MASK = 0xf
 
static constexpr int CALLBACK_INTERNAL_WITH_USER_DATA = 1 << 13
 
static const int MaxLenExpression = 20000
 
static const int MaxLenIdentifier = 100
 
static const string_type ParserVersion = string_type(_T("2.3.4 (Release)"))
 
static const string_type ParserVersionDate = string_type(_T("20221019"))
 

Detailed Description

Namespace for mathematical applications.

Typedef Documentation

typedef string_type::value_type mu::char_type

The character type used by the parser.

Depends on whether UNICODE is used or not.

Definition at line 306 of file muParserDef.h.

The stringtype used by the parser.

Depends on whether UNICODE is used or not.

Definition at line 300 of file muParserDef.h.

The numeric datatype used by the parser.

Normally this is a floating point type either single or double precision.

Definition at line 294 of file muParserDef.h.

Enumeration Type Documentation

Bytecode values.

Attention
The order of the operator entries must match the order in ParserBase::c_DefaultOprt!
Enumerator
cmLE 

Operator item: less or equal.

cmGE 

Operator item: greater or equal.

cmNEQ 

Operator item: not equal.

cmEQ 

Operator item: equals.

cmLT 

Operator item: less than.

cmGT 

Operator item: greater than.

cmADD 

Operator item: add.

cmSUB 

Operator item: subtract.

cmMUL 

Operator item: multiply.

cmDIV 

Operator item: division.

cmPOW 

Operator item: y to the power of ...

cmASSIGN 

Operator item: Assignment operator.

cmBO 

Operator item: opening bracket.

cmBC 

Operator item: closing bracket.

cmIF 

For use in the ternary if-then-else operator.

cmELSE 

For use in the ternary if-then-else operator.

cmENDIF 

For use in the ternary if-then-else operator.

cmARG_SEP 

function argument separator

cmVAR 

variable item

cmVAL 

value item

cmFUNC 

Code for a generic function item.

cmFUNC_STR 

Code for a function with a string parameter.

cmFUNC_BULK 

Special callbacks for Bulk mode with an additional parameter for the bulk index.

cmSTRING 

Code for a string token.

cmOPRT_BIN 

user defined binary operator

cmOPRT_POSTFIX 

code for postfix operators

cmOPRT_INFIX 

code for infix operators

cmEND 

end of formula

cmUNKNOWN 

uninitialized item

Definition at line 135 of file muParserDef.h.

136  {
137  // The following are codes for built in binary operators
138  // apart from built in operators the user has the opportunity to
139  // add user defined operators.
140  cmLE = 0, ///< Operator item: less or equal
141  cmGE = 1, ///< Operator item: greater or equal
142  cmNEQ = 2, ///< Operator item: not equal
143  cmEQ = 3, ///< Operator item: equals
144  cmLT = 4, ///< Operator item: less than
145  cmGT = 5, ///< Operator item: greater than
146  cmADD = 6, ///< Operator item: add
147  cmSUB = 7, ///< Operator item: subtract
148  cmMUL = 8, ///< Operator item: multiply
149  cmDIV = 9, ///< Operator item: division
150  cmPOW = 10, ///< Operator item: y to the power of ...
151  cmLAND = 11,
152  cmLOR = 12,
153  cmASSIGN = 13, ///< Operator item: Assignment operator
154  cmBO = 14, ///< Operator item: opening bracket
155  cmBC = 15, ///< Operator item: closing bracket
156  cmIF = 16, ///< For use in the ternary if-then-else operator
157  cmELSE = 17, ///< For use in the ternary if-then-else operator
158  cmENDIF = 18, ///< For use in the ternary if-then-else operator
159  cmARG_SEP = 19, ///< function argument separator
160  cmVAR = 20, ///< variable item
161  cmVAL = 21, ///< value item
162 
163  // For optimization purposes
164  cmVARPOW2 = 22,
165  cmVARPOW3 = 23,
166  cmVARPOW4 = 24,
167  cmVARMUL = 25,
168 
169  // operators and functions
170  cmFUNC = 26, ///< Code for a generic function item
171  cmFUNC_STR, ///< Code for a function with a string parameter
172  cmFUNC_BULK, ///< Special callbacks for Bulk mode with an additional parameter for the bulk index
173  cmSTRING, ///< Code for a string token
174  cmOPRT_BIN, ///< user defined binary operator
175  cmOPRT_POSTFIX, ///< code for postfix operators
176  cmOPRT_INFIX, ///< code for infix operators
177  cmEND, ///< end of formula
178  cmUNKNOWN ///< uninitialized item
179  };
Operator item: closing bracket.
Definition: muParserDef.h:155
code for infix operators
Definition: muParserDef.h:176
user defined binary operator
Definition: muParserDef.h:174
function argument separator
Definition: muParserDef.h:159
Operator item: y to the power of ...
Definition: muParserDef.h:150
code for postfix operators
Definition: muParserDef.h:175
Operator item: not equal.
Definition: muParserDef.h:142
For use in the ternary if-then-else operator.
Definition: muParserDef.h:156
end of formula
Definition: muParserDef.h:177
Code for a generic function item.
Definition: muParserDef.h:170
For use in the ternary if-then-else operator.
Definition: muParserDef.h:157
Operator item: subtract.
Definition: muParserDef.h:147
For use in the ternary if-then-else operator.
Definition: muParserDef.h:158
Operator item: multiply.
Definition: muParserDef.h:148
Operator item: division.
Definition: muParserDef.h:149
Operator item: add.
Definition: muParserDef.h:146
Operator item: less than.
Definition: muParserDef.h:144
value item
Definition: muParserDef.h:161
Operator item: greater than.
Definition: muParserDef.h:145
Special callbacks for Bulk mode with an additional parameter for the bulk index.
Definition: muParserDef.h:172
Code for a function with a string parameter.
Definition: muParserDef.h:171
Operator item: equals.
Definition: muParserDef.h:143
uninitialized item
Definition: muParserDef.h:178
Operator item: Assignment operator.
Definition: muParserDef.h:153
Code for a string token.
Definition: muParserDef.h:173
Operator item: less or equal.
Definition: muParserDef.h:140
variable item
Definition: muParserDef.h:160
Operator item: greater or equal.
Definition: muParserDef.h:141
Operator item: opening bracket.
Definition: muParserDef.h:154

Error codes.

Enumerator
ecUNEXPECTED_OPERATOR 

Unexpected binary operator found.

ecUNASSIGNABLE_TOKEN 

Token can't be identified.

ecUNEXPECTED_EOF 

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

ecUNEXPECTED_ARG_SEP 

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

ecUNEXPECTED_ARG 

An unexpected argument has been found.

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)")

ecOPRT_TYPE_CONFLICT 

binary operators may only be applied to value items of the same type

ecSTR_RESULT 

result is a string

ecINVALID_NAME 

Invalid function, variable or constant name.

ecINVALID_BINOP_IDENT 

Invalid binary operator identifier.

ecINVALID_INFIX_IDENT 

Invalid function, variable or constant name.

ecINVALID_POSTFIX_IDENT 

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.

ecEMPTY_EXPRESSION 

The Expression is empty.

ecNAME_CONFLICT 

Name conflict.

ecOPT_PRI 

Invalid operator priority.

ecDOMAIN_ERROR 

catch division by zero, sqrt(-1), log(0) (currently unused)

ecDIV_BY_ZERO 

Division by zero (currently unused)

ecGENERIC 

Generic error.

ecLOCALE 

Conflict with current locale.

ecIDENTIFIER_TOO_LONG 

Thrown when an identifier with more then 255 characters is used.

ecEXPRESSION_TOO_LONG 

Throw an exception if the expression has more than 10000 characters. (an arbitrary limit)

ecINVALID_CHARACTERS_FOUND 

The expression or identifier contains invalid non printable characters.

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.

Definition at line 226 of file muParserDef.h.

227  {
228  // Formula syntax errors
229  ecUNEXPECTED_OPERATOR = 0, ///< Unexpected binary operator found
230  ecUNASSIGNABLE_TOKEN = 1, ///< Token can't be identified.
231  ecUNEXPECTED_EOF = 2, ///< Unexpected end of formula. (Example: "2+sin(")
232  ecUNEXPECTED_ARG_SEP = 3, ///< An unexpected comma has been found. (Example: "1,23")
233  ecUNEXPECTED_ARG = 4, ///< An unexpected argument has been found
234  ecUNEXPECTED_VAL = 5, ///< An unexpected value token has been found
235  ecUNEXPECTED_VAR = 6, ///< An unexpected variable token has been found
236  ecUNEXPECTED_PARENS = 7, ///< Unexpected Parenthesis, opening or closing
237  ecUNEXPECTED_STR = 8, ///< A string has been found at an inapropriate position
238  ecSTRING_EXPECTED = 9, ///< A string function has been called with a different type of argument
239  ecVAL_EXPECTED = 10, ///< A numerical function has been called with a non value type of argument
240  ecMISSING_PARENS = 11, ///< Missing parens. (Example: "3*sin(3")
241  ecUNEXPECTED_FUN = 12, ///< Unexpected function found. (Example: "sin(8)cos(9)")
242  ecUNTERMINATED_STRING = 13, ///< unterminated string constant. (Example: "3*valueof("hello)")
243  ecTOO_MANY_PARAMS = 14, ///< Too many function parameters
244  ecTOO_FEW_PARAMS = 15, ///< Too few function parameters. (Example: "ite(1<2,2)")
245  ecOPRT_TYPE_CONFLICT = 16, ///< binary operators may only be applied to value items of the same type
246  ecSTR_RESULT = 17, ///< result is a string
247 
248  // Invalid Parser input Parameters
249  ecINVALID_NAME = 18, ///< Invalid function, variable or constant name.
250  ecINVALID_BINOP_IDENT = 19, ///< Invalid binary operator identifier
251  ecINVALID_INFIX_IDENT = 20, ///< Invalid function, variable or constant name.
252  ecINVALID_POSTFIX_IDENT = 21, ///< Invalid function, variable or constant name.
253 
254  ecBUILTIN_OVERLOAD = 22, ///< Trying to overload builtin operator
255  ecINVALID_FUN_PTR = 23, ///< Invalid callback function pointer
256  ecINVALID_VAR_PTR = 24, ///< Invalid variable pointer
257  ecEMPTY_EXPRESSION = 25, ///< The Expression is empty
258  ecNAME_CONFLICT = 26, ///< Name conflict
259  ecOPT_PRI = 27, ///< Invalid operator priority
260  //
261  ecDOMAIN_ERROR = 28, ///< catch division by zero, sqrt(-1), log(0) (currently unused)
262  ecDIV_BY_ZERO = 29, ///< Division by zero (currently unused)
263  ecGENERIC = 30, ///< Generic error
264  ecLOCALE = 31, ///< Conflict with current locale
265 
266  ecUNEXPECTED_CONDITIONAL = 32,
267  ecMISSING_ELSE_CLAUSE = 33,
268  ecMISPLACED_COLON = 34,
269 
270  ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
271 
272  ecIDENTIFIER_TOO_LONG = 36, ///< Thrown when an identifier with more then 255 characters is used.
273 
274  ecEXPRESSION_TOO_LONG = 37, ///< Throw an exception if the expression has more than 10000 characters. (an arbitrary limit)
275 
276  ecINVALID_CHARACTERS_FOUND = 38,///< The expression or identifier contains invalid non printable characters
277 
278  // internal errors
279  ecINTERNAL_ERROR = 39, ///< Internal error of any kind.
280 
281  // The last two are special entries
282  ecCOUNT, ///< This is no error code, It just stores just the total number of error codes
283  ecUNDEFINED = -1 ///< Undefined message, placeholder to detect unassigned error messages
284  };
binary operators may only be applied to value items of the same type
Definition: muParserDef.h:245
An unexpected comma has been found. (Example: "1,23")
Definition: muParserDef.h:232
Token can't be identified.
Definition: muParserDef.h:230
result is a string
Definition: muParserDef.h:246
An unexpected argument has been found.
Definition: muParserDef.h:233
Division by zero (currently unused)
Definition: muParserDef.h:262
Throw an exception if the expression has more than 10000 characters. (an arbitrary limit) ...
Definition: muParserDef.h:274
Name conflict.
Definition: muParserDef.h:258
Internal error of any kind.
Definition: muParserDef.h:279
unterminated string constant. (Example: "3*valueof("hello)")
Definition: muParserDef.h:242
Trying to overload builtin operator.
Definition: muParserDef.h:254
Undefined message, placeholder to detect unassigned error messages.
Definition: muParserDef.h:283
Unexpected function found. (Example: "sin(8)cos(9)")
Definition: muParserDef.h:241
This is no error code, It just stores just the total number of error codes.
Definition: muParserDef.h:282
An unexpected value token has been found.
Definition: muParserDef.h:234
Conflict with current locale.
Definition: muParserDef.h:264
catch division by zero, sqrt(-1), log(0) (currently unused)
Definition: muParserDef.h:261
An unexpected variable token has been found.
Definition: muParserDef.h:235
Invalid variable pointer.
Definition: muParserDef.h:256
Invalid function, variable or constant name.
Definition: muParserDef.h:249
The Expression is empty.
Definition: muParserDef.h:257
Too many function parameters.
Definition: muParserDef.h:243
A numerical function has been called with a non value type of argument.
Definition: muParserDef.h:239
Unexpected end of formula. (Example: "2+sin(")
Definition: muParserDef.h:231
Too few function parameters. (Example: "ite(1<2,2)")
Definition: muParserDef.h:244
A string function has been called with a different type of argument.
Definition: muParserDef.h:238
Thrown when an identifier with more then 255 characters is used.
Definition: muParserDef.h:272
Unexpected binary operator found.
Definition: muParserDef.h:229
Invalid operator priority.
Definition: muParserDef.h:259
Unexpected Parenthesis, opening or closing.
Definition: muParserDef.h:236
Invalid function, variable or constant name.
Definition: muParserDef.h:252
Invalid callback function pointer.
Definition: muParserDef.h:255
The expression or identifier contains invalid non printable characters.
Definition: muParserDef.h:276
Generic error.
Definition: muParserDef.h:263
Missing parens. (Example: "3*sin(3")
Definition: muParserDef.h:240
A string has been found at an inapropriate position.
Definition: muParserDef.h:237
Invalid function, variable or constant name.
Definition: muParserDef.h:251
Invalid binary operator identifier.
Definition: muParserDef.h:250

Parser operator precedence values.

Enumerator
prLOGIC 

logic operators

prCMP 

comparsion operators

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)

Definition at line 208 of file muParserDef.h.

209  {
210  // binary operators
211  prLOR = 1,
212  prLAND = 2,
213  prLOGIC = 3, ///< logic operators
214  prCMP = 4, ///< comparsion operators
215  prADD_SUB = 5, ///< addition
216  prMUL_DIV = 6, ///< multiplication/division
217  prPOW = 7, ///< power operator priority (highest)
218 
219  // infix operators
220  prINFIX = 6, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
221  prPOSTFIX = 6 ///< Postfix operator priority (currently unused)
222  };
multiplication/division
Definition: muParserDef.h:216
Postfix operator priority (currently unused)
Definition: muParserDef.h:221
power operator priority (highest)
Definition: muParserDef.h:217
comparsion operators
Definition: muParserDef.h:214
addition
Definition: muParserDef.h:215
logic operators
Definition: muParserDef.h:213
Signs have a higher priority than ADD_SUB, but lower than power operator.
Definition: muParserDef.h:220

Types internally used by the parser.

Enumerator
tpSTR 

String type (Function arguments and constants only, no string variables)

tpDBL 

Floating point variables.

tpVOID 

Undefined type.

Definition at line 183 of file muParserDef.h.

184  {
185  tpSTR = 0, ///< String type (Function arguments and constants only, no string variables)
186  tpDBL = 1, ///< Floating point variables
187  tpVOID = 2 ///< Undefined type.
188  };
String type (Function arguments and constants only, no string variables)
Definition: muParserDef.h:185
Undefined type.
Definition: muParserDef.h:187
Floating point variables.
Definition: muParserDef.h:186

Function Documentation

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

Encapsulate cout.

Used for supporting UNICODE more easily.

Definition at line 115 of file muParserDef.h.

Referenced by mu::ParserByteCode::AsciiDump().

116  {
117  return std::cout;
118  }
std::istream& mu::console_in ( )
inline

Encapsulate cin.

Used for supporting UNICODE more easily.

Definition at line 124 of file muParserDef.h.

125  {
126  return std::cin;
127  }