NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
muParserBase.h
Go to the documentation of this file.
1/*
2 __________
3 _____ __ __\______ \_____ _______ ______ ____ _______
4 / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
5 | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
6 |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
7 \/ \/ \/ \/
8 Copyright (C) 2012 Ingo Berg
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy of this
11 software and associated documentation files (the "Software"), to deal in the Software
12 without restriction, including without limitation the rights to use, copy, modify,
13 merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to the following conditions:
15
16 The above copyright notice and this permission notice shall be included in all copies or
17 substantial portions of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
20 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24*/
25#ifndef MU_PARSER_BASE_H
26#define MU_PARSER_BASE_H
27
28//--- Standard includes ------------------------------------------------------------------------
29#include <cmath>
30#include <string>
31#include <iostream>
32#include <map>
33#include <memory>
34#include <locale>
35#include <list>
36
37//--- Parser includes --------------------------------------------------------------------------
38#include "muParserDef.h"
39#include "muParserStack.h"
40#include "muParserTokenReader.h"
41#include "muParserBytecode.h"
42#include "muParserError.h"
43#include "muParserState.hpp"
44
45class StringView;
47
48namespace mu
49{
54 typedef std::map<std::string,std::vector<value_type>> vectormap_type;
55
56
57 //--------------------------------------------------------------------------------------------------
69 {
70 private:
71 friend class ParserTokenReader;
72
79 typedef void (ParserBase::*ParseFunction)();
80
82 typedef std::vector<string_type> stringbuf_type;
83
86
89
90 public:
91
97
98 mutable std::map<std::string, std::string>* mVarMapPntr;
99 mutable std::list<mu::value_type*> m_lDataStorage;
100
101 // Bytecode caching and loop caching interface section
102 void ActivateLoopMode(unsigned int _nLoopLength);
103 void DeactivateLoopMode();
104 void SetIndex(unsigned int _nLoopElement);
105 void SetCompiling(bool _bCompiling = true);
106 bool IsCompiling();
107 void CacheCurrentAccess(const CachedDataAccess& _access);
108 size_t HasCachedAccess();
110 bool CanCacheAccess();
111 const CachedDataAccess& GetCachedAccess(size_t nthAccess);
112 void CacheCurrentEquation(const std::string& sEquation);
113 const std::string& GetCachedEquation() const;
114 void CacheCurrentTarget(const std::string& sEquation);
115 const std::string& GetCachedTarget() const;
116 int IsValidByteCode(unsigned int _nthLoopElement = -1, unsigned int _nthPartEquation = 0);
117 bool ActiveLoopMode() const;
118 bool IsLockedPause() const;
119 void LockPause(bool _bLock = true);
120 void PauseLoopMode(bool _bPause = true);
121 bool IsAlreadyParsed(StringView sNewEquation);
122 bool IsNotLastStackItem() const;
123
124 static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
125
126 ParserBase();
127 ParserBase(const ParserBase& a_Parser);
128 ParserBase& operator=(const ParserBase& a_Parser);
129
130 virtual ~ParserBase();
131
133 value_type* Eval(int& nStackSize);
134 void Eval(value_type* results, int nBulkSize);
135
136 void SetExpr(StringView a_sExpr);
137 void SetVarFactory(facfun_type a_pFactory, void* pUserData = NULL);
138
139 void SetDecSep(char_type cDecSep);
140 void SetThousandsSep(char_type cThousandsSep = 0);
141 void ResetLocale();
142
143 void EnableOptimizer(bool a_bIsOn = true);
144 void EnableBuiltInOprt(bool a_bIsOn = true);
145
146 bool HasBuiltInOprt() const;
147 void AddValIdent(identfun_type a_pCallback);
148
155 template<typename T>
156 void DefineFun(const string_type& a_strName, T a_pFun, bool optimizeAway = true)
157 {
158 AddCallback( a_strName, ParserCallback(a_pFun, optimizeAway), m_FunDef, ValidNameChars() );
159 }
160
161 void DefineOprt(const string_type& a_strName,
162 fun_type2 a_pFun,
163 unsigned a_iPri = 0,
164 EOprtAssociativity a_eAssociativity = oaLEFT,
165 bool optimizeAway = true);
166 void DefineConst(const string_type& a_sName, value_type a_fVal);
167 void DefineStrConst(const string_type& a_sName, const string_type& a_strVal);
168 void DefineVar(const string_type& a_sName, value_type* a_fVar);
169 void DefinePostfixOprt(const string_type& a_strFun, fun_type1 a_pOprt, bool optimizeAway = true);
170 void DefineInfixOprt(const string_type& a_strName, fun_type1 a_pOprt, int a_iPrec = prINFIX, bool optimizeAway = true);
171
172 // Clear user defined variables, constants or functions
173 void ClearVar();
174 void ClearFun();
175 void ClearConst();
176 void ClearInfixOprt();
177 void ClearPostfixOprt();
178 void ClearOprt();
179
180 void RemoveVar(const string_type& a_strVarName);
181 const varmap_type& GetUsedVar();
182 const varmap_type& GetVar() const;
183 const valmap_type& GetConst() const;
184 const string_type& GetExpr() const;
185 const funmap_type& GetFunDef() const;
186 const std::map<std::string, std::vector<mu::value_type> >& GetVectors() const;
188
189 const char_type** GetOprtDef() const;
190 void DefineNameChars(const char_type* a_szCharset);
191 void DefineOprtChars(const char_type* a_szCharset);
192 void DefineInfixOprtChars(const char_type* a_szCharset);
193
194 const char_type* ValidNameChars() const;
195 const char_type* ValidOprtChars() const;
196 const char_type* ValidInfixOprtChars() const;
197
198 void SetArgSep(char_type cArgSep);
199 char_type GetArgSep() const;
200
201 void Error(EErrorCodes a_iErrc,
202 int a_iPos = (int)mu::string_type::npos,
203 const string_type& a_strTok = string_type() ) const;
204 void Error(EErrorCodes a_iErrc,
205 const string_type& a_Expr,
206 int a_iPos = (int)mu::string_type::npos,
207 const string_type& a_strTok = string_type() ) const;
208
209 string_type CreateTempVectorVar(const std::vector<mu::value_type>& vVar);
210 void SetVectorVar(const std::string& sVarName, const std::vector<mu::value_type>& vVar, bool bAddVectorType = false);
211 std::vector<mu::value_type>* GetVectorVar(const std::string& sVarName);
212 void UpdateVectorVar(const std::string& sVarName);
213 void ClearVectorVars(bool bIgnoreProcedureVects = false);
214 bool ContainsVectorVars(StringView sExpr, bool ignoreSingletons);
215
216 protected:
217
218 void Init();
219
220 virtual void InitCharSets() = 0;
221 virtual void InitFun() = 0;
222 virtual void InitConst() = 0;
223 virtual void InitOprt() = 0;
224
225 virtual void OnDetectVar(string_type* pExpr, int& nStart, int& nEnd);
226
227 static const char_type* c_DefaultOprt[];
228 static std::locale s_locale;
229 static bool g_DbgDumpCmdCode;
230 static bool g_DbgDumpStack;
231
233 template<class TChar>
234 class change_dec_sep : public std::numpunct<TChar>
235 {
236 public:
237
238 explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
239 : std::numpunct<TChar>()
240 , m_nGroup(nGroup)
241 , m_cDecPoint(cDecSep)
242 , m_cThousandsSep(cThousandsSep)
243 {}
244
245 protected:
246
248 {
249 return m_cDecPoint;
250 }
251
253 {
254 return m_cThousandsSep;
255 }
256
257 virtual std::string do_grouping() const
258 {
259 return std::string(1, m_nGroup);
260 }
261
262 private:
263
267 };
268
269 private:
270 void replaceLocalVars(std::string& sLine);
271 bool checkDelimiter(StringView sLine);
273 bool compileVectorsInMultiArgFunc(MutableStringView& sExpr, size_t& nPos);
274 size_t FindMultiArgFunc(StringView sExpr, size_t nPos, std::string& sMultArgFunc);
275 void compileVectorExpansion(MutableStringView sSubExpr, const std::string& sVectorVarName);
276 void expandVector(mu::value_type dFirst,
277 const mu::value_type& dLast,
278 const mu::value_type& dIncrement,
279 std::vector<mu::value_type>& vResults);
280 void evaluateTemporaryVectors(const VectorEvaluation& vectEval, int nStackSize);
281 string_type getNextVarObject(std::string& sArgList, bool bCut);
283 void Assign(const ParserBase& a_Parser);
284 void InitTokenReader();
285 void ReInit();
287
288 void AddCallback( const string_type& a_strName,
289 const ParserCallback& a_Callback,
290 funmap_type& a_Storage,
291 const char_type* a_szCharSet );
292
294 ParserStack<token_type>& a_stVal) const;
296 ParserStack<token_type>& a_stVal) const;
297
299 ParserStack<token_type>& a_stVal) const;
300
303 int iArgCount) const;
304
305 token_type ApplyStrFunc(const token_type& a_FunTok,
306 const std::vector<token_type>& a_vArg) const;
307
308 int GetOprtPrecedence(const token_type& a_Tok) const;
310
311 void CreateRPN();
312
313 void ParseString();
314 void ParseCmdCode();
315 void ParseCmdCodeBulk(int nOffset, int nThreadID);
316 void ParseCmdCodeBulkParallel(size_t nVectorLength);
317
318 void CheckName(const string_type& a_strName, const string_type& a_CharSet) const;
319 void CheckOprt(const string_type& a_sName,
320 const ParserCallback& a_Callback,
321 const string_type& a_szCharSet) const;
322
323 void StackDump(const ParserStack<token_type >& a_stVal,
324 const ParserStack<token_type >& a_stOprt) const;
325
336
338 //static const int s_MaxNumOpenMPThreads = 4;
339
341
342 unsigned int nthLoopElement;
344 unsigned int nCurrVectorIndex;
350
353
354 std::unique_ptr<token_reader_type> m_pTokenReader;
355
363
365
369
370 mutable int m_nIfElseCounter;
371
372 // items merely used for caching state information
373 const std::string EMPTYSTRING;
374 };
375
376} // namespace mu
377
378#endif
379
380
381
This class is a mutable version of a string view. It can be used to replace single characters or enti...
This class is the immutable (const) version of a string view. It can be constructed from a MutableStr...
A facet class used to change decimal and thousands separator.
Definition: muParserBase.h:235
virtual char_type do_thousands_sep() const
Definition: muParserBase.h:252
virtual std::string do_grouping() const
Definition: muParserBase.h:257
change_dec_sep(char_type cDecSep, char_type cThousandsSep=0, int nGroup=3)
Definition: muParserBase.h:238
virtual char_type do_decimal_point() const
Definition: muParserBase.h:247
Mathematical expressions parser (base parser engine).
Definition: muParserBase.h:69
varmap_type m_VarDef
user defind variables.
Definition: muParserBase.h:362
ParserTokenReader token_reader_type
Typedef for the token reader.
Definition: muParserBase.h:85
const string_type & GetExpr() const
Retrieve the formula.
const char_type * ValidInfixOprtChars() const
Virtual function that defines the characters allowed in infix operator definitions.
bool checkDelimiter(StringView sLine)
This member function checks, whether the passed string is delimited on both sides.
void CacheCurrentAccess(const CachedDataAccess &_access)
Store the passed data access for this position internally.
void StackDump(const ParserStack< token_type > &a_stVal, const ParserStack< token_type > &a_stOprt) const
Dump stack content.
void Assign(const ParserBase &a_Parser)
Copy state of a parser object to this.
void AddValIdent(identfun_type a_pCallback)
Add a value parsing function.
static const char_type * c_DefaultOprt[]
Identifiers for built in binary operators.
Definition: muParserBase.h:227
void CheckOprt(const string_type &a_sName, const ParserCallback &a_Callback, const string_type &a_szCharSet) const
Check if a name contains invalid characters.
ParseFunction m_pParseFormula
Pointer to the parser function.
Definition: muParserBase.h:330
void SetDecSep(char_type cDecSep)
Set the decimal separator.
size_t FindMultiArgFunc(StringView sExpr, size_t nPos, std::string &sMultArgFunc)
This function searches for the first multi-argument function found in the passed expression.
unsigned int nthLoopPartEquation
Definition: muParserBase.h:343
void ApplyBinOprt(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const
Performs the necessary steps to write code for the execution of binary operators into the bytecode.
MutableStringView compileVectors(MutableStringView sExpr)
This function pre-evaluates all vectors, which are contained in the expression passed through sExpr.
virtual void InitFun()=0
void SetExpr(StringView a_sExpr)
Set the expression. Triggers first time calculation thus the creation of the bytecode and scanning of...
value_type Eval()
Single-value wrapper around the vectorized overload of this member function.
void CheckName(const string_type &a_strName, const string_type &a_CharSet) const
Check if a name contains invalid characters.
const varmap_type & GetVar() const
Return a map containing the used variables only.
void CacheCurrentTarget(const std::string &sEquation)
Caches the passed target equation for this position.
void Init()
Initialize user defined functions.
stringbuf_type m_vStringBuf
String buffer, used for storing string function arguments.
Definition: muParserBase.h:351
void AddCallback(const string_type &a_strName, const ParserCallback &a_Callback, funmap_type &a_Storage, const char_type *a_szCharSet)
Add a function or operator callback to the parser.
void ApplyIfElse(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const
const CachedDataAccess & GetCachedAccess(size_t nthAccess)
Returns the cached data access for the passed position.
int IsValidByteCode(unsigned int _nthLoopElement=-1, unsigned int _nthPartEquation=0)
This member function returns, whether the current equation is already parsed and there's a valid byte...
static bool g_DbgDumpStack
Definition: muParserBase.h:230
bool HasBuiltInOprt() const
Query status of built in variables.
void ResetLocale()
Resets the locale.
const std::string & GetCachedEquation() const
Returns the stored equation for this position.
const char_type ** GetOprtDef() const
Get the default symbols used for the built in operators.
void SetIndex(unsigned int _nLoopElement)
Activates the selected position in the internally stored bytecode.
void ParseCmdCodeBulkParallel(size_t nVectorLength)
OpenMP optimized parallel bytecode executor.
StateStacks m_stateStacks
Definition: muParserBase.h:333
string_type GetVersion(EParserVersionInfo eInfo=pviFULL) const
Returns the version of muparser.
void PauseLoopMode(bool _bPause=true)
This member function pauses the loop mode, so that the new assigned equation does not invalidate alre...
virtual void InitCharSets()=0
bool IsLockedPause() const
Check, whether the pause mode is locked.
void Error(EErrorCodes a_iErrc, int a_iPos=(int) mu::string_type::npos, const string_type &a_strTok=string_type()) const
Create an error containing the parse error position.
ParserBase()
Constructor.
void EnableOptimizer(bool a_bIsOn=true)
Enable or disable the formula optimization feature.
vectormap_type mVectorVars
Maximum number of threads spawned by OpenMP when using the bulk mode.
Definition: muParserBase.h:340
funmap_type m_InfixOprtDef
unary infix operator.
Definition: muParserBase.h:358
void ApplyFunc(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal, int iArgCount) const
Apply a function token.
const std::string & GetCachedTarget() const
Returns the stored target equation for this position.
unsigned int nCurrVectorIndex
Definition: muParserBase.h:344
virtual void InitOprt()=0
const valmap_type & GetConst() const
Return a map containing all parser constants.
void DeactivateLoopMode()
Deactivates the loop mode and resets the internal arrays.
void ClearVectorVars(bool bIgnoreProcedureVects=false)
This member function cleares the internal vector storage.
ParserToken< value_type, string_type > token_type
Type used for parser tokens.
Definition: muParserBase.h:88
const std::map< std::string, std::vector< mu::value_type > > & GetVectors() const
int m_nIfElseCounter
Internal counter for keeping track of nested if-then-else clauses.
Definition: muParserBase.h:370
const varmap_type & GetUsedVar()
Return a map containing the used variables only.
void DefineStrConst(const string_type &a_sName, const string_type &a_strVal)
Define a new string constant.
valmap_type m_ConstDef
user constants.
Definition: muParserBase.h:360
bool compileVectorsInMultiArgFunc(MutableStringView &sExpr, size_t &nPos)
This private function will try to find a surrounding multi-argument function, resolve the arguments,...
bool ActiveLoopMode() const
Check, whether the loop mode is active. This function returns true even if the loop mode is paused.
void SetVarFactory(facfun_type a_pFactory, void *pUserData=NULL)
Set a function that can create variable pointer for unknown expression variables.
const funmap_type & GetFunDef() const
Return prototypes of all parser functions.
void ClearInfixOprt()
Clear the user defined Prefix operators.
std::vector< mu::value_type > * GetVectorVar(const std::string &sVarName)
This member function returns a pointer to the vector stored internally.
const char_type * ValidNameChars() const
Virtual function that defines the characters allowed in name identifiers.
void ParseString()
One of the two main parse functions.
void DefineVar(const string_type &a_sName, value_type *a_fVar)
Add a user defined variable.
void evaluateTemporaryVectors(const VectorEvaluation &vectEval, int nStackSize)
This member function evaluates the temporary vector expressions and assigns their results to their co...
bool bPauseLoopByteCode
Definition: muParserBase.h:346
void DefineConst(const string_type &a_sName, value_type a_fVal)
Add a user defined constant.
void RemoveVar(const string_type &a_strVarName)
Remove a variable from internal storage.
funmap_type m_FunDef
Map of function names and pointers.
Definition: muParserBase.h:356
virtual ~ParserBase()
void DefinePostfixOprt(const string_type &a_strFun, fun_type1 a_pOprt, bool optimizeAway=true)
Add a user defined operator.
funmap_type m_PostOprtDef
Postfix operator callbacks.
Definition: muParserBase.h:357
bool CanCacheAccess()
Check, whether the current position can cache any data accesses.
funmap_type m_OprtDef
Binary operator callbacks.
Definition: muParserBase.h:359
void ApplyRemainingOprt(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const
Apply a binary operator.
bool IsAlreadyParsed(StringView sNewEquation)
This member function checks, whether the passed expression is already parsed, so that the parsing ste...
void ClearOprt()
Clear all user defined binary operators.
int GetOprtPrecedence(const token_type &a_Tok) const
Get operator priority.
virtual void OnDetectVar(string_type *pExpr, int &nStart, int &nEnd)
void replaceLocalVars(std::string &sLine)
This member function replaces var occurences with the names of local variables.
void compileVectorExpansion(MutableStringView sSubExpr, const std::string &sVectorVarName)
This function evaluates the vector expansion, e.g. "{1:4}" = {1, 2, 3, 4}.
bool IsCompiling()
Returns true, if the parser is currently in compiling step.
bool IsNotLastStackItem() const
Check, whether there are more elements on the parsing stack remaining.
virtual void InitConst()=0
State m_compilingState
Definition: muParserBase.h:331
string_type m_sInfixOprtChars
Charset for infix operator tokens.
Definition: muParserBase.h:368
void DefineOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of binary operators and postfix operators.
void LockPause(bool _bLock=true)
This member function locks the pause mode so that it cannot be accidentally activated.
void ActivateLoopMode(unsigned int _nLoopLength)
Activates the loop mode and prepares the internal arrays for storing the necessary data.
ExpressionTarget m_compilingTarget
Definition: muParserBase.h:332
void DefineInfixOprt(const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool optimizeAway=true)
Add a user defined operator.
ParserError exception_type
Type of the error class.
Definition: muParserBase.h:96
void SetThousandsSep(char_type cThousandsSep=0)
Sets the thousands operator.
EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const
Get operator priority.
string_type CreateTempVectorVar(const std::vector< mu::value_type > &vVar)
This member function copies the passed vector into the internal storage referencing it with a auto-ge...
void ClearPostfixOprt()
Clear all user defined postfix operators.
void CacheCurrentEquation(const std::string &sEquation)
Caches the passed equation for this position.
void(ParserBase::* ParseFunction)()
Typedef for the parse functions.
Definition: muParserBase.h:79
void ClearFun()
Clear all functions.
void ParseCmdCode()
Parse the command code.
token_type ApplyStrFunc(const token_type &a_FunTok, const std::vector< token_type > &a_vArg) const
Execute a function that takes a single string argument.
static bool g_DbgDumpCmdCode
Definition: muParserBase.h:229
void ReInit()
Reset parser to string parsing mode and clear internal buffers.
valbuf_type m_buffer
Definition: muParserBase.h:335
void DefineInfixOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of infix operators.
ParserBase & operator=(const ParserBase &a_Parser)
Assignement operator.
void UpdateVectorVar(const std::string &sVarName)
This member function updates the corresponding variable of a vector with the previously newly assigne...
size_t HasCachedAccess()
Evaluate, whether there are any cached data accesses for this position.
std::map< std::string, std::string > * mVarMapPntr
Definition: muParserBase.h:98
void ParseCmdCodeBulk(int nOffset, int nThreadID)
Evaluate the RPN.
void DisableAccessCaching()
Disable the data access caching for this position.
static std::locale s_locale
The locale used by the parser.
Definition: muParserBase.h:228
std::vector< string_type > stringbuf_type
Type for a vector of strings.
Definition: muParserBase.h:82
const std::string EMPTYSTRING
Definition: muParserBase.h:373
bool ContainsVectorVars(StringView sExpr, bool ignoreSingletons)
This member function checks, whether the passed expression contains a vector.
unsigned int nthLoopElement
Definition: muParserBase.h:342
void ClearConst()
Clear all user defined constants.
const char_type * ValidOprtChars() const
Virtual function that defines the characters allowed in operator definitions.
void DefineFun(const string_type &a_strName, T a_pFun, bool optimizeAway=true)
Define a parser function without arguments.
Definition: muParserBase.h:156
void ClearVar()
Clear all user defined variables.
void expandVector(mu::value_type dFirst, const mu::value_type &dLast, const mu::value_type &dIncrement, std::vector< mu::value_type > &vResults)
This function expands the vector. Private member used by ParserBase::compileVectorExpansion().
void SetArgSep(char_type cArgSep)
Set argument separator.
std::unique_ptr< token_reader_type > m_pTokenReader
Managed pointer to the token reader object.
Definition: muParserBase.h:354
void DefineNameChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of functions, variables, constants.
void EnableBuiltInOprt(bool a_bIsOn=true)
Enable or disable the built in binary operators.
void SetCompiling(bool _bCompiling=true)
Activate the compiling step for the parser.
strmap_type m_StrVarDef
user defined string constants
Definition: muParserBase.h:361
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack)
Enable the dumping of bytecode amd stack content on the console.
string_type getNextVectorVarIndex()
This member function returns the next free vector index, which can be used to create a new temporary ...
void InitTokenReader()
Initialize the token reader.
char_type GetArgSep() const
Get the argument separator character.
ExpressionTarget & getTarget() const
Simple state-considering wrapper around the ExpressionTarget structure.
string_type m_sNameChars
Charset for names.
Definition: muParserBase.h:366
bool m_bBuiltInOp
Flag that can be used for switching built in operators on and off.
Definition: muParserBase.h:364
string_type getNextVarObject(std::string &sArgList, bool bCut)
This member function returns the next comma-separated expression object from the passed argument list...
string_type m_sOprtChars
Charset for postfix/ binary operator tokens.
Definition: muParserBase.h:367
bool bMakeLoopByteCode
Definition: muParserBase.h:345
stringbuf_type m_vStringVarBuf
Definition: muParserBase.h:352
std::list< mu::value_type * > m_lDataStorage
Definition: muParserBase.h:99
void SetVectorVar(const std::string &sVarName, const std::vector< mu::value_type > &vVar, bool bAddVectorType=false)
This member function copies the passed vector into the internal storage referencing it with the passe...
void DefineOprt(const string_type &a_strName, fun_type2 a_pFun, unsigned a_iPri=0, EOprtAssociativity a_eAssociativity=oaLEFT, bool optimizeAway=true)
Define a binary operator.
Encapsulation of prototypes for a numerical parser function.
Error class of the parser.
Parser stack implementation.
Definition: muParserStack.h:54
Token reader for the ParserBase class.
Definition of the parser bytecode class.
This file contains standard definitions used by the parser.
This file defines the error class used by the parser.
This file defines the stack used by muparser.
This file contains the parser token reader definition.
Namespace for mathematical applications.
Definition: muParser.cpp:53
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:368
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:251
value_type *(* facfun_type)(const char_type *, void *)
Callback used for variable creation factory functions.
Definition: muParserDef.h:371
std::map< string_type, value_type > valmap_type
Type used for storing constants.
Definition: muParserDef.h:276
value_type(* fun_type2)(const value_type &, const value_type &)
Callback type used for functions with two arguments.
Definition: muParserDef.h:296
string_type::value_type char_type
The character type used by the parser.
Definition: muParserDef.h:263
std::vector< value_type > valbuf_type
Type used for storing an array of values.
Definition: muParserDef.h:282
std::map< string_type, ParserCallback > funmap_type
Container for Callback objects.
value_type(* fun_type1)(const value_type &)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:293
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
Definition: muParserDef.h:273
EParserVersionInfo
Definition: muParserDef.h:212
@ pviFULL
Definition: muParserDef.h:214
EErrorCodes
Error codes.
Definition: muParserError.h:50
std::map< std::string, std::vector< value_type > > vectormap_type
Definition: muParserBase.h:54
std::string string_type
The stringtype used by the parser.
Definition: muParserDef.h:257
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:279
@ prINFIX
Signs have a higher priority than ADD_SUB, but lower than power operator.
Definition: muParserDef.h:240
EOprtAssociativity
Parser operator precedence values.
Definition: muParserDef.h:220
@ oaLEFT
Definition: muParserDef.h:221
Describes an already evaluated data access, which can be reconstructed from the current parser state.
This structure defines the overall expression target, if it is composed out of a temporary vector lik...
Defines a single parser state, which contains all necessary information for evaluating a single expre...
This is a stack of all parser line state stacks. Can be used to gather a bunch of already parsed comm...
This structure contains the necessary data to resolve all preevaluated vectors.