OpcUaCanOpen
CANopen OPC-UA server
|
Mathematical expressions parser (base parser engine). More...
#include <muParserBase.h>
Inherited by mu::Parser, and mu::ParserInt.
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 | |
ParserBase () | |
Constructor. More... | |
ParserBase (const ParserBase &a_Parser) | |
Copy constructor. More... | |
ParserBase & | operator= (const ParserBase &a_Parser) |
Assignment operator. More... | |
virtual | ~ParserBase () |
value_type | Eval () const |
Calculate the result. More... | |
value_type * | Eval (int &nStackSize) const |
Evaluate an expression containing comma separated subexpressions. More... | |
void | Eval (value_type *results, int nBulkSize) |
int | GetNumResults () const |
Return the number of results on the calculation stack. More... | |
void | SetExpr (const string_type &a_sExpr) |
Set the formula. 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 a_bAllowOpt=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 a_bAllowOpt=false) |
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 a_bAllowOpt=true) |
Add a user defined operator. More... | |
void | DefineInfixOprt (const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool a_bAllowOpt=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 () const |
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... | |
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... | |
Static Public Member Functions | |
static void | EnableDebugDump (bool bDumpCmd, bool bDumpStack) |
Enable the dumping of bytecode and stack content on the console. More... | |
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 value_type(ParserBase::* | ParseFunction) () const |
Typedef for the parse functions. More... | |
typedef std::vector< value_type > | valbuf_type |
Type used for storing an array of values. 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 | Assign (const ParserBase &a_Parser) |
Copy state of a parser object to this. More... | |
void | InitTokenReader () |
Initialize the token reader. More... | |
void | ReInit () const |
Reset parser to string parsing mode and clear internal buffers. 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 () const |
value_type | ParseString () const |
One of the two main parse functions. More... | |
value_type | ParseCmdCode () const |
Parse the command code. More... | |
value_type | ParseCmdCodeBulk (int nOffset, int nThreadID) const |
Evaluate the RPN. 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... | |
ParserByteCode | m_vRPN |
The Bytecode class. More... | |
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... | |
valbuf_type | m_vStackBuffer |
This is merely a buffer used for the stack in the cmd parsing routine. More... | |
int | m_nFinalResultIdx |
Static Private Attributes | |
static const int | s_MaxNumOpenMPThreads = 16 |
Maximum number of threads spawned by OpenMP when using the bulk mode. More... | |
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 62 of file muParserBase.h.
Type of the error class.
Included for backwards compatibility.
Definition at line 97 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 74 of file muParserBase.h.
|
private |
Type for a vector of strings.
Definition at line 80 of file muParserBase.h.
|
private |
Typedef for the token reader.
Definition at line 83 of file muParserBase.h.
|
private |
Type used for parser tokens.
Definition at line 86 of file muParserBase.h.
|
private |
Type used for storing an array of values.
Definition at line 77 of file muParserBase.h.
mu::ParserBase::ParserBase | ( | ) |
Constructor.
a_szFormula | the formula to interpret. |
ParserException | if a_szFormula is null. |
Definition at line 79 of file muParserBase.cpp.
mu::ParserBase::ParserBase | ( | const ParserBase & | a_Parser | ) |
Copy constructor.
The parser can be safely copy constructed but the bytecode is reset during copy construction.
Definition at line 108 of file muParserBase.cpp.
|
virtual |
Definition at line 131 of file muParserBase.cpp.
|
private |
Add a function or operator callback to the parser.
Definition at line 338 of file muParserBase.cpp.
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. Thus it's possible to parse for hex values, binary values and floating point values.
Definition at line 321 of file muParserBase.cpp.
|
private |
Performs the necessary steps to write code for the execution of binary operators into the bytecode.
Definition at line 908 of file muParserBase.cpp.
|
private |
Apply a function token.
iArgCount | Number of Arguments actually gathered used only for multiarg functions. |
exception_type | if Argument count does not match function requirements. |
Definition at line 792 of file muParserBase.cpp.
|
private |
Definition at line 874 of file muParserBase.cpp.
|
private |
Apply a binary operator.
a_stOpt | The operator stack |
a_stVal | The value stack |
Definition at line 948 of file muParserBase.cpp.
|
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 752 of file muParserBase.cpp.
|
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 157 of file muParserBase.cpp.
|
private |
Check if a name contains invalid characters.
ParserException | if the name contains invalid characters. |
Definition at line 393 of file muParserBase.cpp.
|
private |
Check if a name contains invalid characters.
ParserException | if the name contains invalid characters. |
Definition at line 371 of file muParserBase.cpp.
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 1496 of file muParserBase.cpp.
void mu::ParserBase::ClearFun | ( | ) |
Clear all functions.
nothrow |
Definition at line 1483 of file muParserBase.cpp.
void mu::ParserBase::ClearInfixOprt | ( | ) |
Clear the user defined Prefix operators.
nothrow |
Definition at line 1530 of file muParserBase.cpp.
void mu::ParserBase::ClearOprt | ( | ) |
Clear all user defined binary operators.
nothrow |
Definition at line 1519 of file muParserBase.cpp.
void mu::ParserBase::ClearPostfixOprt | ( | ) |
Clear all user defined postfix operators.
nothrow |
Definition at line 1508 of file muParserBase.cpp.
void mu::ParserBase::ClearVar | ( | ) |
Clear all user defined variables.
nothrow | Resets the parser to string parsing mode by calling ReInit. |
Definition at line 1456 of file muParserBase.cpp.
|
private |
Definition at line 1177 of file muParserBase.cpp.
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 616 of file muParserBase.cpp.
|
inline |
Define a parser function without arguments.
a_strName | Name of the function |
a_pFun | Pointer to the callback function |
a_bAllowOpt | A flag indicating this function may be optimized |
Definition at line 133 of file muParserBase.h.
void mu::ParserBase::DefineInfixOprt | ( | const string_type & | a_sName, |
fun_type1 | a_pFun, | ||
int | a_iPrec = prINFIX , |
||
bool | a_bAllowOpt = 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] | a_bAllowOpt | True if operator is volatile (default=false) |
Definition at line 530 of file muParserBase.cpp.
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 459 of file muParserBase.cpp.
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 441 of file muParserBase.cpp.
void mu::ParserBase::DefineOprt | ( | const string_type & | a_sName, |
fun_type2 | a_pFun, | ||
unsigned | a_iPrec = 0 , |
||
EOprtAssociativity | a_eAssociativity = oaLEFT , |
||
bool | a_bAllowOpt = false |
||
) |
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 552 of file muParserBase.cpp.
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 450 of file muParserBase.cpp.
void mu::ParserBase::DefinePostfixOprt | ( | const string_type & | a_sName, |
fun_type1 | a_pFun, | ||
bool | a_bAllowOpt = true |
||
) |
Add a user defined operator.
Definition at line 498 of file muParserBase.cpp.
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 574 of file muParserBase.cpp.
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 value. |
ParserException | in case the name contains invalid signs or a_pVar is NULL. |
Definition at line 595 of file muParserBase.cpp.
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 1570 of file muParserBase.cpp.
|
static |
Enable the dumping of bytecode and 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 1554 of file muParserBase.cpp.
void mu::ParserBase::EnableOptimizer | ( | bool | a_bIsOn = true | ) |
Enable or disable the formula optimization feature.
nothrow |
Definition at line 1541 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 that's the only purpose of this function. |
Definition at line 1445 of file muParserBase.cpp.
value_type mu::ParserBase::Eval | ( | ) | const |
Calculate the result.
A note on const correctness: I consider it important that Calc is a const function. Due to caching operations Calc changes only the state of internal variables with one exception m_UsedVar this is reset during string parsing and accessible from the outside. Instead of making Calc non const GetUsedVar is non const because it explicitly calls Eval() forcing this update.
ParseException | if no Formula is set or in case of any other error related to the formula. |
Definition at line 1713 of file muParserBase.cpp.
value_type * mu::ParserBase::Eval | ( | int & | nStackSize | ) | const |
Evaluate an expression containing comma separated subexpressions.
[out] | nStackSize | The total number of results available |
This member function can be used to retrieve all results of an expression made up of multiple comma separated subexpressions (i.e. "x+y,sin(x),cos(y)")
Definition at line 1676 of file muParserBase.cpp.
void mu::ParserBase::Eval | ( | value_type * | results, |
int | nBulkSize | ||
) |
Definition at line 1719 of file muParserBase.cpp.
char_type mu::ParserBase::GetArgSep | ( | ) | const |
Get the argument separator character.
Definition at line 1589 of file muParserBase.cpp.
const valmap_type & mu::ParserBase::GetConst | ( | ) | const |
Return a map containing all parser constants.
Definition at line 719 of file muParserBase.cpp.
const string_type & mu::ParserBase::GetExpr | ( | ) | const |
Retrieve the formula.
Definition at line 742 of file muParserBase.cpp.
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 735 of file muParserBase.cpp.
int mu::ParserBase::GetNumResults | ( | ) | const |
Return the number of results on the calculation stack.
If the expression contains comma separated subexpressions (i.e. "sin(y), x+y"). There may be more than one return value. This function returns the number of available results.
Definition at line 1692 of file muParserBase.cpp.
|
private |
Get operator priority.
ParserException | if a_Oprt is no operator code |
Definition at line 663 of file muParserBase.cpp.
const char_type ** mu::ParserBase::GetOprtDef | ( | ) | const |
Get the default symbols used for the built in operators.
Definition at line 432 of file muParserBase.cpp.
|
private |
Get operator priority.
ParserException | if a_Oprt is no operator code |
Definition at line 627 of file muParserBase.cpp.
const varmap_type & mu::ParserBase::GetUsedVar | ( | ) | const |
Return a map containing the used variables only.
Definition at line 688 of file muParserBase.cpp.
const varmap_type & mu::ParserBase::GetVar | ( | ) | const |
Return a map containing the used variables only.
Definition at line 712 of file muParserBase.cpp.
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 269 of file muParserBase.cpp.
bool mu::ParserBase::HasBuiltInOprt | ( | ) | const |
Query status of built in variables.
nothrow |
Definition at line 1581 of file muParserBase.cpp.
|
protected |
Initialize user defined functions.
Calls the virtual functions InitFun(), InitConst() and InitOprt().
Definition at line 513 of file muParserBase.cpp.
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
|
protectedpure virtual |
Implemented in mu::ParserInt, and mu::Parser.
|
private |
Initialize the token reader.
Create new token reader object and submit pointers to function, operator, constant and variable definitions.
nothrow |
Definition at line 237 of file muParserBase.cpp.
|
protectedvirtual |
Reimplemented in mu::Parser.
Definition at line 258 of file muParserBase.cpp.
ParserBase & mu::ParserBase::operator= | ( | const ParserBase & | a_Parser | ) |
Assignment operator.
Implemented by calling Assign(a_Parser). Self assignment is suppressed.
a_Parser | Object to copy to this. |
nothrow |
Definition at line 142 of file muParserBase.cpp.
|
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 998 of file muParserBase.cpp.
|
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 1008 of file muParserBase.cpp.
|
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 1419 of file muParserBase.cpp.
|
private |
Reset parser to string parsing mode and clear internal buffers.
Clear bytecode, reset the token reader.
nothrow |
Definition at line 248 of file muParserBase.cpp.
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 1468 of file muParserBase.cpp.
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 222 of file muParserBase.cpp.
void mu::ParserBase::SetArgSep | ( | char_type | cArgSep | ) |
Set argument separator.
cArgSep | the argument separator character. |
Definition at line 1598 of file muParserBase.cpp.
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 196 of file muParserBase.cpp.
void mu::ParserBase::SetExpr | ( | const string_type & | a_sExpr | ) |
Set the formula.
a_strFormula | Formula as string_type |
ParserException | in case of syntax errors. |
Triggers first time calculation thus the creation of the bytecode and scanning of used variables.
Definition at line 412 of file muParserBase.cpp.
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 210 of file muParserBase.cpp.
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 331 of file muParserBase.cpp.
|
private |
Dump stack content.
This function is used for debugging only.
Definition at line 1608 of file muParserBase.cpp.
const char_type * mu::ParserBase::ValidInfixOprtChars | ( | ) | const |
Virtual function that defines the characters allowed in infix operator definitions.
Definition at line 488 of file muParserBase.cpp.
const char_type * mu::ParserBase::ValidNameChars | ( | ) | const |
Virtual function that defines the characters allowed in name identifiers.
Definition at line 468 of file muParserBase.cpp.
const char_type * mu::ParserBase::ValidOprtChars | ( | ) | const |
Virtual function that defines the characters allowed in operator definitions.
Definition at line 478 of file muParserBase.cpp.
|
friend |
Definition at line 64 of file muParserBase.h.
|
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 192 of file muParserBase.h.
|
staticprotected |
Definition at line 194 of file muParserBase.h.
|
staticprotected |
Definition at line 195 of file muParserBase.h.
|
private |
Flag that can be used for switching built in operators on and off.
Definition at line 301 of file muParserBase.h.
|
private |
user constants.
Definition at line 297 of file muParserBase.h.
|
private |
Map of function names and pointers.
Definition at line 293 of file muParserBase.h.
|
private |
unary infix operator.
Definition at line 295 of file muParserBase.h.
|
mutableprivate |
Definition at line 311 of file muParserBase.h.
|
mutableprivate |
Internal counter for keeping track of nested if-then-else clauses.
Definition at line 307 of file muParserBase.h.
|
private |
Binary operator callbacks.
Definition at line 296 of file muParserBase.h.
|
private |
Postfix operator callbacks.
Definition at line 294 of file muParserBase.h.
|
mutableprivate |
Pointer to the parser function.
Eval() calls the function whose address is stored there.
Definition at line 286 of file muParserBase.h.
|
private |
Managed pointer to the token reader object.
Definition at line 291 of file muParserBase.h.
|
private |
Charset for infix operator tokens.
Definition at line 305 of file muParserBase.h.
|
private |
Charset for names.
Definition at line 303 of file muParserBase.h.
|
private |
Charset for postfix/ binary operator tokens.
Definition at line 304 of file muParserBase.h.
|
private |
user defined string constants
Definition at line 298 of file muParserBase.h.
|
private |
user defind variables.
Definition at line 299 of file muParserBase.h.
|
mutableprivate |
The Bytecode class.
Definition at line 287 of file muParserBase.h.
|
mutableprivate |
This is merely a buffer used for the stack in the cmd parsing routine.
Definition at line 310 of file muParserBase.h.
|
mutableprivate |
String buffer, used for storing string function arguments.
Definition at line 288 of file muParserBase.h.
|
private |
Definition at line 289 of file muParserBase.h.
|
staticprotected |
The locale used by the parser.
Definition at line 193 of file muParserBase.h.
|
staticprivate |
Maximum number of threads spawned by OpenMP when using the bulk mode.
Definition at line 89 of file muParserBase.h.