muParser API -  1.35
muParserDef.h
Go to the documentation of this file.
1 /*
2 
3  _____ __ _____________ _______ ______ ___________
4  / \| | \____ \__ \\_ __ \/ ___// __ \_ __ \
5  | Y Y \ | / |_> > __ \| | \/\___ \\ ___/| | \/
6  |__|_| /____/| __(____ /__| /____ >\___ >__|
7  \/ |__| \/ \/ \/
8  Copyright (C) 2004 - 2022 Ingo Berg
9 
10  Redistribution and use in source and binary forms, with or without modification, are permitted
11  provided that the following conditions are met:
12 
13  * Redistributions of source code must retain the above copyright notice, this list of
14  conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright notice, this list of
16  conditions and the following disclaimer in the documentation and/or other materials provided
17  with the distribution.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
20  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef MUP_DEF_H
30 #define MUP_DEF_H
31 
32 #include <iostream>
33 #include <string>
34 #include <sstream>
35 #include <map>
36 
37 #include "muParserFixes.h"
38 
39 /** \file
40  \brief This file contains standard definitions used by the parser.
41 */
42 
43 /** \brief Define the base datatype for values.
44 
45  This datatype must be a built in value type. You can not use custom classes.
46  It should be working with all types except "int"!
47 */
48 #define MUP_BASETYPE double
49 
50 /** \brief Activate this option in order to compile with OpenMP support.
51 
52  OpenMP is used only in the bulk mode it may increase the performance a bit.
53 
54  !!! DO NOT ACTIVATE THIS MACRO HERE IF YOU USE CMAKE FOR BUILDING !!!
55 
56  use the cmake option instead!
57 */
58 //#define MUP_USE_OPENMP
59 
60 #if defined(_UNICODE)
61  /** \brief Definition of the basic parser string type. */
62  #define MUP_STRING_TYPE std::wstring
63 
64  #if !defined(_T)
65  #define _T(x) L##x
66  #endif // not defined _T
67 #else
68  #ifndef _T
69  #define _T(x) x
70  #endif
71 
72  /** \brief Definition of the basic parser string type. */
73  #define MUP_STRING_TYPE std::string
74 #endif
75 
76 /** \brief An assertion that does not kill the program. */
77 #define MUP_ASSERT(COND) \
78  if (!(COND)) \
79  { \
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()); \
85  }
86 
87 #if defined(_MSC_VER)
88  #pragma warning(push)
89  #pragma warning(disable : 26812)
90 #endif
91 
92 
93 namespace mu
94 {
95 #if defined(_UNICODE)
96 
97  /** \brief Encapsulate wcout. */
98  inline std::wostream& console()
99  {
100  return std::wcout;
101  }
102 
103  /** \brief Encapsulate cin. */
104  inline std::wistream& console_in()
105  {
106  return std::wcin;
107  }
108 
109 #else
110 
111  /** \brief Encapsulate cout.
112 
113  Used for supporting UNICODE more easily.
114  */
115  inline std::ostream& console()
116  {
117  return std::cout;
118  }
119 
120  /** \brief Encapsulate cin.
121 
122  Used for supporting UNICODE more easily.
123  */
124  inline std::istream& console_in()
125  {
126  return std::cin;
127  }
128 
129 #endif
130 
131  /** \brief Bytecode values.
132 
133  \attention The order of the operator entries must match the order in ParserBase::c_DefaultOprt!
134  */
135  enum ECmdCode
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  };
180 
181  /** \brief Types internally used by the parser.
182  */
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  };
189 
190 
191  enum EParserVersionInfo
192  {
193  pviBRIEF,
194  pviFULL
195  };
196 
197 
198  /** \brief Parser operator precedence values. */
200  {
201  oaLEFT = 0,
202  oaRIGHT = 1,
203  oaNONE = 2
204  };
205 
206 
207  /** \brief Parser operator precedence values. */
209  {
210  prLOR = 1, ///< logic or
211  prLAND = 2, ///< logic and
212  prBOR = 3, ///< bitwise or
213  prBAND = 4, ///< bitwise and
214  prCMP = 5, ///< comparsion operators
215  prADD_SUB = 6, ///< addition
216  prMUL_DIV = 7, ///< multiplication/division
217  prPOW = 8, ///< power operator priority (highest)
218 
219  // infix operators
220  prINFIX = 7, ///< Signs have a higher priority than ADD_SUB, but lower than power operator
221  prPOSTFIX = 7 ///< Postfix operator priority (currently unused)
222  };
223 
224 
225  /** \brief Error codes. */
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  ecBYTECODE_IMPORT_EXPORT_DISABLED = 40, ///< Bytecode cannot be exported.
282 
283  // The last two are special entries
284  ecCOUNT, ///< This is no error code, It just stores just the total number of error codes
285  ecUNDEFINED = -1 ///< Undefined message, placeholder to detect unassigned error messages
286  };
287 
288  //------------------------------------------------------------------------------
289  // Basic Types
290  //------------------------------------------------------------------------------
291 
292  /** \brief The numeric datatype used by the parser.
293 
294  Normally this is a floating point type either single or double precision.
295  */
297 
298  /** \brief The stringtype used by the parser.
299 
300  Depends on whether UNICODE is used or not.
301  */
303 
304  /** \brief The character type used by the parser.
305 
306  Depends on whether UNICODE is used or not.
307  */
309 
310  /** \brief Typedef for easily using stringstream that respect the parser stringtype. */
311  typedef std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type> > stringstream_type;
312 
313  // Data container types
314 
315  /** \brief Type used for storing variables. */
316  typedef std::map<string_type, value_type*> varmap_type;
317 
318  /** \brief Type used for storing constants. */
319  typedef std::map<string_type, value_type> valmap_type;
320 
321  /** \brief Type for assigning a string name to an index in the internal string table. */
322  typedef std::map<string_type, std::size_t> strmap_type;
323 
324  // Parser callbacks
325 
326  /** \brief Function type used to erase type. Voluntarily needs explicit cast with all other *fun_type*. */
327  typedef void(*erased_fun_type)();
328 
329  /** \brief Callback type used for functions without arguments. */
330  typedef value_type(*fun_type0)();
331 
332  /** \brief Callback type used for functions with a single arguments. */
334 
335  /** \brief Callback type used for functions with two arguments. */
337 
338  /** \brief Callback type used for functions with three arguments. */
340 
341  /** \brief Callback type used for functions with four arguments. */
343 
344  /** \brief Callback type used for functions with five arguments. */
346 
347  /** \brief Callback type used for functions with six arguments. */
349 
350  /** \brief Callback type used for functions with seven arguments. */
352 
353  /** \brief Callback type used for functions with eight arguments. */
355 
356  /** \brief Callback type used for functions with nine arguments. */
358 
359  /** \brief Callback type used for functions with ten arguments. */
361 
362  /** \brief Callback type with user data (not null) used for functions without arguments. */
363  typedef value_type(*fun_userdata_type0)(void*);
364 
365  /** \brief Callback type with user data (not null) used for functions with a single arguments. */
367 
368  /** \brief Callback type with user data (not null) used for functions with two arguments. */
370 
371  /** \brief Callback type with user data (not null) used for functions with three arguments. */
373 
374  /** \brief Callback type with user data (not null) used for functions with four arguments. */
376 
377  /** \brief Callback type with user data (not null) used for functions with five arguments. */
379 
380  /** \brief Callback type with user data (not null) used for functions with six arguments. */
382 
383  /** \brief Callback type with user data (not null) used for functions with seven arguments. */
385 
386  /** \brief Callback type with user data (not null) used for functions with eight arguments. */
388 
389  /** \brief Callback type with user data (not null) used for functions with nine arguments. */
391 
392  /** \brief Callback type with user data (not null) used for functions with ten arguments. */
394 
395  /** \brief Callback type used for functions without arguments. */
396  typedef value_type(*bulkfun_type0)(int, int);
397 
398  /** \brief Callback type used for functions with a single arguments. */
399  typedef value_type(*bulkfun_type1)(int, int, value_type);
400 
401  /** \brief Callback type used for functions with two arguments. */
403 
404  /** \brief Callback type used for functions with three arguments. */
406 
407  /** \brief Callback type used for functions with four arguments. */
409 
410  /** \brief Callback type used for functions with five arguments. */
412 
413  /** \brief Callback type used for functions with six arguments. */
415 
416  /** \brief Callback type used for functions with seven arguments. */
418 
419  /** \brief Callback type used for functions with eight arguments. */
421 
422  /** \brief Callback type used for functions with nine arguments. */
424 
425  /** \brief Callback type used for functions with ten arguments. */
427 
428  /** \brief Callback type with user data (not null) used for functions without arguments. */
429  typedef value_type(*bulkfun_userdata_type0)(void*, int, int);
430 
431  /** \brief Callback type with user data (not null) used for functions with a single arguments. */
432  typedef value_type(*bulkfun_userdata_type1)(void*, int, int, value_type);
433 
434  /** \brief Callback type with user data (not null) used for functions with two arguments. */
436 
437  /** \brief Callback type with user data (not null) used for functions with three arguments. */
439 
440  /** \brief Callback type with user data (not null) used for functions with four arguments. */
442 
443  /** \brief Callback type with user data (not null) used for functions with five arguments. */
445 
446  /** \brief Callback type with user data (not null) used for functions with six arguments. */
448 
449  /** \brief Callback type with user data (not null) used for functions with seven arguments. */
451 
452  /** \brief Callback type with user data (not null) used for functions with eight arguments. */
454 
455  /** \brief Callback type with user data (not null) used for functions with nine arguments. */
457 
458  /** \brief Callback type with user data (not null) used for functions with ten arguments. */
460 
461  /** \brief Callback type used for functions with a variable argument list. */
462  typedef value_type(*multfun_type)(const value_type*, int);
463 
464  /** \brief Callback type with user data (not null) used for functions and a variable argument list. */
465  typedef value_type(*multfun_userdata_type)(void*, const value_type*, int);
466 
467  /** \brief Callback type used for functions taking a string as an argument. */
468  typedef value_type(*strfun_type1)(const char_type*);
469 
470  /** \brief Callback type used for functions taking a string and a value as arguments. */
471  typedef value_type(*strfun_type2)(const char_type*, value_type);
472 
473  /** \brief Callback type used for functions taking a string and two values as arguments. */
474  typedef value_type(*strfun_type3)(const char_type*, value_type, value_type);
475 
476  /** \brief Callback type used for functions taking a string and three values as arguments. */
477  typedef value_type(*strfun_type4)(const char_type*, value_type, value_type, value_type);
478 
479  /** \brief Callback type used for functions taking a string and four values as arguments. */
481 
482  /** \brief Callback type used for functions taking a string and five values as arguments. */
484 
485  /** \brief Callback type with user data (not null) used for functions taking a string as an argument. */
486  typedef value_type(*strfun_userdata_type1)(void*, const char_type*);
487 
488  /** \brief Callback type with user data (not null) used for functions taking a string and a value as arguments. */
489  typedef value_type(*strfun_userdata_type2)(void*, const char_type*, value_type);
490 
491  /** \brief Callback type with user data (not null) used for functions taking a string and two values as arguments. */
492  typedef value_type(*strfun_userdata_type3)(void*, const char_type*, value_type, value_type);
493 
494  /** \brief Callback type with user data (not null) used for functions taking a string and a value as arguments. */
495  typedef value_type(*strfun_userdata_type4)(void*, const char_type*, value_type, value_type, value_type);
496 
497  /** \brief Callback type with user data (not null) used for functions taking a string and two values as arguments. */
499 
500  /** \brief Callback type with user data (not null) used for functions taking a string and five values as arguments. */
502 
503  /** \brief Callback used for functions that identify values in a string. */
504  typedef int (*identfun_type)(const char_type* sExpr, int* nPos, value_type* fVal);
505 
506  /** \brief Callback used for variable creation factory functions. */
507  typedef value_type* (*facfun_type)(const char_type*, void*);
508 
509  static const int MaxLenExpression = 20000;
510  static const int MaxLenIdentifier = 100;
511  static const string_type ParserVersion = string_type(_T("2.3.5 (Release)"));
512  static const string_type ParserVersionDate = string_type(_T("20241213"));
513 } // end of namespace
514 
515 #if defined(_MSC_VER)
516  #pragma warning(pop)
517 #endif
518 
519 #endif
520 
Operator item: closing bracket.
Definition: muParserDef.h:155
code for infix operators
Definition: muParserDef.h:176
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...
Definition: muParserDef.h:465
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
Definition: muParserDef.h:468
multiplication/division
Definition: muParserDef.h:216
user defined binary operator
Definition: muParserDef.h:174
bitwise and
Definition: muParserDef.h:213
#define _T(x)
Activate this option in order to compile with OpenMP support.
Definition: muParserDef.h:69
value_type(* bulkfun_type1)(int, int, value_type)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:399
binary operators may only be applied to value items of the same type
Definition: muParserDef.h:245
bitwise or
Definition: muParserDef.h:212
An unexpected comma has been found. (Example: "1,23")
Definition: muParserDef.h:232
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.
Definition: muParserDef.h:483
std::ostream & console()
Encapsulate cout.
Definition: muParserDef.h:115
Token can't be identified.
Definition: muParserDef.h:230
result is a string
Definition: muParserDef.h:246
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.
Definition: muParserDef.h:459
An unexpected argument has been found.
Definition: muParserDef.h:233
Division by zero (currently unused)
Definition: muParserDef.h:262
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.
Definition: muParserDef.h:387
Throw an exception if the expression has more than 10000 characters. (an arbitrary limit) ...
Definition: muParserDef.h:274
#define MUP_STRING_TYPE
Definition of the basic parser string type.
Definition: muParserDef.h:73
Postfix operator priority (currently unused)
Definition: muParserDef.h:221
std::map< string_type, std::size_t > strmap_type
Type for assigning a string name to an index in the internal string table.
Definition: muParserDef.h:322
Name conflict.
Definition: muParserDef.h:258
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
Definition: muParserDef.h:316
value_type(* bulkfun_userdata_type0)(void *, int, int)
Callback type with user data (not null) used for functions without arguments.
Definition: muParserDef.h:429
function argument separator
Definition: muParserDef.h:159
Operator item: y to the power of ...
Definition: muParserDef.h:150
Internal error of any kind.
Definition: muParserDef.h:279
code for postfix operators
Definition: muParserDef.h:175
unterminated string constant. (Example: "3*valueof("hello)")
Definition: muParserDef.h:242
Trying to overload builtin operator.
Definition: muParserDef.h:254
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.
Definition: muParserDef.h:420
Undefined message, placeholder to detect unassigned error messages.
Definition: muParserDef.h:285
Operator item: not equal.
Definition: muParserDef.h:142
For use in the ternary if-then-else operator.
Definition: muParserDef.h:156
value_type(* fun_type5)(value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:345
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.
Definition: muParserDef.h:384
value_type(* bulkfun_type2)(int, int, value_type, value_type)
Callback type used for functions with two arguments.
Definition: muParserDef.h:402
value_type(* fun_type1)(value_type)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:333
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.
Definition: muParserDef.h:456
#define MUP_BASETYPE
Define the base datatype for values.
Definition: muParserDef.h:48
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.
Definition: muParserDef.h:477
Unexpected function found. (Example: "sin(8)cos(9)")
Definition: muParserDef.h:241
value_type(* fun_userdata_type0)(void *)
Callback type with user data (not null) used for functions without arguments.
Definition: muParserDef.h:363
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...
Definition: muParserDef.h:495
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.
Definition: muParserDef.h:423
end of formula
Definition: muParserDef.h:177
power operator priority (highest)
Definition: muParserDef.h:217
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.
Definition: muParserDef.h:311
This is no error code, It just stores just the total number of error codes.
Definition: muParserDef.h:284
value_type(* strfun_type3)(const char_type *, value_type, value_type)
Callback type used for functions taking a string and two values as arguments.
Definition: muParserDef.h:474
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.
Definition: muParserDef.h:438
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.
Definition: muParserDef.h:381
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...
Definition: muParserDef.h:489
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
Definition: muParserDef.h:462
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.
Definition: muParserDef.h:390
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.
Definition: muParserDef.h:444
Code for a generic function item.
Definition: muParserDef.h:170
EOprtAssociativity
Parser operator precedence values.
Definition: muParserDef.h:199
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.
Definition: muParserDef.h:354
value_type(* bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:411
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.
Definition: muParserDef.h:414
An unexpected value token has been found.
Definition: muParserDef.h:234
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.
Definition: muParserDef.h:480
Conflict with current locale.
Definition: muParserDef.h:264
comparsion operators
Definition: muParserDef.h:214
std::map< string_type, value_type > valmap_type
Type used for storing constants.
Definition: muParserDef.h:319
For use in the ternary if-then-else operator.
Definition: muParserDef.h:157
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
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.
Definition: muParserDef.h:360
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.
Definition: muParserDef.h:357
ETypeCode
Types internally used by the parser.
Definition: muParserDef.h:183
Invalid variable pointer.
Definition: muParserDef.h:256
Invalid function, variable or constant name.
Definition: muParserDef.h:249
Operator item: subtract.
Definition: muParserDef.h:147
value_type(* bulkfun_userdata_type1)(void *, int, int, value_type)
Callback type with user data (not null) used for functions with a single arguments.
Definition: muParserDef.h:432
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.
Definition: muParserDef.h:378
value_type(* fun_type2)(value_type, value_type)
Callback type used for functions with two arguments.
Definition: muParserDef.h:336
addition
Definition: muParserDef.h:215
For use in the ternary if-then-else operator.
Definition: muParserDef.h:158
ECmdCode
Bytecode values.
Definition: muParserDef.h:135
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.
Definition: muParserDef.h:372
Operator item: multiply.
Definition: muParserDef.h:148
value_type(* fun_userdata_type1)(void *, value_type)
Callback type with user data (not null) used for functions with a single arguments.
Definition: muParserDef.h:366
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:296
String type (Function arguments and constants only, no string variables)
Definition: muParserDef.h:185
Operator item: division.
Definition: muParserDef.h:149
The Expression is empty.
Definition: muParserDef.h:257
value_type(* strfun_type2)(const char_type *, value_type)
Callback type used for functions taking a string and a value as arguments.
Definition: muParserDef.h:471
Too many function parameters.
Definition: muParserDef.h:243
Operator item: add.
Definition: muParserDef.h:146
A numerical function has been called with a non value type of argument.
Definition: muParserDef.h:239
logic or
Definition: muParserDef.h:210
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.
Definition: muParserDef.h:447
Namespace for mathematical applications.
Definition: muParser.cpp:48
Unexpected end of formula. (Example: "2+sin(")
Definition: muParserDef.h:231
Operator item: less than.
Definition: muParserDef.h:144
int(* identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal)
Callback used for functions that identify values in a string.
Definition: muParserDef.h:504
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
value item
Definition: muParserDef.h:161
value_type(* fun_type3)(value_type, value_type, value_type)
Callback type used for functions with three arguments.
Definition: muParserDef.h:339
value_type(* fun_type0)()
Callback type used for functions without arguments.
Definition: muParserDef.h:330
Operator item: greater than.
Definition: muParserDef.h:145
Undefined type.
Definition: muParserDef.h:187
Special callbacks for Bulk mode with an additional parameter for the bulk index.
Definition: muParserDef.h:172
string_type::value_type char_type
The character type used by the parser.
Definition: muParserDef.h:308
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.
Definition: muParserDef.h:453
Code for a function with a string parameter.
Definition: muParserDef.h:171
Thrown when an identifier with more then 255 characters is used.
Definition: muParserDef.h:272
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.
Definition: muParserDef.h:417
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.
Definition: muParserDef.h:375
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.
Definition: muParserDef.h:435
Bytecode cannot be exported.
Definition: muParserDef.h:281
EOprtPrecedence
Parser operator precedence values.
Definition: muParserDef.h:208
Operator item: equals.
Definition: muParserDef.h:143
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...
Definition: muParserDef.h:492
uninitialized item
Definition: muParserDef.h:178
Operator item: Assignment operator.
Definition: muParserDef.h:153
value_type(* fun_type4)(value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
Definition: muParserDef.h:342
void(* erased_fun_type)()
Function type used to erase type. Voluntarily needs explicit cast with all other fun_type.
Definition: muParserDef.h:327
Unexpected binary operator found.
Definition: muParserDef.h:229
MUP_STRING_TYPE string_type
The stringtype used by the parser.
Definition: muParserDef.h:302
Invalid operator priority.
Definition: muParserDef.h:259
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.
Definition: muParserDef.h:486
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.
Definition: muParserDef.h:351
Code for a string token.
Definition: muParserDef.h:173
Operator item: less or equal.
Definition: muParserDef.h:140
value_type(* bulkfun_type4)(int, int, value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
Definition: muParserDef.h:408
variable item
Definition: muParserDef.h:160
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.
Definition: muParserDef.h:441
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...
Definition: muParserDef.h:498
value_type(* fun_userdata_type2)(void *, value_type, value_type)
Callback type with user data (not null) used for functions with two arguments.
Definition: muParserDef.h:369
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.
Definition: muParserDef.h:393
Unexpected Parenthesis, opening or closing.
Definition: muParserDef.h:236
Invalid function, variable or constant name.
Definition: muParserDef.h:252
Operator item: greater or equal.
Definition: muParserDef.h:141
Invalid callback function pointer.
Definition: muParserDef.h:255
The expression or identifier contains invalid non printable characters.
Definition: muParserDef.h:276
std::istream & console_in()
Encapsulate cin.
Definition: muParserDef.h:124
value_type(* bulkfun_type0)(int, int)
Callback type used for functions without arguments.
Definition: muParserDef.h:396
Floating point variables.
Definition: muParserDef.h:186
value_type(* bulkfun_type3)(int, int, value_type, value_type, value_type)
Callback type used for functions with three arguments.
Definition: muParserDef.h:405
EErrorCodes
Error codes.
Definition: muParserDef.h:226
Generic error.
Definition: muParserDef.h:263
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.
Definition: muParserDef.h:450
Missing parens. (Example: "3*sin(3")
Definition: muParserDef.h:240
A string has been found at an inapropriate position.
Definition: muParserDef.h:237
Signs have a higher priority than ADD_SUB, but lower than power operator.
Definition: muParserDef.h:220
value_type(* fun_type6)(value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with six arguments.
Definition: muParserDef.h:348
Invalid function, variable or constant name.
Definition: muParserDef.h:251
Operator item: opening bracket.
Definition: muParserDef.h:154
Invalid binary operator identifier.
Definition: muParserDef.h:250
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...
Definition: muParserDef.h:501
logic and
Definition: muParserDef.h:211
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.
Definition: muParserDef.h:426