48 #define MUP_BASETYPE double
62 #define MUP_STRING_TYPE std::wstring
66 #endif // not defined _T
73 #define MUP_STRING_TYPE std::string
77 #define MUP_ASSERT(COND) \
80 stringstream_type ss; \
81 ss << _T("Assertion \"") _T(#COND) _T("\" failed: ") \
82 << __FILE__ << _T(" line ") \
83 << __LINE__ << _T("."); \
84 throw ParserError( ecINTERNAL_ERROR, -1, ss.str()); \
89 #pragma warning(disable : 26812)
191 enum EParserVersionInfo
266 ecUNEXPECTED_CONDITIONAL = 32,
267 ecMISSING_ELSE_CLAUSE = 33,
268 ecMISPLACED_COLON = 34,
270 ecUNREASONABLE_NUMBER_OF_COMPUTATIONS = 35,
309 typedef std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type> >
stringstream_type;
391 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);
421 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);
424 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);
451 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);
454 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);
457 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);
502 typedef int (*
identfun_type)(
const char_type* sExpr,
int* nPos, value_type* fVal);
505 typedef value_type* (*facfun_type)(
const char_type*,
void*);
507 static const int MaxLenExpression = 20000;
508 static const int MaxLenIdentifier = 100;
509 static const string_type ParserVersion =
string_type(
_T(
"2.3.4 (Release)"));
510 static const string_type ParserVersionDate =
string_type(
_T(
"20221019"));
513 #if defined(_MSC_VER)
Operator item: closing bracket.
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...
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
user defined binary operator
#define _T(x)
Activate this option in order to compile with OpenMP support.
value_type(* bulkfun_type1)(int, int, value_type)
Callback type used for functions with a single arguments.
binary operators may only be applied to value items of the same type
An unexpected comma has been found. (Example: "1,23")
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.
std::ostream & console()
Encapsulate cout.
Token can't be identified.
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.
An unexpected argument has been found.
Division by zero (currently unused)
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.
Throw an exception if the expression has more than 10000 characters. (an arbitrary limit) ...
#define MUP_STRING_TYPE
Definition of the basic parser string type.
Postfix operator priority (currently unused)
std::map< string_type, std::size_t > strmap_type
Type for assigning a string name to an index in the internal string table.
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
value_type(* bulkfun_userdata_type0)(void *, int, int)
Callback type with user data (not null) used for functions without arguments.
function argument separator
Operator item: y to the power of ...
Internal error of any kind.
code for postfix operators
unterminated string constant. (Example: "3*valueof("hello)")
Trying to overload builtin operator.
This file contains compatibility fixes for some platforms.
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.
Undefined message, placeholder to detect unassigned error messages.
Operator item: not equal.
For use in the ternary if-then-else operator.
value_type(* fun_type5)(value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
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.
value_type(* bulkfun_type2)(int, int, value_type, value_type)
Callback type used for functions with two arguments.
value_type(* fun_type1)(value_type)
Callback type used for functions with a single arguments.
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.
#define MUP_BASETYPE
Define the base datatype for values.
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.
Unexpected function found. (Example: "sin(8)cos(9)")
value_type(* fun_userdata_type0)(void *)
Callback type with user data (not null) used for functions without arguments.
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...
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.
power operator priority (highest)
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.
This is no error code, It just stores just the total number of error codes.
value_type(* strfun_type3)(const char_type *, value_type, value_type)
Callback type used for functions taking a string and two values as arguments.
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.
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.
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...
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
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.
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.
Code for a generic function item.
EOprtAssociativity
Parser operator precedence values.
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.
value_type(* bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
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.
An unexpected value token has been found.
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.
Conflict with current locale.
std::map< string_type, value_type > valmap_type
Type used for storing constants.
For use in the ternary if-then-else operator.
catch division by zero, sqrt(-1), log(0) (currently unused)
An unexpected variable token has been found.
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.
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.
ETypeCode
Types internally used by the parser.
Invalid variable pointer.
Invalid function, variable or constant name.
value_type(* bulkfun_userdata_type1)(void *, int, int, value_type)
Callback type with user data (not null) used for functions with a single arguments.
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.
value_type(* fun_type2)(value_type, value_type)
Callback type used for functions with two arguments.
For use in the ternary if-then-else operator.
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.
value_type(* fun_userdata_type1)(void *, value_type)
Callback type with user data (not null) used for functions with a single arguments.
MUP_BASETYPE value_type
The numeric datatype used by the parser.
String type (Function arguments and constants only, no string variables)
value_type(* strfun_type2)(const char_type *, value_type)
Callback type used for functions taking a string and a value as arguments.
Too many function parameters.
A numerical function has been called with a non value type of argument.
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.
Namespace for mathematical applications.
Unexpected end of formula. (Example: "2+sin(")
Operator item: less than.
int(* identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal)
Callback used for functions that identify values in a string.
Too few function parameters. (Example: "ite(1<2,2)")
A string function has been called with a different type of argument.
value_type(* fun_type3)(value_type, value_type, value_type)
Callback type used for functions with three arguments.
value_type(* fun_type0)()
Callback type used for functions without arguments.
Operator item: greater than.
Special callbacks for Bulk mode with an additional parameter for the bulk index.
string_type::value_type char_type
The character type used by the parser.
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.
Code for a function with a string parameter.
Thrown when an identifier with more then 255 characters is used.
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.
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.
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.
EOprtPrecedence
Parser operator precedence values.
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 argument...
Operator item: Assignment operator.
value_type(* fun_type4)(value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
void(* erased_fun_type)()
Function type used to erase type. Voluntarily needs explicit cast with all other fun_type.
Unexpected binary operator found.
MUP_STRING_TYPE string_type
The stringtype used by the parser.
Invalid operator priority.
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.
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.
Operator item: less or equal.
value_type(* bulkfun_type4)(int, int, value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
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.
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 argument...
value_type(* fun_userdata_type2)(void *, value_type, value_type)
Callback type with user data (not null) used for functions with two arguments.
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.
Unexpected Parenthesis, opening or closing.
Invalid function, variable or constant name.
Operator item: greater or equal.
Invalid callback function pointer.
The expression or identifier contains invalid non printable characters.
std::istream & console_in()
Encapsulate cin.
value_type(* bulkfun_type0)(int, int)
Callback type used for functions without arguments.
Floating point variables.
value_type(* bulkfun_type3)(int, int, value_type, value_type, value_type)
Callback type used for functions with three arguments.
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.
Missing parens. (Example: "3*sin(3")
A string has been found at an inapropriate position.
Signs have a higher priority than ADD_SUB, but lower than power operator.
value_type(* fun_type6)(value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with six arguments.
Invalid function, variable or constant name.
Operator item: opening bracket.
Invalid binary operator identifier.
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 argumen...
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.