NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
Mathematical expressions parser (base parser engine). More...
#include <muParserBase.h>
Classes | |
class | change_dec_sep |
A facet class used to change decimal and thousands separator. More... | |
Public Types | |
typedef ParserError | exception_type |
Type of the error class. More... | |
Public Member Functions | |
void | ActivateLoopMode (unsigned int _nLoopLength) |
Activates the loop mode and prepares the internal arrays for storing the necessary data. More... | |
void | DeactivateLoopMode () |
Deactivates the loop mode and resets the internal arrays. More... | |
void | SetIndex (unsigned int _nLoopElement) |
Activates the selected position in the internally stored bytecode. More... | |
void | SetCompiling (bool _bCompiling=true) |
Activate the compiling step for the parser. More... | |
bool | IsCompiling () |
Returns true, if the parser is currently in compiling step. More... | |
void | CacheCurrentAccess (const CachedDataAccess &_access) |
Store the passed data access for this position internally. More... | |
size_t | HasCachedAccess () |
Evaluate, whether there are any cached data accesses for this position. More... | |
void | DisableAccessCaching () |
Disable the data access caching for this position. More... | |
bool | CanCacheAccess () |
Check, whether the current position can cache any data accesses. More... | |
const CachedDataAccess & | GetCachedAccess (size_t nthAccess) |
Returns the cached data access for the passed position. More... | |
void | CacheCurrentEquation (const std::string &sEquation) |
Caches the passed equation for this position. More... | |
const std::string & | GetCachedEquation () const |
Returns the stored equation for this position. More... | |
void | CacheCurrentTarget (const std::string &sEquation) |
Caches the passed target equation for this position. More... | |
const std::string & | GetCachedTarget () const |
Returns the stored target equation for this position. More... | |
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 bytecode for it. More... | |
bool | ActiveLoopMode () const |
Check, whether the loop mode is active. This function returns true even if the loop mode is paused. More... | |
bool | IsLockedPause () const |
Check, whether the pause mode is locked. More... | |
void | LockPause (bool _bLock=true) |
This member function locks the pause mode so that it cannot be accidentally activated. More... | |
void | PauseLoopMode (bool _bPause=true) |
This member function pauses the loop mode, so that the new assigned equation does not invalidate already parsed equations. More... | |
bool | IsAlreadyParsed (StringView sNewEquation) |
This member function checks, whether the passed expression is already parsed, so that the parsing step may be omitted. More... | |
bool | IsNotLastStackItem () const |
Check, whether there are more elements on the parsing stack remaining. More... | |
ParserBase () | |
Constructor. More... | |
ParserBase (const ParserBase &a_Parser) | |
Copy constructor. More... | |
ParserBase & | operator= (const ParserBase &a_Parser) |
Assignement operator. More... | |
virtual | ~ParserBase () |
value_type | Eval () |
Single-value wrapper around the vectorized overload of this member function. More... | |
value_type * | Eval (int &nStackSize) |
Evaluate an expression containing comma seperated subexpressions. More... | |
void | Eval (value_type *results, int nBulkSize) |
This member function evaluates the expression in parallel. Is not used at the moment. More... | |
void | SetExpr (StringView a_sExpr) |
Set the expression. Triggers first time calculation thus the creation of the bytecode and scanning of used variables. More... | |
void | SetVarFactory (facfun_type a_pFactory, void *pUserData=NULL) |
Set a function that can create variable pointer for unknown expression variables. More... | |
void | SetDecSep (char_type cDecSep) |
Set the decimal separator. More... | |
void | SetThousandsSep (char_type cThousandsSep=0) |
Sets the thousands operator. More... | |
void | ResetLocale () |
Resets the locale. More... | |
void | EnableOptimizer (bool a_bIsOn=true) |
Enable or disable the formula optimization feature. More... | |
void | EnableBuiltInOprt (bool a_bIsOn=true) |
Enable or disable the built in binary operators. More... | |
bool | HasBuiltInOprt () const |
Query status of built in variables. More... | |
void | AddValIdent (identfun_type a_pCallback) |
Add a value parsing function. More... | |
template<typename T > | |
void | DefineFun (const string_type &a_strName, T a_pFun, bool optimizeAway=true) |
Define a parser function without arguments. More... | |
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. More... | |
void | DefineConst (const string_type &a_sName, value_type a_fVal) |
Add a user defined constant. More... | |
void | DefineStrConst (const string_type &a_sName, const string_type &a_strVal) |
Define a new string constant. More... | |
void | DefineVar (const string_type &a_sName, value_type *a_fVar) |
Add a user defined variable. More... | |
void | DefinePostfixOprt (const string_type &a_strFun, fun_type1 a_pOprt, bool optimizeAway=true) |
Add a user defined operator. More... | |
void | DefineInfixOprt (const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool optimizeAway=true) |
Add a user defined operator. More... | |
void | ClearVar () |
Clear all user defined variables. More... | |
void | ClearFun () |
Clear all functions. More... | |
void | ClearConst () |
Clear all user defined constants. More... | |
void | ClearInfixOprt () |
Clear the user defined Prefix operators. More... | |
void | ClearPostfixOprt () |
Clear all user defined postfix operators. More... | |
void | ClearOprt () |
Clear all user defined binary operators. More... | |
void | RemoveVar (const string_type &a_strVarName) |
Remove a variable from internal storage. More... | |
const varmap_type & | GetUsedVar () |
Return a map containing the used variables only. More... | |
const varmap_type & | GetVar () const |
Return a map containing the used variables only. More... | |
const valmap_type & | GetConst () const |
Return a map containing all parser constants. More... | |
const string_type & | GetExpr () const |
Retrieve the formula. More... | |
const funmap_type & | GetFunDef () const |
Return prototypes of all parser functions. More... | |
const std::map< std::string, std::vector< mu::value_type > > & | GetVectors () const |
string_type | GetVersion (EParserVersionInfo eInfo=pviFULL) const |
Returns the version of muparser. More... | |
const char_type ** | GetOprtDef () const |
Get the default symbols used for the built in operators. More... | |
void | DefineNameChars (const char_type *a_szCharset) |
Define the set of valid characters to be used in names of functions, variables, constants. More... | |
void | DefineOprtChars (const char_type *a_szCharset) |
Define the set of valid characters to be used in names of binary operators and postfix operators. More... | |
void | DefineInfixOprtChars (const char_type *a_szCharset) |
Define the set of valid characters to be used in names of infix operators. More... | |
const char_type * | ValidNameChars () const |
Virtual function that defines the characters allowed in name identifiers. More... | |
const char_type * | ValidOprtChars () const |
Virtual function that defines the characters allowed in operator definitions. More... | |
const char_type * | ValidInfixOprtChars () const |
Virtual function that defines the characters allowed in infix operator definitions. More... | |
void | SetArgSep (char_type cArgSep) |
Set argument separator. More... | |
char_type | GetArgSep () const |
Get the argument separator character. More... | |
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. More... | |
void | Error (EErrorCodes a_iErrc, const string_type &a_Expr, int a_iPos=(int) mu::string_type::npos, const string_type &a_strTok=string_type()) const |
Create an error containing the parse error position. More... | |
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-generated variable name. More... | |
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 passed name. More... | |
std::vector< mu::value_type > * | GetVectorVar (const std::string &sVarName) |
This member function returns a pointer to the vector stored internally. More... | |
void | UpdateVectorVar (const std::string &sVarName) |
This member function updates the corresponding variable of a vector with the previously newly assigned value. More... | |
void | ClearVectorVars (bool bIgnoreProcedureVects=false) |
This member function cleares the internal vector storage. More... | |
bool | ContainsVectorVars (StringView sExpr, bool ignoreSingletons) |
This member function checks, whether the passed expression contains a vector. More... | |
Static Public Member Functions | |
static void | EnableDebugDump (bool bDumpCmd, bool bDumpStack) |
Enable the dumping of bytecode amd stack content on the console. More... | |
Public Attributes | |
std::map< std::string, std::string > * | mVarMapPntr |
std::list< mu::value_type * > | m_lDataStorage |
Protected Member Functions | |
void | Init () |
Initialize user defined functions. More... | |
virtual void | InitCharSets ()=0 |
virtual void | InitFun ()=0 |
virtual void | InitConst ()=0 |
virtual void | InitOprt ()=0 |
virtual void | OnDetectVar (string_type *pExpr, int &nStart, int &nEnd) |
Static Protected Attributes | |
static const char_type * | c_DefaultOprt [] |
Identifiers for built in binary operators. More... | |
static std::locale | s_locale = std::locale(std::locale::classic(), new change_dec_sep<char_type>('.')) |
The locale used by the parser. More... | |
static bool | g_DbgDumpCmdCode = false |
static bool | g_DbgDumpStack = false |
Private Types | |
typedef void(ParserBase::* | ParseFunction) () |
Typedef for the parse functions. More... | |
typedef std::vector< string_type > | stringbuf_type |
Type for a vector of strings. More... | |
typedef ParserTokenReader | token_reader_type |
Typedef for the token reader. More... | |
typedef ParserToken< value_type, string_type > | token_type |
Type used for parser tokens. More... | |
Private Member Functions | |
void | replaceLocalVars (std::string &sLine) |
This member function replaces var occurences with the names of local variables. More... | |
bool | checkDelimiter (StringView sLine) |
This member function checks, whether the passed string is delimited on both sides. More... | |
MutableStringView | compileVectors (MutableStringView sExpr) |
This function pre-evaluates all vectors, which are contained in the expression passed through sExpr. More... | |
bool | compileVectorsInMultiArgFunc (MutableStringView &sExpr, size_t &nPos) |
This private function will try to find a surrounding multi-argument function, resolve the arguments, apply the function and store the result as a new vector. More... | |
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. More... | |
void | compileVectorExpansion (MutableStringView sSubExpr, const std::string &sVectorVarName) |
This function evaluates the vector expansion, e.g. "{1:4}" = {1, 2, 3, 4}. More... | |
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(). More... | |
void | evaluateTemporaryVectors (const VectorEvaluation &vectEval, int nStackSize) |
This member function evaluates the temporary vector expressions and assigns their results to their corresponding target vector. More... | |
string_type | getNextVarObject (std::string &sArgList, bool bCut) |
This member function returns the next comma-separated expression object from the passed argument list. More... | |
string_type | getNextVectorVarIndex () |
This member function returns the next free vector index, which can be used to create a new temporary vector. More... | |
void | Assign (const ParserBase &a_Parser) |
Copy state of a parser object to this. More... | |
void | InitTokenReader () |
Initialize the token reader. More... | |
void | ReInit () |
Reset parser to string parsing mode and clear internal buffers. More... | |
ExpressionTarget & | getTarget () const |
Simple state-considering wrapper around the ExpressionTarget structure. More... | |
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. More... | |
void | ApplyRemainingOprt (ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const |
Apply a binary operator. More... | |
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. More... | |
void | ApplyIfElse (ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const |
void | ApplyFunc (ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal, int iArgCount) const |
Apply a function token. More... | |
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. More... | |
int | GetOprtPrecedence (const token_type &a_Tok) const |
Get operator priority. More... | |
EOprtAssociativity | GetOprtAssociativity (const token_type &a_Tok) const |
Get operator priority. More... | |
void | CreateRPN () |
void | ParseString () |
One of the two main parse functions. More... | |
void | ParseCmdCode () |
Parse the command code. More... | |
void | ParseCmdCodeBulk (int nOffset, int nThreadID) |
Evaluate the RPN. More... | |
void | ParseCmdCodeBulkParallel (size_t nVectorLength) |
OpenMP optimized parallel bytecode executor. More... | |
void | CheckName (const string_type &a_strName, const string_type &a_CharSet) const |
Check if a name contains invalid characters. More... | |
void | CheckOprt (const string_type &a_sName, const ParserCallback &a_Callback, const string_type &a_szCharSet) const |
Check if a name contains invalid characters. More... | |
void | StackDump (const ParserStack< token_type > &a_stVal, const ParserStack< token_type > &a_stOprt) const |
Dump stack content. More... | |
Private Attributes | |
ParseFunction | m_pParseFormula |
Pointer to the parser function. More... | |
State | m_compilingState |
ExpressionTarget | m_compilingTarget |
StateStacks | m_stateStacks |
State * | m_state |
valbuf_type | m_buffer |
vectormap_type | mVectorVars |
Maximum number of threads spawned by OpenMP when using the bulk mode. More... | |
unsigned int | nthLoopElement |
unsigned int | nthLoopPartEquation |
unsigned int | nCurrVectorIndex |
bool | bMakeLoopByteCode |
bool | bPauseLoopByteCode |
bool | bPauseLock |
bool | bCompiling |
int | nMaxThreads |
stringbuf_type | m_vStringBuf |
String buffer, used for storing string function arguments. More... | |
stringbuf_type | m_vStringVarBuf |
std::unique_ptr< token_reader_type > | m_pTokenReader |
Managed pointer to the token reader object. More... | |
funmap_type | m_FunDef |
Map of function names and pointers. More... | |
funmap_type | m_PostOprtDef |
Postfix operator callbacks. More... | |
funmap_type | m_InfixOprtDef |
unary infix operator. More... | |
funmap_type | m_OprtDef |
Binary operator callbacks. More... | |
valmap_type | m_ConstDef |
user constants. More... | |
strmap_type | m_StrVarDef |
user defined string constants More... | |
varmap_type | m_VarDef |
user defind variables. More... | |
bool | m_bBuiltInOp |
Flag that can be used for switching built in operators on and off. More... | |
string_type | m_sNameChars |
Charset for names. More... | |
string_type | m_sOprtChars |
Charset for postfix/ binary operator tokens. More... | |
string_type | m_sInfixOprtChars |
Charset for infix operator tokens. More... | |
int | m_nIfElseCounter |
Internal counter for keeping track of nested if-then-else clauses. More... | |
const std::string | EMPTYSTRING |
Friends | |
class | ParserTokenReader |
Mathematical expressions parser (base parser engine).
This is the implementation of a bytecode based mathematical expressions parser. The formula will be parsed from string and converted into a bytecode. Future calculations will be done with the bytecode instead the formula string resulting in a significant performance increase. Complementary to a set of internally implemented functions the parser is able to handle user defined functions and variables.
Definition at line 68 of file muParserBase.h.
Type of the error class.
Included for backwards compatibility.
Definition at line 96 of file muParserBase.h.
|
private |
Typedef for the parse functions.
The parse function do the actual work. The parser exchanges the function pointer to the parser function depending on which state it is in. (i.e. bytecode parser vs. string parser)
Definition at line 79 of file muParserBase.h.
|
private |
Type for a vector of strings.
Definition at line 82 of file muParserBase.h.
|
private |
Typedef for the token reader.
Definition at line 85 of file muParserBase.h.
|
private |
Type used for parser tokens.
Definition at line 88 of file muParserBase.h.
mu::ParserBase::ParserBase | ( | ) |
Constructor.
ParserException | if a_szFormula is null. |
Definition at line 227 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLock, bPauseLoopByteCode, InitTokenReader(), m_compilingState, m_state, mVarMapPntr, nCurrVectorIndex, nMaxThreads, nthLoopElement, and nthLoopPartEquation.
mu::ParserBase::ParserBase | ( | const ParserBase & | a_Parser | ) |
Copy constructor.
Tha parser can be safely copy constructed but the bytecode is reset during copy construction.
Definition at line 264 of file muParserBase.cpp.
References Assign(), bMakeLoopByteCode, bPauseLock, bPauseLoopByteCode, m_compilingState, m_pTokenReader, m_state, mVarMapPntr, nMaxThreads, and nthLoopElement.
|
virtual |
Definition at line 296 of file muParserBase.cpp.
References m_lDataStorage.
void mu::ParserBase::ActivateLoopMode | ( | unsigned int | _nLoopLength | ) |
Activates the loop mode and prepares the internal arrays for storing the necessary data.
_nLoopLength | unsigned int |
Definition at line 3096 of file muParserBase.cpp.
References bCompiling, bMakeLoopByteCode, DeactivateLoopMode(), g_DbgDumpStack, m_stateStacks, nCurrVectorIndex, nthLoopElement, nthLoopPartEquation, NumeReKernel::print(), and mu::StateStacks::resize().
Referenced by FlowCtrl::eval().
bool mu::ParserBase::ActiveLoopMode | ( | ) | const |
Check, whether the loop mode is active. This function returns true even if the loop mode is paused.
Definition at line 3356 of file muParserBase.cpp.
References bMakeLoopByteCode.
Referenced by FlowCtrl::eval(), Procedure::ProcCalc(), and FlowCtrl::reset().
|
private |
Add a function or operator callback to the parser.
Definition at line 537 of file muParserBase.cpp.
References CheckOprt(), mu::ecINVALID_FUN_PTR, mu::ecNAME_CONFLICT, Error(), mu::ParserCallback::GetAddr(), m_FunDef, m_InfixOprtDef, m_OprtDef, m_PostOprtDef, and ReInit().
Referenced by DefineFun(), DefineInfixOprt(), DefineOprt(), and DefinePostfixOprt().
void mu::ParserBase::AddValIdent | ( | identfun_type | a_pCallback | ) |
Add a value parsing function.
When parsing an expression muParser tries to detect values in the expression string using different valident callbacks. Thuis it's possible to parse for hex values, binary values and floating point values.
Definition at line 520 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by mu::Parser::Parser(), and mu::ParserInt::ParserInt().
|
private |
Performs the necessary steps to write code for the execution of binary operators into the bytecode.
Definition at line 1547 of file muParserBase.cpp.
References _nrT, mu::ParserByteCode::AddAssignOp(), mu::ParserByteCode::AddOp(), ApplyFunc(), mu::cmASSIGN, mu::cmOPRT_BIN, mu::cmVAR, mu::ecOPRT_TYPE_CONFLICT, mu::ecUNEXPECTED_OPERATOR, Error(), mu::ParserToken< TBase, TString >::GetType(), mu::State::m_byteCode, m_compilingState, m_pTokenReader, MUP_ASSERT, mu::ParserStack< TValueType >::pop(), mu::ParserStack< TValueType >::push(), mu::ParserStack< TValueType >::size(), mu::ParserStack< TValueType >::top(), and mu::tpSTR.
Referenced by ApplyRemainingOprt(), and CreateRPN().
|
private |
Apply a function token.
iArgCount | int Number of Arguments actually gathered used only for multiarg functions. |
exception_type | if Argument count does not mach function requirements. |
Definition at line 1428 of file muParserBase.cpp.
References mu::ParserByteCode::AddBulkFun(), mu::ParserByteCode::AddFun(), ApplyStrFunc(), mu::cmFUNC, mu::cmFUNC_BULK, mu::cmFUNC_STR, mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::cmOPRT_POSTFIX, mu::ecINTERNAL_ERROR, mu::ecTOO_FEW_PARAMS, mu::ecTOO_MANY_PARAMS, mu::ecVAL_EXPECTED, mu::ParserStack< TValueType >::empty(), Error(), mu::ParserToken< TBase, TString >::GetArgCount(), mu::ParserToken< TBase, TString >::GetAsString(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserToken< TBase, TString >::GetFuncAddr(), mu::ParserToken< TBase, TString >::GetType(), mu::ParserToken< TBase, TString >::IsOptimizable(), mu::State::m_byteCode, m_compilingState, m_pTokenReader, mu::ParserStack< TValueType >::pop(), mu::ParserStack< TValueType >::push(), mu::ParserToken< TBase, TString >::SetVal(), mu::ParserStack< TValueType >::top(), and mu::tpSTR.
Referenced by ApplyBinOprt(), ApplyRemainingOprt(), and CreateRPN().
|
private |
Definition at line 1513 of file muParserBase.cpp.
References mu::ParserByteCode::AddIfElse(), mu::cmELSE, mu::cmENDIF, mu::cmIF, mu::ParserToken< TBase, TString >::GetCode(), mu::ParserToken< TBase, TString >::GetVal(), mu::State::m_byteCode, m_compilingState, MUP_ASSERT, mu::ParserStack< TValueType >::pop(), mu::ParserStack< TValueType >::push(), mu::ParserStack< TValueType >::size(), and mu::ParserStack< TValueType >::top().
Referenced by ApplyRemainingOprt().
|
private |
Apply a binary operator.
a_stOpt | The operator stack |
a_stVal | The value stack |
Definition at line 1587 of file muParserBase.cpp.
References ApplyBinOprt(), ApplyFunc(), ApplyIfElse(), mu::cmADD, mu::cmASSIGN, mu::cmBO, mu::cmDIV, mu::cmELSE, mu::cmEQ, mu::cmGE, mu::cmGT, mu::cmIF, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::cmPOW, mu::cmSUB, mu::ecINTERNAL_ERROR, Error(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserStack< TValueType >::size(), and mu::ParserStack< TValueType >::top().
Referenced by CreateRPN().
|
private |
Execute a function that takes a single string argument.
a_FunTok | Function token. |
exception_type | If the function token is not a string function |
Definition at line 1379 of file muParserBase.cpp.
References mu::ParserByteCode::AddStrFun(), mu::cmSTRING, mu::ecINTERNAL_ERROR, mu::ecSTRING_EXPECTED, mu::ecVAL_EXPECTED, Error(), mu::ParserToken< TBase, TString >::GetArgCount(), mu::ParserToken< TBase, TString >::GetAsString(), mu::ParserToken< TBase, TString >::GetFuncAddr(), mu::State::m_byteCode, m_compilingState, m_pTokenReader, and mu::ParserToken< TBase, TString >::SetVal().
Referenced by ApplyFunc().
|
private |
Copy state of a parser object to this.
Clears Variables and Functions of this parser. Copies the states of all internal variables. Resets parse function to string parse mode.
a_Parser | the source object. |
Definition at line 325 of file muParserBase.cpp.
References m_bBuiltInOp, m_compilingState, m_ConstDef, m_FunDef, m_InfixOprtDef, m_nIfElseCounter, m_OprtDef, m_PostOprtDef, m_pTokenReader, m_sInfixOprtChars, m_sNameChars, m_sOprtChars, m_StrVarDef, m_VarDef, m_vStringBuf, m_vStringVarBuf, and ReInit().
Referenced by operator=(), and ParserBase().
void mu::ParserBase::CacheCurrentAccess | ( | const CachedDataAccess & | _access | ) |
Store the passed data access for this position internally.
_access | const CachedDataAccess& |
Definition at line 3191 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, and nthLoopElement.
Referenced by handleMafDataAccess(), and replaceDataEntities().
void mu::ParserBase::CacheCurrentEquation | ( | const std::string & | sEquation | ) |
Caches the passed equation for this position.
sEquation | const string& |
Definition at line 3272 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, and nthLoopElement.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
void mu::ParserBase::CacheCurrentTarget | ( | const std::string & | sEquation | ) |
Caches the passed target equation for this position.
sEquation | const string& |
Definition at line 3303 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, and nthLoopElement.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
bool mu::ParserBase::CanCacheAccess | ( | ) |
Check, whether the current position can cache any data accesses.
Definition at line 3238 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, and nthLoopElement.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
|
private |
This member function checks, whether the passed string is delimited on both sides.
sLine | StringView |
Definition at line 3704 of file muParserBase.cpp.
References StringViewBase::back(), StringViewBase::front(), and mu::isDelim().
Referenced by compileVectors(), ContainsVectorVars(), and replaceLocalVars().
|
private |
Check if a name contains invalid characters.
ParserException | if the name contains invalid charakters. |
Definition at line 595 of file muParserBase.cpp.
References mu::ecINVALID_NAME, and Error().
Referenced by DefineConst(), DefineStrConst(), and DefineVar().
|
private |
Check if a name contains invalid characters.
ParserException | if the name contains invalid charakters. |
Definition at line 570 of file muParserBase.cpp.
References mu::cmOPRT_INFIX, mu::cmOPRT_POSTFIX, mu::ecINVALID_INFIX_IDENT, mu::ecINVALID_NAME, mu::ecINVALID_POSTFIX_IDENT, Error(), and mu::ParserCallback::GetCode().
Referenced by AddCallback().
void mu::ParserBase::ClearConst | ( | ) |
Clear all user defined constants.
Both numeric and string constants will be removed from the internal storage.
nothrow |
Definition at line 2515 of file muParserBase.cpp.
References m_ConstDef, m_StrVarDef, and ReInit().
Referenced by mu::Test::ParserTester::TestNames().
void mu::ParserBase::ClearFun | ( | ) |
Clear all functions.
nothrow |
Definition at line 2502 of file muParserBase.cpp.
References m_FunDef, and ReInit().
void mu::ParserBase::ClearInfixOprt | ( | ) |
Clear the user defined Prefix operators.
nothrow |
Definition at line 2549 of file muParserBase.cpp.
References m_InfixOprtDef, and ReInit().
void mu::ParserBase::ClearOprt | ( | ) |
Clear all user defined binary operators.
nothrow |
Definition at line 2538 of file muParserBase.cpp.
References m_OprtDef, and ReInit().
void mu::ParserBase::ClearPostfixOprt | ( | ) |
Clear all user defined postfix operators.
nothrow |
Definition at line 2527 of file muParserBase.cpp.
References m_PostOprtDef, and ReInit().
Referenced by mu::Test::ParserTester::TestNames().
void mu::ParserBase::ClearVar | ( | ) |
Clear all user defined variables.
nothrow |
Resets the parser to string parsing mode by calling ReInit.
Definition at line 2461 of file muParserBase.cpp.
References m_VarDef, and ReInit().
void mu::ParserBase::ClearVectorVars | ( | bool | bIgnoreProcedureVects = false | ) |
This member function cleares the internal vector storage.
bIgnoreProcedureVects | bool |
Definition at line 3619 of file muParserBase.cpp.
References mu::ExpressionTarget::clear(), m_compilingTarget, mVectorVars, and RemoveVar().
Referenced by FlowCtrl::eval(), NumeReKernel::MainLoop(), Procedure::ProcCalc(), and FlowCtrl::reset().
|
private |
This function evaluates the vector expansion, e.g. "{1:4}" = {1, 2, 3, 4}.
sSubExpr | MutableStringView |
sVectorVarName | const std::string& |
Definition at line 779 of file muParserBase.cpp.
References mu::VectorEvaluation::create(), mu::ecUNEXPECTED_CONDITIONAL, Eval(), getAllArguments(), getMatchingParenthesis(), StringViewBase::length(), m_compilingState, mu::State::m_vectEval, SetExpr(), MutableStringView::subview(), and StringViewBase::to_string().
Referenced by compileVectors().
|
private |
This function pre-evaluates all vectors, which are contained in the expression passed through sExpr.
sExpr | MutableStringView containing the expression |
Definition at line 664 of file muParserBase.cpp.
References checkDelimiter(), compileVectorExpansion(), compileVectorsInMultiArgFunc(), mu::VectorEvaluation::create(), mu::ExpressionTarget::create(), CreateTempVectorVar(), Eval(), StringViewBase::find(), StringViewBase::find_first_not_of(), getMatchingParenthesis(), getTarget(), isDelimiter(), StringViewBase::length(), m_compilingState, m_pTokenReader, mu::State::m_vectEval, mVectorVars, MutableStringView::replace(), SetExpr(), SetVectorVar(), and MutableStringView::subview().
Referenced by SetExpr().
|
private |
This private function will try to find a surrounding multi-argument function, resolve the arguments, apply the function and store the result as a new vector.
sExpr | MutableStringView& |
nPos | size_t& |
Definition at line 918 of file muParserBase.cpp.
References mu::VectorEvaluation::create(), CreateTempVectorVar(), Eval(), FindMultiArgFunc(), getMatchingParenthesis(), StringViewBase::length(), m_compilingState, mu::State::m_vectEval, MutableStringView::replace(), SetExpr(), and MutableStringView::subview().
Referenced by compileVectors().
bool mu::ParserBase::ContainsVectorVars | ( | StringView | sExpr, |
bool | ignoreSingletons | ||
) |
This member function checks, whether the passed expression contains a vector.
sExpr | StringView |
ignoreSingletons | bool |
Definition at line 3663 of file muParserBase.cpp.
References checkDelimiter(), StringViewBase::find(), func, mVectorVars, and StringView::subview().
Referenced by NumeRe::StringParser::evaluateStack(), handleMafDataAccess(), and SetExpr().
|
private |
Definition at line 2137 of file muParserBase.cpp.
References mu::ParserByteCode::AddIfElse(), mu::ParserByteCode::AddVal(), mu::ParserByteCode::AddVar(), ApplyBinOprt(), ApplyFunc(), ApplyRemainingOprt(), mu::ParserByteCode::AsciiDump(), mu::cmADD, mu::cmARG_SEP, mu::cmASSIGN, mu::cmBC, mu::cmBO, mu::cmDIV, mu::cmELSE, mu::cmEND, mu::cmEQ, mu::cmFUNC, mu::cmFUNC_BULK, mu::cmFUNC_STR, mu::cmGE, mu::cmGT, mu::cmIF, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::cmOPRT_POSTFIX, mu::cmPOW, mu::cmSTRING, mu::cmSUB, mu::cmVAL, mu::cmVAR, mu::ecEMPTY_EXPRESSION, mu::ecINTERNAL_ERROR, mu::ecMISPLACED_COLON, mu::ecMISSING_ELSE_CLAUSE, mu::ecSTR_RESULT, mu::ecUNEXPECTED_ARG, mu::ecUNEXPECTED_ARG_SEP, mu::ecUNEXPECTED_EOF, mu::ParserStack< TValueType >::empty(), Error(), mu::ParserByteCode::Finalize(), g_DbgDumpCmdCode, g_DbgDumpStack, mu::ParserToken< TBase, TString >::GetAsString(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserByteCode::GetMaxStackSize(), GetOprtAssociativity(), GetOprtPrecedence(), mu::ParserToken< TBase, TString >::GetVal(), mu::ParserToken< TBase, TString >::GetVar(), mu::State::m_byteCode, m_compilingState, m_nIfElseCounter, mu::State::m_numResults, m_pTokenReader, mu::State::m_stackBuffer, m_vStringBuf, MUP_ASSERT, mVectorVars, nMaxThreads, mu::oaLEFT, mu::oaRIGHT, mu::ParserStack< TValueType >::pop(), NumeReKernel::print(), mu::ParserStack< TValueType >::push(), mu::ParserToken< TBase, TString >::SetIdx(), SetVectorVar(), mu::ParserStack< TValueType >::size(), mu::ParserStack< TValueType >::top(), and mu::tpDBL.
Referenced by Eval(), and ParseString().
string_type mu::ParserBase::CreateTempVectorVar | ( | const std::vector< mu::value_type > & | vVar | ) |
This member function copies the passed vector into the internal storage referencing it with a auto-generated variable name.
vVar | const std::vector<mu::value_type>& |
Definition at line 3524 of file muParserBase.cpp.
References getNextVectorVarIndex(), and SetVectorVar().
Referenced by compileVectors(), compileVectorsInMultiArgFunc(), NumeRe::StringParser::createStringOutput(), NumeRe::StringParser::eval(), NumeReKernel::executePlugins(), getDataElements(), NumeRe::StringParser::parseStringsInIndices(), Procedure::procedureInterface(), Procedure::replaceReturnVal(), CommandLineParser::setReturnValue(), tableMethod_binsof(), tableMethod_counteq(), tableMethod_cov(), tableMethod_findCols(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_zscore(), and windowCommand().
void mu::ParserBase::DeactivateLoopMode | ( | ) |
Deactivates the loop mode and resets the internal arrays.
Definition at line 3122 of file muParserBase.cpp.
References bCompiling, bMakeLoopByteCode, mu::StateStacks::clear(), g_DbgDumpStack, m_compilingState, m_state, m_stateStacks, nCurrVectorIndex, nthLoopElement, nthLoopPartEquation, and NumeReKernel::print().
Referenced by ActivateLoopMode(), FlowCtrl::reset(), and NumeReKernel::resetAfterError().
void mu::ParserBase::DefineConst | ( | const string_type & | a_sName, |
value_type | a_fVal | ||
) |
Add a user defined constant.
[in] | a_sName | The name of the constant. |
[in] | a_fVal | the value of the constant. |
ParserException | in case the name contains invalid signs. |
Definition at line 1213 of file muParserBase.cpp.
References CheckName(), m_ConstDef, ReInit(), and ValidNameChars().
Referenced by NumeReKernel::defineConst(), mu::Test::ParserTester::EqnTest(), mu::Test::ParserTester::EqnTestInt(), and mu::Parser::InitConst().
|
inline |
Define a parser function without arguments.
a_strName | Name of the function |
a_pFun | Pointer to the callback function |
optimizeAway | A flag indicating this function may be optimized |
Definition at line 156 of file muParserBase.h.
References AddCallback(), m_FunDef, and ValidNameChars().
Referenced by NumeReKernel::defineFunctions(), mu::ParserInt::InitFun(), mu::Parser::InitFun(), and mu::Test::ParserTester::ThrowTest().
void mu::ParserBase::DefineInfixOprt | ( | const string_type & | a_sName, |
fun_type1 | a_pFun, | ||
int | a_iPrec = prINFIX , |
||
bool | optimizeAway = true |
||
) |
Add a user defined operator.
[in] | a_sName | operator Identifier |
[in] | a_pFun | Operator callback function |
[in] | a_iPrec | Operator Precedence (default=prSIGN) |
[in] | optimizeAway | True if operator is volatile (default=false) |
Definition at line 1119 of file muParserBase.cpp.
References AddCallback(), mu::cmOPRT_INFIX, m_InfixOprtDef, and ValidInfixOprtChars().
Referenced by NumeReKernel::defineOperators(), mu::ParserInt::InitOprt(), and mu::Parser::InitOprt().
void mu::ParserBase::DefineInfixOprtChars | ( | const char_type * | a_szCharset | ) |
Define the set of valid characters to be used in names of infix operators.
Definition at line 1048 of file muParserBase.cpp.
References m_sInfixOprtChars.
Referenced by mu::ParserInt::InitCharSets(), and mu::Parser::InitCharSets().
void mu::ParserBase::DefineNameChars | ( | const char_type * | a_szCharset | ) |
Define the set of valid characters to be used in names of functions, variables, constants.
Definition at line 1030 of file muParserBase.cpp.
References m_sNameChars.
Referenced by mu::ParserInt::InitCharSets(), and mu::Parser::InitCharSets().
void mu::ParserBase::DefineOprt | ( | const string_type & | a_sName, |
fun_type2 | a_pFun, | ||
unsigned | a_iPrec = 0 , |
||
EOprtAssociativity | a_eAssociativity = oaLEFT , |
||
bool | optimizeAway = true |
||
) |
Define a binary operator.
[in] | a_sName | The identifier of the operator. |
[in] | a_pFun | Pointer to the callback function. |
[in] | a_iPrec | Precedence of the operator. |
[in] | a_eAssociativity | The associativity of the operator. |
[in] | a_bAllowOpt | If this is true the operator may be optimized away. |
Adds a new Binary operator the the parser instance.
Definition at line 1141 of file muParserBase.cpp.
References AddCallback(), c_DefaultOprt, mu::cmENDIF, mu::ecBUILTIN_OVERLOAD, Error(), m_bBuiltInOp, m_OprtDef, and ValidOprtChars().
Referenced by NumeReKernel::defineOperators(), and mu::ParserInt::InitOprt().
void mu::ParserBase::DefineOprtChars | ( | const char_type * | a_szCharset | ) |
Define the set of valid characters to be used in names of binary operators and postfix operators.
Definition at line 1039 of file muParserBase.cpp.
References m_sOprtChars.
Referenced by mu::ParserInt::InitCharSets(), and mu::Parser::InitCharSets().
void mu::ParserBase::DefinePostfixOprt | ( | const string_type & | a_sName, |
fun_type1 | a_pFun, | ||
bool | optimizeAway = true |
||
) |
Add a user defined operator.
Definition at line 1087 of file muParserBase.cpp.
References AddCallback(), mu::cmOPRT_POSTFIX, m_PostOprtDef, mu::prPOSTFIX, and ValidOprtChars().
Referenced by NumeReKernel::defineOperators(), and mu::Test::ParserTester::ThrowTest().
void mu::ParserBase::DefineStrConst | ( | const string_type & | a_strName, |
const string_type & | a_strVal | ||
) |
Define a new string constant.
[in] | a_strName | The name of the constant. |
[in] | a_strVal | the value of the constant. |
Definition at line 1163 of file muParserBase.cpp.
References CheckName(), mu::ecNAME_CONFLICT, Error(), m_StrVarDef, m_vStringBuf, m_vStringVarBuf, ReInit(), and ValidNameChars().
void mu::ParserBase::DefineVar | ( | const string_type & | a_sName, |
value_type * | a_pVar | ||
) |
Add a user defined variable.
[in] | a_sName | the variable name |
[in] | a_pVar | A pointer to the variable vaule. |
ParserException | in case the name contains invalid signs or a_pVar is NULL. |
Definition at line 1184 of file muParserBase.cpp.
References CheckName(), mu::ecINVALID_VAR_PTR, mu::ecNAME_CONFLICT, Error(), m_ConstDef, m_VarDef, ReInit(), and ValidNameChars().
Referenced by ProcedureVarFactory::createLocalVars(), mu::Test::ParserTester::EqnTestInt(), mu::Test::ParserTester::EqnTestWithVarChange(), ProcedureVarFactory::evaluateProcedureArguments(), FlowCtrl::prepareLocalVarsAndReplace(), FlowCtrl::range_based_for_loop(), FlowCtrl::reset(), SetVectorVar(), NumeReKernel::StartUp(), mu::Test::ParserTester::TestInterface(), mu::Test::ParserTester::TestVarConst(), and mu::Test::ParserTester::ThrowTest().
void mu::ParserBase::DisableAccessCaching | ( | ) |
Disable the data access caching for this position.
Definition at line 3221 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, mu::StateStacks::clear(), m_stateStacks, and nthLoopElement.
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringParser::getDataForString(), handleCachedDataAccess(), MemoryManager::parseEvery(), replaceDataEntities(), and replaceEntityOccurence().
void mu::ParserBase::EnableBuiltInOprt | ( | bool | a_bIsOn = true | ) |
Enable or disable the built in binary operators.
nothrow |
If you disable the built in binary operators there will be no binary operators defined. Thus you must add them manually one by one. It is not possible to disable built in operators selectively. This function will Reinitialize the parser by calling ReInit().
Definition at line 2589 of file muParserBase.cpp.
References m_bBuiltInOp, and ReInit().
Referenced by mu::ParserInt::InitOprt(), and mu::Test::ParserTester::TestNames().
|
static |
Enable the dumping of bytecode amd stack content on the console.
bDumpCmd | Flag to enable dumping of the current bytecode to the console. |
bDumpStack | Flag to enable dumping of the stack content is written to the console. |
This function is for debug purposes only!
Definition at line 2573 of file muParserBase.cpp.
References g_DbgDumpCmdCode, and g_DbgDumpStack.
Referenced by cmd_set().
void mu::ParserBase::EnableOptimizer | ( | bool | a_bIsOn = true | ) |
Enable or disable the formula optimization feature.
nothrow |
Definition at line 2560 of file muParserBase.cpp.
References mu::ParserByteCode::EnableOptimizer(), mu::State::m_byteCode, m_compilingState, and ReInit().
Referenced by mu::Test::ParserTester::EqnTest().
void mu::ParserBase::Error | ( | EErrorCodes | a_iErrc, |
const string_type & | a_Expr, | ||
int | a_iPos = (int)mu::string_type::npos , |
||
const string_type & | a_sTok = string_type() |
||
) | const |
Create an error containing the parse error position.
This function will create an Parser Exception object containing the error text and its position.
a_iErrc | [in] The error code of type EErrorCodes. |
a_Expr | [in] The erroneous expression |
a_iPos | [in] The position where the error was detected. |
a_strTok | [in] The token string representation associated with the error. |
ParserException | always throws thats the only purpose of this function. |
Definition at line 2450 of file muParserBase.cpp.
void mu::ParserBase::Error | ( | EErrorCodes | a_iErrc, |
int | a_iPos = (int)mu::string_type::npos , |
||
const string_type & | a_sTok = string_type() |
||
) | const |
Create an error containing the parse error position.
This function will create an Parser Exception object containing the error text and its position.
a_iErrc | [in] The error code of type EErrorCodes. |
a_iPos | [in] The position where the error was detected. |
a_strTok | [in] The token string representation associated with the error. |
ParserException | always throws thats the only purpose of this function. |
Definition at line 2433 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by AddCallback(), ApplyBinOprt(), ApplyFunc(), ApplyRemainingOprt(), ApplyStrFunc(), CheckName(), CheckOprt(), CreateRPN(), DefineOprt(), DefineStrConst(), DefineVar(), mu::ParserTokenReader::Error(), GetOprtPrecedence(), ParseCmdCodeBulk(), ParseCmdCodeBulkParallel(), and SetExpr().
value_type mu::ParserBase::Eval | ( | ) |
Single-value wrapper around the vectorized overload of this member function.
Definition at line 3073 of file muParserBase.cpp.
References Eval().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::calc(), calculatePercentageAvgAndCreateParserVariables(), FlowCtrl::compile(), compileVectorExpansion(), compileVectors(), compileVectorsInMultiArgFunc(), Plot::constructDataLegendElement(), FunctionDefinition::convertToValues(), Plot::create2dDrawing(), Plot::create3dDrawing(), createDatagrid(), Plot::createDataLegends(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), NumeRe::StringParser::createStringOutput(), Plot::createSubPlotSet(), NumeRe::StringParser::createTerminalOutput(), mu::Parser::Diff(), differentiate(), mu::Test::ParserTester::EqnTest(), mu::Test::ParserTester::EqnTestInt(), mu::Test::ParserTester::EqnTestWithVarChange(), Eval(), NumeRe::StringParser::eval(), FlowCtrl::evalHeader(), evalMatOp(), evalPoints(), FlowCtrl::evalRangeBasedHeader(), NumeRe::StringLogicParser::evalStringLogic(), NumeRe::StringLogicParser::evalStringTernary(), evaluateExpression(), evaluateFittingParams(), evaluateNumerical(), evaluateParameterValues(), ProcedureVarFactory::evaluateProcedureArguments(), Plot::evaluateSubplot(), FlowCtrl::extractFlagsAndIndexVariables(), Plot::fillData(), findExtrema(), findExtremaInData(), findExtremaInMultiResult(), findZeroes(), findZeroesInData(), findZeroesInMultiResult(), Fitcontroller::fitctrl(), fitDataSet(), Fitcontroller::fitfunction(), Fitcontroller::fitfunctionrestricted(), Fitcontroller::fitjacobian(), Fitcontroller::fitjacobianrestricted(), StringVector::getBooleanVectorized(), getFittingParameters(), getIndices(), StringVector::getNumericalVectorized(), getParameterValue(), handleCasualIndices(), handleIndexVectors(), integrate(), integrate2d(), integrationstep_simpson(), integrationstep_trapezoidal(), localizeExtremum(), localizeZero(), NumeReKernel::MainLoop(), NumeRe::StringParser::numToString(), Odesolver::odeFunction(), parseArg(), parseCmdArg(), MemoryManager::parseEvery(), CommandLineParser::parseExprAsNumericalValues(), particleSwarmOptimizer(), Plot::Plot(), Procedure::ProcCalc(), readAndParseIntervals(), readAndParseLegacyIntervals(), Interval::refresh(), replaceEntityOccurence(), PlotData::setParams(), Odesolver::solve(), NumeRe::StringParser::storeStringResults(), NumeRe::StringParser::storeStringToDataObjects(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categories(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_typeof(), tableMethod_zscore(), taylor(), mu::Test::ParserTester::TestInterface(), and mu::Test::ParserTester::ThrowTest().
value_type * mu::ParserBase::Eval | ( | int & | nStackSize | ) |
Evaluate an expression containing comma seperated subexpressions.
This member function can be used to retrieve all results of an expression made up of multiple comma seperated subexpressions (i.e. "x+y,sin(x),cos(y)").
nStackSize | int& |
Definition at line 2926 of file muParserBase.cpp.
References mu::ExpressionTarget::assign(), bMakeLoopByteCode, bPauseLoopByteCode, mu::ParserByteCode::ChangeVar(), mu::VectorEvaluation::EVALTYPE_NONE, evaluateTemporaryVectors(), g_DbgDumpStack, getTarget(), mu::ExpressionTarget::isValid(), m_buffer, mu::State::m_byteCode, mu::State::m_numResults, m_pParseFormula, mu::State::m_stackBuffer, m_state, m_stateStacks, mu::VectorEvaluation::m_type, mu::State::m_usedVar, mu::State::m_vectEval, max, mVectorVars, nCurrVectorIndex, nthLoopElement, nthLoopPartEquation, ParseCmdCodeBulk(), ParseCmdCodeBulkParallel(), NumeReKernel::print(), mu::printVector(), mu::StateStacks::size(), and toString().
void mu::ParserBase::Eval | ( | value_type * | results, |
int | nBulkSize | ||
) |
This member function evaluates the expression in parallel. Is not used at the moment.
results | value_type* |
nBulkSize | int |
Definition at line 3467 of file muParserBase.cpp.
References CreateRPN(), min, nMaxThreads, and ParseCmdCodeBulk().
|
private |
This member function evaluates the temporary vector expressions and assigns their results to their corresponding target vector.
vectEval | const VectorEvaluation& |
nStackSize | int |
Definition at line 2828 of file muParserBase.cpp.
References mu::VectorEvaluation::EVALTYPE_MULTIARGFUNC, mu::VectorEvaluation::EVALTYPE_VECTOR, mu::VectorEvaluation::EVALTYPE_VECTOR_EXPANSION, expandVector(), mu::ParserCallback::GetAddr(), GetVectorVar(), m_buffer, mu::VectorEvaluation::m_componentDefs, m_FunDef, mu::VectorEvaluation::m_mafunc, m_state, mu::VectorEvaluation::m_targetVect, mu::VectorEvaluation::m_type, mu::State::m_vectEval, mu::parser_idxtolog(), mu::parser_logtoidx(), and UpdateVectorVar().
Referenced by Eval().
|
private |
This function expands the vector. Private member used by ParserBase::compileVectorExpansion().
dFirst | mu::value_type |
dLast | const mu::value_type& |
dIncrement | const mu::value_type& |
vResults | vector<mu::value_type>& |
Definition at line 881 of file muParserBase.cpp.
References mu::stepIsStillPossible().
Referenced by evaluateTemporaryVectors().
|
private |
This function searches for the first multi-argument function found in the passed expression.
sExpr | StringView |
nPos | size_t |
sMultArgFunc | std::string& will contain the name of the function |
Definition at line 967 of file muParserBase.cpp.
References StringViewBase::find_last_of(), getMatchingParenthesis(), m_FunDef, StringView::subview(), and StringViewBase::to_string().
Referenced by compileVectorsInMultiArgFunc().
char_type mu::ParserBase::GetArgSep | ( | ) | const |
Get the argument separator character.
Definition at line 2608 of file muParserBase.cpp.
References m_pTokenReader.
const CachedDataAccess & mu::ParserBase::GetCachedAccess | ( | size_t | nthAccess | ) |
Returns the cached data access for the passed position.
nthAccess | size_t |
Definition at line 3255 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, nthLoopElement, and mu::StateStacks::size().
Referenced by handleCachedDataAccess().
const std::string & mu::ParserBase::GetCachedEquation | ( | ) | const |
Returns the stored equation for this position.
Definition at line 3286 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, EMPTYSTRING, m_stateStacks, and nthLoopElement.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), getDataElements(), and handleCachedDataAccess().
const std::string & mu::ParserBase::GetCachedTarget | ( | ) | const |
Returns the stored target equation for this position.
Definition at line 3317 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, EMPTYSTRING, m_stateStacks, and nthLoopElement.
Referenced by handleCachedDataAccess().
const valmap_type & mu::ParserBase::GetConst | ( | ) | const |
Return a map containing all parser constants.
Definition at line 1332 of file muParserBase.cpp.
References m_ConstDef.
Referenced by Procedure::getInlined(), and listConstants().
const string_type & mu::ParserBase::GetExpr | ( | ) | const |
Retrieve the formula.
Definition at line 1366 of file muParserBase.cpp.
References g_DbgDumpStack, mu::State::m_expr, m_state, and NumeReKernel::print().
Referenced by IsAlreadyParsed(), localizeExtremum(), localizeZero(), and SetExpr().
const funmap_type & mu::ParserBase::GetFunDef | ( | ) | const |
Return prototypes of all parser functions.
nothrow |
The return type is a map of the public type funmap_type containing the prototype definitions for all numerical parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects of the class FunProt one per parser function each associated with function names via a map construct.
Definition at line 1348 of file muParserBase.cpp.
References m_FunDef.
|
private |
This member function returns the next comma-separated expression object from the passed argument list.
sArgList | std::string& |
bCut | bool |
Definition at line 2723 of file muParserBase.cpp.
|
private |
This member function returns the next free vector index, which can be used to create a new temporary vector.
This function is called by ParserBase::CreateTempVectorVar(), which creates the actual vector.
Definition at line 2804 of file muParserBase.cpp.
References bMakeLoopByteCode, m_lDataStorage, nCurrVectorIndex, nthLoopElement, nthLoopPartEquation, and toString().
Referenced by CreateTempVectorVar().
|
private |
Get operator priority.
ParserException | if a_Oprt is no operator code |
Definition at line 1272 of file muParserBase.cpp.
References mu::cmADD, mu::cmASSIGN, mu::cmDIV, mu::cmEQ, mu::cmGE, mu::cmGT, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmOPRT_BIN, mu::cmPOW, mu::cmSUB, mu::ParserToken< TBase, TString >::GetAssociativity(), mu::ParserToken< TBase, TString >::GetCode(), mu::oaLEFT, mu::oaNONE, and mu::oaRIGHT.
Referenced by CreateRPN().
const char_type ** mu::ParserBase::GetOprtDef | ( | ) | const |
Get the default symbols used for the built in operators.
Definition at line 1021 of file muParserBase.cpp.
References c_DefaultOprt.
Referenced by mu::ParserTokenReader::IsBuiltIn(), and mu::ParserTokenReader::IsOprt().
|
private |
Get operator priority.
ParserException | if a_Oprt is no operator code |
Definition at line 1224 of file muParserBase.cpp.
References mu::cmADD, mu::cmARG_SEP, mu::cmASSIGN, mu::cmDIV, mu::cmELSE, mu::cmEND, mu::cmEQ, mu::cmGE, mu::cmGT, mu::cmIF, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::cmPOW, mu::cmSUB, mu::ecINTERNAL_ERROR, Error(), mu::ParserToken< TBase, TString >::GetCode(), mu::ParserToken< TBase, TString >::GetPri(), mu::prADD_SUB, mu::prCMP, mu::prLAND, mu::prLOR, mu::prMUL_DIV, and mu::prPOW.
Referenced by CreateRPN().
|
private |
Simple state-considering wrapper around the ExpressionTarget structure.
Definition at line 431 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_compilingTarget, m_stateStacks, and nthLoopElement.
Referenced by compileVectors(), and Eval().
const varmap_type & mu::ParserBase::GetUsedVar | ( | ) |
Return a map containing the used variables only.
Definition at line 1301 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by FunctionDefinition::convertToValues(), fitDataSet(), getFittingParameters(), and mu::Test::ParserTester::TestVarConst().
const varmap_type & mu::ParserBase::GetVar | ( | ) | const |
Return a map containing the used variables only.
Definition at line 1325 of file muParserBase.cpp.
References m_VarDef.
Referenced by NumeReDebugger::decodeType(), NumeReKernel::evalDebuggerBreakPoint(), ProcedureVarFactory::evaluateProcedureArguments(), Fitcontroller::Fitcontroller(), NumeReDebugger::getGlobals(), getPointerToVariable(), NumeReKernel::getVariableList(), getVarList(), listDeclaredVariables(), OnDetectVar(), Fitcontroller::setParser(), Odesolver::solve(), mu::Test::ParserTester::TestVarConst(), and UpdateVectorVar().
const std::map< std::string, std::vector< mu::value_type > > & mu::ParserBase::GetVectors | ( | ) | const |
Definition at line 1353 of file muParserBase.cpp.
References m_VarDef, and mVectorVars.
Referenced by NumeRe::StringVarFactory::evaluateStringVectors().
std::vector< mu::value_type > * mu::ParserBase::GetVectorVar | ( | const std::string & | sVarName | ) |
This member function returns a pointer to the vector stored internally.
sVarName | const std::string& |
Definition at line 3582 of file muParserBase.cpp.
References mVectorVars.
Referenced by evaluateTemporaryVectors(), and handleCachedDataAccess().
string_type mu::ParserBase::GetVersion | ( | EParserVersionInfo | eInfo = pviFULL | ) | const |
Returns the version of muparser.
eInfo | A flag indicating whether the full version info should be returned or not. |
Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS are returned only if eInfo==pviFULL.
Definition at line 466 of file muParserBase.cpp.
References _nrT, MUP_VERSION, MUP_VERSION_DATE, and mu::pviFULL.
bool mu::ParserBase::HasBuiltInOprt | ( | ) | const |
Query status of built in variables.
nothrow |
Definition at line 2600 of file muParserBase.cpp.
References m_bBuiltInOp.
Referenced by mu::ParserTokenReader::IsBuiltIn(), and mu::ParserTokenReader::IsOprt().
size_t mu::ParserBase::HasCachedAccess | ( | ) |
Evaluate, whether there are any cached data accesses for this position.
Definition at line 3205 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, nthLoopElement, and mu::StateStacks::size().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), getDataElements(), and handleCachedDataAccess().
|
protected |
Initialize user defined functions.
Calls the virtual functions InitFun(), InitConst() and InitOprt().
Definition at line 1102 of file muParserBase.cpp.
References InitCharSets(), InitConst(), InitFun(), and InitOprt().
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
Referenced by Init().
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
Referenced by Init().
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
Referenced by Init().
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
Referenced by Init().
|
private |
Initialize the token reader.
Create new token reader object and submit pointers to function, operator, constant and variable definitions.
nothrow |
Definition at line 404 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by ParserBase().
bool mu::ParserBase::IsAlreadyParsed | ( | StringView | sNewEquation | ) |
This member function checks, whether the passed expression is already parsed, so that the parsing step may be omitted.
sNewEquation | StringView |
Definition at line 3428 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, GetExpr(), m_state, mu::State::m_valid, and StringViewBase::strip().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), NumeReKernel::MainLoop(), Procedure::ProcCalc(), and SetExpr().
bool mu::ParserBase::IsCompiling | ( | ) |
Returns true, if the parser is currently in compiling step.
Definition at line 3177 of file muParserBase.cpp.
References bCompiling.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), and getDataElements().
bool mu::ParserBase::IsLockedPause | ( | ) | const |
Check, whether the pause mode is locked.
Definition at line 3369 of file muParserBase.cpp.
References bPauseLock.
Referenced by FlowCtrl::eval(), Procedure::ProcCalc(), and FlowCtrl::reset().
bool mu::ParserBase::IsNotLastStackItem | ( | ) | const |
Check, whether there are more elements on the parsing stack remaining.
Definition at line 3448 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, m_stateStacks, nthLoopElement, nthLoopPartEquation, and mu::StateStacks::size().
Referenced by FlowCtrl::calc(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
int mu::ParserBase::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 bytecode for it.
_nthLoopElement | unsigned int |
_nthPartEquation | unsigned int |
Definition at line 3336 of file muParserBase.cpp.
References bMakeLoopByteCode, m_stateStacks, nthLoopElement, and mu::StateStacks::size().
Referenced by FlowCtrl::compile().
void mu::ParserBase::LockPause | ( | bool | _bLock = true | ) |
This member function locks the pause mode so that it cannot be accidentally activated.
_bLock | bool |
Definition at line 3384 of file muParserBase.cpp.
References bPauseLock.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
|
protectedvirtual |
Reimplemented in mu::Parser.
Definition at line 440 of file muParserBase.cpp.
References GetVar(), mVectorVars, and SetVectorVar().
Referenced by mu::ParserTokenReader::IsVarTok().
ParserBase & mu::ParserBase::operator= | ( | const ParserBase & | a_Parser | ) |
Assignement operator.
Implemented by calling Assign(a_Parser). Self assignement is suppressed.
a_Parser | Object to copy to this. |
nothrow |
Definition at line 310 of file muParserBase.cpp.
References Assign().
|
private |
Parse the command code.
Command code contains precalculated stack positions of the values and the associated operators. The Stack is filled beginning from index one the value at index zero is not used at all.
Definition at line 1637 of file muParserBase.cpp.
References ParseCmdCodeBulk().
Referenced by ParseString(), and PauseLoopMode().
|
private |
Evaluate the RPN.
nOffset | The offset added to variable addresses (for bulk mode) |
nThreadID | OpenMP Thread id of the calling thread |
Definition at line 1647 of file muParserBase.cpp.
References mu::cmADD, mu::cmASSIGN, mu::SToken::Cmd, mu::cmDIV, mu::cmELSE, mu::cmEND, mu::cmENDIF, mu::cmEQ, mu::cmFUNC, mu::cmGE, mu::cmGT, mu::cmIF, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmPOW, mu::cmSUB, mu::cmVAL, mu::cmVAR, mu::cmVARMUL, mu::cmVARPOW2, mu::cmVARPOW3, mu::cmVARPOW4, mu::cmVARPOWN, mu::ecINTERNAL_ERROR, Error(), mu::ParserByteCode::GetBase(), intPower(), mu::State::m_byteCode, mu::State::m_stackBuffer, m_state, nMaxThreads, and mu::MathImpl< T >::Pow().
Referenced by Eval(), and ParseCmdCode().
|
private |
OpenMP optimized parallel bytecode executor.
nVectorLength | size_t |
Definition at line 1892 of file muParserBase.cpp.
References mu::cmADD, mu::cmASSIGN, mu::SToken::Cmd, mu::cmDIV, mu::cmELSE, mu::cmEND, mu::cmENDIF, mu::cmEQ, mu::cmFUNC, mu::cmGE, mu::cmGT, mu::cmIF, mu::cmLAND, mu::cmLE, mu::cmLOR, mu::cmLT, mu::cmMUL, mu::cmNEQ, mu::cmPOW, mu::cmSUB, mu::cmVAL, mu::cmVAR, mu::cmVARMUL, mu::cmVARPOW2, mu::cmVARPOW3, mu::cmVARPOW4, mu::cmVARPOWN, mu::ecINTERNAL_ERROR, Error(), mu::ParserByteCode::GetBase(), intPower(), m_buffer, mu::State::m_byteCode, mu::State::m_numResults, mu::State::m_stackBuffer, m_state, nMaxThreads, and mu::MathImpl< T >::Pow().
Referenced by Eval().
|
private |
One of the two main parse functions.
Parse expression from input string. Perform syntax checking and create bytecode. After parsing the string and creating the bytecode the function pointer m_pParseFormula will be changed to the second parse routine the uses bytecode instead of string parsing.
Definition at line 2400 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, CreateRPN(), m_compilingState, mu::State::m_expr, m_pParseFormula, m_pTokenReader, m_state, m_stateStacks, mu::State::m_usedVar, nthLoopElement, nthLoopPartEquation, ParseCmdCode(), and StripSpaces().
Referenced by ReInit().
void mu::ParserBase::PauseLoopMode | ( | bool | _bPause = true | ) |
This member function pauses the loop mode, so that the new assigned equation does not invalidate already parsed equations.
_bPause | bool |
Definition at line 3399 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, g_DbgDumpStack, m_compilingState, m_pParseFormula, m_state, m_stateStacks, nthLoopElement, nthLoopPartEquation, ParseCmdCode(), NumeReKernel::print(), and toString().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
|
private |
Reset parser to string parsing mode and clear internal buffers.
Clear bytecode, reset the token reader.
nothrow |
Definition at line 415 of file muParserBase.cpp.
References mu::State::clear(), m_compilingState, m_nIfElseCounter, m_pParseFormula, m_pTokenReader, m_vStringBuf, and ParseString().
Referenced by AddCallback(), Assign(), ClearConst(), ClearFun(), ClearInfixOprt(), ClearOprt(), ClearPostfixOprt(), ClearVar(), DefineConst(), DefineStrConst(), DefineVar(), EnableBuiltInOprt(), EnableOptimizer(), RemoveVar(), and SetExpr().
void mu::ParserBase::RemoveVar | ( | const string_type & | a_strVarName | ) |
Remove a variable from internal storage.
nothrow |
Removes a variable if it exists. If the Variable does not exist nothing will be done.
Definition at line 2473 of file muParserBase.cpp.
References m_lDataStorage, m_VarDef, and ReInit().
Referenced by ClearVectorVars(), FlowCtrl::reset(), ProcedureVarFactory::reset(), and mu::Test::ParserTester::TestInterface().
|
private |
This member function replaces var occurences with the names of local variables.
sLine | std::string& |
Definition at line 3722 of file muParserBase.cpp.
References checkDelimiter(), and mVarMapPntr.
Referenced by SetExpr().
void mu::ParserBase::ResetLocale | ( | ) |
Resets the locale.
The default locale used "." as decimal separator, no thousands separator and "," as function argument separator.
Definition at line 389 of file muParserBase.cpp.
References s_locale, and SetArgSep().
void mu::ParserBase::SetArgSep | ( | char_type | cArgSep | ) |
Set argument separator.
cArgSep | the argument separator character. |
Definition at line 2617 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by ResetLocale().
void mu::ParserBase::SetCompiling | ( | bool | _bCompiling = true | ) |
Activate the compiling step for the parser.
_bCompiling | bool |
Definition at line 3164 of file muParserBase.cpp.
References bCompiling.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), and FlowCtrl::evalRangeBasedHeader().
void mu::ParserBase::SetDecSep | ( | char_type | cDecSep | ) |
Set the decimal separator.
cDecSep | Decimal separator as a character value. |
By default muparser uses the "C" locale. The decimal separator of this locale is overwritten by the one provided here.
Definition at line 363 of file muParserBase.cpp.
References s_locale.
void mu::ParserBase::SetExpr | ( | StringView | a_sExpr | ) |
Set the expression. Triggers first time calculation thus the creation of the bytecode and scanning of used variables.
a_sExpr | StringView |
Definition at line 616 of file muParserBase.cpp.
References bMakeLoopByteCode, bPauseLoopByteCode, compileVectors(), ContainsVectorVars(), mu::ecMISSING_PARENS, Error(), StringViewBase::find_first_of(), GetExpr(), IsAlreadyParsed(), m_pTokenReader, m_state, mu::State::m_valid, mVarMapPntr, ReInit(), replaceLocalVars(), and StringViewBase::to_string().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::calc(), calculatePercentageAvgAndCreateParserVariables(), Assertion::checkAssertion(), FlowCtrl::compile(), compileVectorExpansion(), compileVectors(), compileVectorsInMultiArgFunc(), Plot::constructDataLegendElement(), FunctionDefinition::convertToValues(), Plot::create2dDrawing(), Plot::create3dDrawing(), createDatagrid(), Plot::createDataLegends(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), NumeRe::StringParser::createStringOutput(), Plot::createSubPlotSet(), NumeRe::StringParser::createTerminalOutput(), differentiate(), mu::Test::ParserTester::EqnTestInt(), mu::Test::ParserTester::EqnTestWithVarChange(), NumeRe::StringParser::eval(), FlowCtrl::evalHeader(), evalMatOp(), evalPoints(), FlowCtrl::evalRangeBasedHeader(), NumeRe::StringLogicParser::evalStringLogic(), NumeRe::StringLogicParser::evalStringTernary(), evaluateExpression(), evaluateFittingParams(), evaluateNumerical(), evaluateParameterValues(), ProcedureVarFactory::evaluateProcedureArguments(), Plot::evaluateSubplot(), FlowCtrl::extractFlagsAndIndexVariables(), Plot::fillData(), findExtrema(), findExtremaInData(), findExtremaInMultiResult(), findZeroes(), findZeroesInData(), findZeroesInMultiResult(), Fitcontroller::fitctrl(), fitDataSet(), StringVector::getBooleanVectorized(), getFittingParameters(), getIndices(), StringVector::getNumericalVectorized(), getParameterValue(), getWindow(), handleCasualIndices(), handleIndexVectors(), integrate(), integrate2d(), localizeExtremum(), localizeZero(), NumeReKernel::MainLoop(), NumeRe::StringParser::numToString(), parseArg(), parseCmdArg(), MemoryManager::parseEvery(), CommandLineParser::parseExprAsNumericalValues(), particleSwarmOptimizer(), Plot::Plot(), Procedure::ProcCalc(), readAndParseIntervals(), readAndParseLegacyIntervals(), Interval::refresh(), refreshBoundaries(), replaceEntityOccurence(), PlotData::setParams(), Odesolver::solve(), NumeRe::StringParser::storeStringResults(), NumeRe::StringParser::storeStringToDataObjects(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categories(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_typeof(), tableMethod_zscore(), taylor(), mu::Test::ParserTester::TestInterface(), mu::Test::ParserTester::TestVarConst(), and mu::Test::ParserTester::ThrowTest().
void mu::ParserBase::SetIndex | ( | unsigned int | _nLoopElement | ) |
Activates the selected position in the internally stored bytecode.
_nLoopElement | unsigned int |
Definition at line 3147 of file muParserBase.cpp.
References m_state, m_stateStacks, nCurrVectorIndex, nthLoopElement, and nthLoopPartEquation.
Referenced by FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), FlowCtrl::for_loop(), FlowCtrl::if_fork(), FlowCtrl::range_based_for_loop(), FlowCtrl::switch_fork(), FlowCtrl::try_catch(), and FlowCtrl::while_loop().
void mu::ParserBase::SetThousandsSep | ( | char_type | cThousandsSep = 0 | ) |
Sets the thousands operator.
cThousandsSep | The thousands separator as a character |
By default muparser uses the "C" locale. The thousands separator of this locale is overwritten by the one provided here.
Definition at line 377 of file muParserBase.cpp.
References s_locale.
void mu::ParserBase::SetVarFactory | ( | facfun_type | a_pFactory, |
void * | pUserData = NULL |
||
) |
Set a function that can create variable pointer for unknown expression variables.
a_pFactory | A pointer to the variable factory. |
pUserData | A user defined context pointer. |
Definition at line 530 of file muParserBase.cpp.
References m_pTokenReader.
Referenced by NumeReKernel::StartUp().
void mu::ParserBase::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 passed name.
sVarName | const std::string& |
vVar | const std::vector<mu::value_type>& |
bAddVectorType | bool |
Definition at line 3548 of file muParserBase.cpp.
References DefineVar(), m_lDataStorage, m_VarDef, and mVectorVars.
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), cmd_reload(), compileVectors(), CreateRPN(), CreateTempVectorVar(), evalMatOp(), NumeReKernel::executePlugins(), handleCachedDataAccess(), handleMafDataAccess(), OnDetectVar(), parser_declareDataMatrixValuesForIndices(), parser_declareMatrixReturnValuesForIndices(), Procedure::procedureInterface(), replaceDataEntities(), and Procedure::replaceReturnVal().
|
private |
Dump stack content.
This function is used for debugging only.
Definition at line 2627 of file muParserBase.cpp.
References c_DefaultOprt, mu::cmASSIGN, mu::cmBC, mu::cmBO, mu::cmELSE, mu::cmEND, mu::cmENDIF, mu::cmFUNC, mu::cmFUNC_BULK, mu::cmFUNC_STR, mu::cmIF, mu::cmOPRT_BIN, mu::cmOPRT_INFIX, mu::cmUNKNOWN, mu::cmVAL, mu::cmVAR, mu::ParserStack< TValueType >::empty(), mu::ParserToken< TBase, TString >::GetAsString(), mu::ParserToken< TBase, TString >::GetType(), mu::ParserToken< TBase, TString >::GetVal(), mu::ParserStack< TValueType >::pop(), NumeReKernel::print(), NumeReKernel::printPreFmt(), toString(), and mu::tpSTR.
void mu::ParserBase::UpdateVectorVar | ( | const std::string & | sVarName | ) |
This member function updates the corresponding variable of a vector with the previously newly assigned value.
sVarName | const std::string& |
Definition at line 3600 of file muParserBase.cpp.
References GetVar(), and mVectorVars.
Referenced by evaluateTemporaryVectors(), and handleCachedDataAccess().
const char_type * mu::ParserBase::ValidInfixOprtChars | ( | ) | const |
Virtual function that defines the characters allowed in infix operator definitions.
Definition at line 1077 of file muParserBase.cpp.
References m_sInfixOprtChars.
Referenced by DefineInfixOprt(), mu::ParserTokenReader::ExtractOperatorToken(), and mu::ParserTokenReader::IsInfixOpTok().
const char_type * mu::ParserBase::ValidNameChars | ( | ) | const |
Virtual function that defines the characters allowed in name identifiers.
Definition at line 1057 of file muParserBase.cpp.
References m_sNameChars.
Referenced by DefineConst(), DefineFun(), DefineStrConst(), DefineVar(), mu::ParserTokenReader::IsFunTok(), mu::ParserTokenReader::IsStrVarTok(), mu::ParserTokenReader::IsUndefVarTok(), mu::ParserTokenReader::IsValTok(), mu::ParserTokenReader::IsVarTok(), and mu::ParserTokenReader::ReadNextToken().
const char_type * mu::ParserBase::ValidOprtChars | ( | ) | const |
Virtual function that defines the characters allowed in operator definitions.
Definition at line 1067 of file muParserBase.cpp.
References m_sOprtChars.
Referenced by DefineOprt(), DefinePostfixOprt(), and mu::ParserTokenReader::IsPostOpTok().
|
friend |
Definition at line 71 of file muParserBase.h.
|
private |
Definition at line 348 of file muParserBase.h.
Referenced by ActivateLoopMode(), DeactivateLoopMode(), IsCompiling(), and SetCompiling().
|
private |
Definition at line 345 of file muParserBase.h.
Referenced by ActivateLoopMode(), ActiveLoopMode(), CacheCurrentAccess(), CacheCurrentEquation(), CacheCurrentTarget(), CanCacheAccess(), DeactivateLoopMode(), DisableAccessCaching(), Eval(), GetCachedAccess(), GetCachedEquation(), GetCachedTarget(), getNextVectorVarIndex(), getTarget(), HasCachedAccess(), IsAlreadyParsed(), IsNotLastStackItem(), IsValidByteCode(), ParserBase(), ParseString(), PauseLoopMode(), and SetExpr().
|
private |
Definition at line 347 of file muParserBase.h.
Referenced by IsLockedPause(), LockPause(), and ParserBase().
|
private |
Definition at line 346 of file muParserBase.h.
Referenced by CacheCurrentAccess(), CacheCurrentEquation(), CacheCurrentTarget(), CanCacheAccess(), DisableAccessCaching(), Eval(), GetCachedAccess(), GetCachedEquation(), GetCachedTarget(), getTarget(), HasCachedAccess(), IsAlreadyParsed(), IsNotLastStackItem(), ParserBase(), ParseString(), PauseLoopMode(), and SetExpr().
|
staticprotected |
Identifiers for built in binary operators.
When defining custom binary operators with #AddOprt(...) make sure not to choose names conflicting with these definitions.
Definition at line 227 of file muParserBase.h.
Referenced by DefineOprt(), GetOprtDef(), and StackDump().
|
private |
Definition at line 373 of file muParserBase.h.
Referenced by GetCachedEquation(), and GetCachedTarget().
|
staticprotected |
Definition at line 229 of file muParserBase.h.
Referenced by CreateRPN(), and EnableDebugDump().
|
staticprotected |
Definition at line 230 of file muParserBase.h.
Referenced by ActivateLoopMode(), CreateRPN(), DeactivateLoopMode(), EnableDebugDump(), Eval(), GetExpr(), and PauseLoopMode().
|
private |
Flag that can be used for switching built in operators on and off.
Definition at line 364 of file muParserBase.h.
Referenced by Assign(), DefineOprt(), EnableBuiltInOprt(), and HasBuiltInOprt().
|
mutableprivate |
Definition at line 335 of file muParserBase.h.
Referenced by Eval(), evaluateTemporaryVectors(), and ParseCmdCodeBulkParallel().
|
mutableprivate |
Definition at line 331 of file muParserBase.h.
Referenced by ApplyBinOprt(), ApplyFunc(), ApplyIfElse(), ApplyStrFunc(), Assign(), compileVectorExpansion(), compileVectors(), compileVectorsInMultiArgFunc(), CreateRPN(), DeactivateLoopMode(), EnableOptimizer(), ParserBase(), ParseString(), PauseLoopMode(), and ReInit().
|
mutableprivate |
Definition at line 332 of file muParserBase.h.
Referenced by ClearVectorVars(), and getTarget().
|
private |
user constants.
Definition at line 360 of file muParserBase.h.
Referenced by Assign(), ClearConst(), DefineConst(), DefineVar(), GetConst(), and mu::ParserTokenReader::SetParent().
|
private |
Map of function names and pointers.
Definition at line 356 of file muParserBase.h.
Referenced by AddCallback(), Assign(), ClearFun(), DefineFun(), evaluateTemporaryVectors(), FindMultiArgFunc(), GetFunDef(), and mu::ParserTokenReader::SetParent().
|
private |
unary infix operator.
Definition at line 358 of file muParserBase.h.
Referenced by AddCallback(), Assign(), ClearInfixOprt(), DefineInfixOprt(), and mu::ParserTokenReader::SetParent().
|
mutable |
Definition at line 99 of file muParserBase.h.
Referenced by ProcedureVarFactory::evaluateProcedureArguments(), getNextVectorVarIndex(), RemoveVar(), SetVectorVar(), NumeReKernel::StartUp(), and ~ParserBase().
|
mutableprivate |
Internal counter for keeping track of nested if-then-else clauses.
Definition at line 370 of file muParserBase.h.
Referenced by Assign(), CreateRPN(), and ReInit().
|
private |
Binary operator callbacks.
Definition at line 359 of file muParserBase.h.
Referenced by AddCallback(), Assign(), ClearOprt(), DefineOprt(), and mu::ParserTokenReader::SetParent().
|
private |
Postfix operator callbacks.
Definition at line 357 of file muParserBase.h.
Referenced by AddCallback(), Assign(), ClearPostfixOprt(), DefinePostfixOprt(), and mu::ParserTokenReader::SetParent().
|
mutableprivate |
Pointer to the parser function.
Eval() calls the function whose address is stored there.
Definition at line 330 of file muParserBase.h.
Referenced by Eval(), ParseString(), PauseLoopMode(), and ReInit().
|
private |
Managed pointer to the token reader object.
Definition at line 354 of file muParserBase.h.
Referenced by AddValIdent(), ApplyBinOprt(), ApplyFunc(), ApplyStrFunc(), Assign(), compileVectors(), CreateRPN(), Error(), GetArgSep(), GetUsedVar(), InitTokenReader(), ParserBase(), ParseString(), ReInit(), SetArgSep(), SetExpr(), and SetVarFactory().
|
private |
Charset for infix operator tokens.
Definition at line 368 of file muParserBase.h.
Referenced by Assign(), DefineInfixOprtChars(), and ValidInfixOprtChars().
|
private |
Charset for names.
Definition at line 366 of file muParserBase.h.
Referenced by Assign(), DefineNameChars(), and ValidNameChars().
|
private |
Charset for postfix/ binary operator tokens.
Definition at line 367 of file muParserBase.h.
Referenced by Assign(), DefineOprtChars(), and ValidOprtChars().
|
private |
Definition at line 334 of file muParserBase.h.
Referenced by DeactivateLoopMode(), Eval(), evaluateTemporaryVectors(), GetExpr(), IsAlreadyParsed(), ParseCmdCodeBulk(), ParseCmdCodeBulkParallel(), ParserBase(), ParseString(), PauseLoopMode(), SetExpr(), and SetIndex().
|
mutableprivate |
Definition at line 333 of file muParserBase.h.
Referenced by ActivateLoopMode(), CacheCurrentAccess(), CacheCurrentEquation(), CacheCurrentTarget(), CanCacheAccess(), DeactivateLoopMode(), DisableAccessCaching(), Eval(), GetCachedAccess(), GetCachedEquation(), GetCachedTarget(), getTarget(), HasCachedAccess(), IsNotLastStackItem(), IsValidByteCode(), ParseString(), PauseLoopMode(), and SetIndex().
|
private |
user defined string constants
Definition at line 361 of file muParserBase.h.
Referenced by Assign(), ClearConst(), DefineStrConst(), and mu::ParserTokenReader::SetParent().
|
private |
user defind variables.
Definition at line 362 of file muParserBase.h.
Referenced by Assign(), ClearVar(), DefineVar(), GetVar(), GetVectors(), RemoveVar(), mu::ParserTokenReader::SetParent(), and SetVectorVar().
|
mutableprivate |
String buffer, used for storing string function arguments.
Definition at line 351 of file muParserBase.h.
Referenced by Assign(), CreateRPN(), DefineStrConst(), mu::ParserTokenReader::IsString(), and ReInit().
|
private |
Definition at line 352 of file muParserBase.h.
Referenced by Assign(), DefineStrConst(), and mu::ParserTokenReader::IsStrVarTok().
|
mutable |
Definition at line 98 of file muParserBase.h.
Referenced by Procedure::execute(), NumeReKernel::MainLoop(), ParserBase(), FlowCtrl::prepareLocalVarsAndReplace(), Procedure::procedureInterface(), replaceLocalVars(), FlowCtrl::reset(), Procedure::resetProcedure(), and SetExpr().
|
mutableprivate |
Maximum number of threads spawned by OpenMP when using the bulk mode.
Definition at line 340 of file muParserBase.h.
Referenced by ClearVectorVars(), compileVectors(), ContainsVectorVars(), CreateRPN(), Eval(), GetVectors(), GetVectorVar(), OnDetectVar(), SetVectorVar(), and UpdateVectorVar().
|
private |
Definition at line 344 of file muParserBase.h.
Referenced by ActivateLoopMode(), DeactivateLoopMode(), Eval(), getNextVectorVarIndex(), ParserBase(), and SetIndex().
|
private |
Definition at line 349 of file muParserBase.h.
Referenced by CreateRPN(), Eval(), ParseCmdCodeBulk(), ParseCmdCodeBulkParallel(), and ParserBase().
|
private |
Definition at line 342 of file muParserBase.h.
Referenced by ActivateLoopMode(), CacheCurrentAccess(), CacheCurrentEquation(), CacheCurrentTarget(), CanCacheAccess(), DeactivateLoopMode(), DisableAccessCaching(), Eval(), GetCachedAccess(), GetCachedEquation(), GetCachedTarget(), getNextVectorVarIndex(), getTarget(), HasCachedAccess(), IsNotLastStackItem(), IsValidByteCode(), ParserBase(), ParseString(), PauseLoopMode(), and SetIndex().
|
private |
Definition at line 343 of file muParserBase.h.
Referenced by ActivateLoopMode(), DeactivateLoopMode(), Eval(), getNextVectorVarIndex(), IsNotLastStackItem(), ParserBase(), ParseString(), PauseLoopMode(), and SetIndex().
|
staticprotected |
The locale used by the parser.
Definition at line 228 of file muParserBase.h.
Referenced by mu::Parser::IsVal(), ResetLocale(), SetDecSep(), and SetThousandsSep().