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;
388 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);
391 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);
412 typedef int (*
identfun_type)(
const char_type* sExpr,
int* nPos, value_type* fVal);
415 typedef value_type* (*facfun_type)(
const char_type*,
void*);
417 static const int MaxLenExpression = 5000;
418 static const int MaxLenIdentifier = 100;
419 static const string_type ParserVersion =
string_type(
_T(
"2.3.2"));
420 static const string_type ParserVersionDate =
string_type(
_T(
"20200617"));
423 #if defined(_MSC_VER)
Operator item: closing bracket.
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")
std::ostream & console()
Encapsulate cout.
Token can't be identified.
An unexpected argument has been found.
Division by zero (currently unused)
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.
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(* 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.
#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 a value as arguments.
Unexpected function found. (Example: "sin(8)cos(9)")
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(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
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 two 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(* fun_type2)(value_type, value_type)
Callback type used for functions with two arguments.
For use in the ternary if-then-else operator.
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.
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.
value_type(* generic_fun_type)()
Callback type used for functions without arguments.
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.
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.
EOprtPrecedence
Parser operator precedence values.
Operator item: Assignment operator.
value_type(* fun_type4)(value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
Unexpected binary operator found.
MUP_STRING_TYPE string_type
The stringtype used by the parser.
Invalid operator priority.
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.
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.
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(* 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.