a_iPos = (
int)mu::string_type::npos,
215 intiArgCount)
const;
218 conststd::vector<token_type> &a_vArg)
const;
221 conststd::vector<token_type> &a_vArg)
const;
232 #if defined(MUP_DUMP_STACK) | defined(MUP_DUMP_CMDCODE)Mathematical expressions parser (base parser engine).
varmap_type m_VarDef
user defind variables.
ParserTokenReader token_reader_type
Typedef for the token reader.
const string_type & GetExpr() const
Retrieve the formula.
value_type ParseValue() const
Return result for constant functions.
const char_type * ValidInfixOprtChars() const
Virtual function that defines the characters allowed in infix operator definitions.
void Assign(const ParserBase &a_Parser)
Copy state of a parser object to this.
const ParserByteCode::map_type * m_pCmdCode
Formula converted to bytecode, points to the data of the bytecode class.
void AddValIdent(identfun_type a_pCallback)
token_type ApplyNumFunc(const token_type &a_FunTok, const std::vector< token_type > &a_vArg) const
static const char_type * c_DefaultOprt[]
Identifiers for built in binary operators.
ParseFunction m_pParseFormula
Pointer to the parser function.
value_type ParseString() const
One of the two main parse functions.
void ApplyBinOprt(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal) const
void CheckName(const string_type &a_strName, const string_type &a_CharSet) const
Check if a name contains invalid characters.
const varmap_type & GetVar() const
Return a map containing the used variables only.
void Init()
Initialize user defined functions.
stringbuf_type m_vStringBuf
String buffer, used for storing string function arguments.
void AddCallback(const string_type &a_strName, const ParserCallback &a_Callback, funmap_type &a_Storage, const char_type *a_szCharSet)
Add a function or operator callback to the parser.
void ClearFormula()
Clear the formula.
bool HasBuiltInOprt() const
Query status of built in variables.
bool m_bOptimize
Flag that indicates if the optimizer is on or off.
const char_type ** GetOprtDef() const
Get the default symbols used for the built in operators.
virtual void InitCharSets()=0
void Error(EErrorCodes a_iErrc, int a_iPos=(int) mu::string_type::npos, const string_type &a_strTok=string_type()) const
Create an error containing the parse error position.
ParserBase()
Constructor.
void EnableOptimizer(bool a_bIsOn=true)
Enable or disable the formula optimization feature.
funmap_type m_InfixOprtDef
unary infix operator.
bool m_bUseByteCode
Flag that indicates if bytecode parsing is on or off.
void ApplyFunc(ParserStack< token_type > &a_stOpt, ParserStack< token_type > &a_stVal, int iArgCount) const
Apply a function token.
virtual void InitOprt()=0
const valmap_type & GetConst() const
Return a map containing all parser constants.
ParserToken< value_type, string_type > token_type
Type used for parser tokens.
void DefineInfixOprt(const string_type &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, bool a_bAllowOpt=true)
Add a user defined operator.
void EnableByteCode(bool a_bIsOn=true)
Enable or disable parsing from Bytecode.
void DefineStrConst(const string_type &a_sName, const string_type &a_strVal)
Define a new string constant.
valmap_type m_ConstDef
user constants.
int GetOprtPri(const token_type &a_Tok) const
Get operator priority.
void SetVarFactory(facfun_type a_pFactory, void *pUserData=NULL)
value_type Eval() const
Calculate the result.
const funmap_type & GetFunDef() const
Return prototypes of all parser functions.
void ClearInfixOprt()
Clear the user defined Prefix operators.
const char_type * ValidNameChars() const
Virtual function that defines the characters allowed in name identifiers.
void DefineVar(const string_type &a_sName, value_type *a_fVar)
Add a user defined variable.
value_type ParseCmdCode() const
Parse the command code.
void DefineConst(const string_type &a_sName, value_type a_fVal)
Add a user defined constant.
void RemoveVar(const string_type &a_strVarName)
Remove a variable from internal storage.
funmap_type m_FunDef
Map of function names and pointers.
funmap_type m_PostOprtDef
Postfix operator callbacks.
funmap_type m_OprtDef
Binary operator callbacks.
void ClearOprt()
Clear all user defined binary operators.
void DefineOprt(const string_type &a_strName, fun_type2 a_pFun, unsigned a_iPri=0, bool a_bAllowOpt=false)
Define a binary operator.
virtual void InitConst()=0
string_type m_sInfixOprtChars
Charset for infix operator tokens.
void DefineOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of binary operators and postfix operators.
ParserError exception_type
Type of the error class.
void ClearPostfixOprt()
Clear all user defined postfix operators.
void ClearFun()
Clear all functions.
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.
void DefineInfixOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of infix operators.
ParserBase & operator=(const ParserBase &a_Parser)
Assignement operator.
value_type(ParserBase::* ParseFunction)() const
Typedef for the parse functions.
std::vector< string_type > stringbuf_type
Type for a vector of strings.
void ClearConst()
Clear all user defined constants.
const char_type * ValidOprtChars() const
Virtual function that defines the characters allowed in operator definitions.
void ClearVar()
Clear all user defined variables.
void SetArgSep(char_type cArgSep)
Set argument separator.
std::unique_ptr< token_reader_type > m_pTokenReader
Managed pointer to the token reader object.
void DefineNameChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of functions, variables, constants.
void EnableBuiltInOprt(bool a_bIsOn=true)
Enable or disable the built in binary operators.
void ReInit() const
Reset parser to string parsing mode and clear internal buffers.
strmap_type m_StrVarDef
user defined string constants
void DefinePostfixOprt(const string_type &a_strFun, fun_type1 a_pOprt, bool a_bAllowOpt=true)
Add a user defined operator.
void InitTokenReader()
Initialize the token reader.
void SetExpr(const string_type &a_sExpr)
Set the formula.
char_type GetArgSep() const
Get the argument separator character.
ParserByteCode m_vByteCode
The Bytecode class.
string_type m_sNameChars
Charset for names.
bool m_bBuiltInOp
Flag that can be used for switching built in operators on and off.
string_type m_sOprtChars
Charset for postfix/ binary operator tokens.
stringbuf_type m_vStringVarBuf
const varmap_type & GetUsedVar() const
Return a map containing the used variables only.
Bytecode implementation of the Math Parser.
bytecode_type map_type
Underlying type of the container.
Encapsulation of prototypes for a numerical parser function.
Error class of the parser.
Parser stack implementation.
Token reader for the ParserBase class.
#define MUP_DEFINE_FUNC(TYPE)
Definition of the parser bytecode class.
This file contains standard definitions used by the parser.
This file defines the error class used by the parser.
This file defines the stack used by muparser.
This file contains the parser token reader definition.
Namespace for mathematical applications.
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
int(* identfun_type)(const char_type *sExpr, int *nPos, value_type *fVal)
Callback used for functions that identify values in a string.
value_type(* strfun_type2)(const char_type *, value_type)
Callback type used for functions taking a string and a value as arguments.
value_type(* strfun_type3)(const char_type *, value_type, value_type)
Callback type used for functions taking a string and two values as arguments.
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
std::map< string_type, value_type > valmap_type
Type used for storing constants.
value_type(* fun_type5)(value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
string_type::value_type char_type
The character type used by the parser.
value_type *(* facfun_type)(const char_type *, void *)
Callback used for variable creation factory functions.
std::map< string_type, ParserCallback > funmap_type
Container for Callback objects.
std::map< string_type, value_type * > varmap_type
Type used for storing variables.
@ prINFIX
Signs have a higher priority than ADD_SUB, but lower than power operator.
value_type(* fun_type2)(value_type, value_type)
Callback type used for functions with two arguments.
value_type(* fun_type3)(value_type, value_type, value_type)
Callback type used for functions with three arguments.
double value_type
The numeric datatype used by the parser.
value_type(* fun_type4)(value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
std::string string_type
The stringtype used by the parser.
std::map< string_type, std::size_t > strmap_type
Type for assigning a string name to an index in the internal string table.
value_type(* fun_type0)()
Callback type used for functions without arguments.
value_type(* fun_type1)(value_type)
Callback type used for functions with a single arguments.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4