32 #define wxT(x) MUP_T(x)
83 for (
int i=0;
i<a_iArgc; ++
i)
96 for (
int i=0;
i<a_iArgc; ++
i)
109 for (
int i=0;
i<a_iArgc; ++
i)
120 std::size_t pos =
buf.find_first_not_of(
wxT(
"0123456789"));
121 if (pos==std::string::npos)
128 auto iEnd = stream.tellg();
141 if (a_szExpr[0]!=
'$')
163 if (a_szExpr[0]!=
'#')
167 iBits(
sizeof(iVal)*8),
170 for (
i=0; (a_szExpr[
i+1]==
'0' || a_szExpr[
i+1]==
'1') &&
i<iBits; ++
i)
171 iVal |= (
int)(a_szExpr[
i+1]==
'1') << ((iBits-1)-
i);
179 *a_fVal = (unsigned)(iVal >> (iBits-
i) );
190 ParserInt::ParserInt()
210 DefineNameChars(
wxT(
"0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") );
Mathematical expressions parser (base parser engine).
void AddValIdent(identfun_type a_pCallback)
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 DefineOprt(const string_type &a_strName, fun_type2 a_pFun, unsigned a_iPri=0, bool a_bAllowOpt=false)
Define a binary operator.
void DefineOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of binary operators and postfix operators.
void DefineInfixOprtChars(const char_type *a_szCharset)
Define the set of valid characters to be used in names of infix operators.
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 DefineFun(const string_type &a_strName, fun_type0 a_pFun, bool a_bAllowOpt=true)
Error class of the parser.
static int IsHexVal(const char_type *a_szExpr, int *a_iPos, value_type *a_iVal)
static value_type Abs(value_type)
static value_type LessEq(value_type v1, value_type v2)
static value_type GreaterEq(value_type v1, value_type v2)
static value_type Shl(value_type v1, value_type v2)
static value_type Not(value_type v1)
static value_type Div(value_type v1, value_type v2)
static value_type Mul(value_type v1, value_type v2)
static value_type NotEqual(value_type v1, value_type v2)
static value_type Shr(value_type v1, value_type v2)
static value_type UnaryMinus(value_type)
static value_type Or(value_type v1, value_type v2)
static value_type Greater(value_type v1, value_type v2)
static value_type And(value_type v1, value_type v2)
static value_type Add(value_type v1, value_type v2)
static value_type Mod(value_type v1, value_type v2)
static value_type Max(const value_type *a_afArg, int a_iArgc)
virtual void InitOprt()
Initialize operators.
virtual void InitCharSets()
static value_type Sub(value_type v1, value_type v2)
static value_type LogOr(value_type v1, value_type v2)
static value_type LogXor(value_type v1, value_type v2)
static value_type Ite(value_type, value_type, value_type)
static value_type Min(const value_type *a_afArg, int a_iArgc)
static value_type Equal(value_type v1, value_type v2)
static value_type Sign(value_type)
static value_type Sum(const value_type *a_afArg, int a_iArgc)
static value_type Less(value_type v1, value_type v2)
static value_type LogAnd(value_type v1, value_type v2)
static int IsBinVal(const char_type *a_szExpr, int *a_iPos, value_type *a_iVal)
static int IsVal(const char_type *a_szExpr, int *a_iPos, value_type *a_iVal)
virtual void InitFun()
Initialize the default functions.
static void hex(unsigned char c)
Definition of a parser using integer value.
Namespace for mathematical applications.
string_type::value_type char_type
The character type used by the parser.
std::basic_stringstream< char_type, std::char_traits< char_type >, std::allocator< char_type > > stringstream_type
Typedef for easily using stringstream that respect the parser stringtype.
@ prCMP
comparsion operators
@ prMUL_DIV
multiplication/division
double value_type
The numeric datatype used by the parser.
std::string string_type
The stringtype used by the parser.
static int Round(double Num)