C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow 2018-02-14 08:06:37 +11:00
parent f32d2b4bbb
commit a0bca54c31
3 changed files with 118 additions and 128 deletions

View File

@ -15,37 +15,17 @@
#
COMPILER = -c++
#COMPILER = -clang
OPTIMIZATION_OPT = -O1
BASE_OPTIONS = -pedantic-errors -Wall -Wextra -Werror -Wno-long-long
OPTIONS = $(BASE_OPTIONS) $(OPTIMIZATION_OPT)
LINKER_OPT = -L/usr/lib -lstdc++ -lm
ASAN_OPT = -g -fsanitize=address -fno-omit-frame-pointer
MSAN_OPT = -g -fsanitize=memory -fno-omit-frame-pointer
LSAN_OPT = -g -fsanitize=leak -fno-omit-frame-pointer
BUILD_LIST+=exprtk_test
BUILD_LIST+=exprtk_benchmark
BUILD_LIST+=exprtk_simple_example_01
BUILD_LIST+=exprtk_simple_example_02
BUILD_LIST+=exprtk_simple_example_03
BUILD_LIST+=exprtk_simple_example_04
BUILD_LIST+=exprtk_simple_example_05
BUILD_LIST+=exprtk_simple_example_06
BUILD_LIST+=exprtk_simple_example_07
BUILD_LIST+=exprtk_simple_example_08
BUILD_LIST+=exprtk_simple_example_09
BUILD_LIST+=exprtk_simple_example_10
BUILD_LIST+=exprtk_simple_example_11
BUILD_LIST+=exprtk_simple_example_12
BUILD_LIST+=exprtk_simple_example_13
BUILD_LIST+=exprtk_simple_example_14
BUILD_LIST+=exprtk_simple_example_15
BUILD_LIST+=exprtk_simple_example_16
BUILD_LIST+=exprtk_simple_example_17
BUILD_LIST+=exprtk_simple_example_18
BUILD_LIST+=exprtk_simple_example_19
COMPILER := -c++
#COMPILER := -clang
OPTIMIZATION_OPT := -O1
BASE_OPTIONS := -pedantic-errors -Wall -Wextra -Werror -Wno-long-long
OPTIONS := $(BASE_OPTIONS) $(OPTIMIZATION_OPT)
LINKER_OPT := -L/usr/lib -lstdc++ -lm
ASAN_OPT := -g -fsanitize=address -fno-omit-frame-pointer
MSAN_OPT := -g -fsanitize=memory -fno-omit-frame-pointer
LSAN_OPT := -g -fsanitize=leak -fno-omit-frame-pointer
BUILD_SRC := $(wildcard exprtk_*.cpp)
BUILD_LIST := $(BUILD_SRC:%.cpp=%)
all: $(BUILD_LIST)

View File

@ -733,7 +733,7 @@ namespace exprtk
1.0E+013, 1.0E+014, 1.0E+015, 1.0E+016
};
static const std::size_t pow10_size = sizeof(pow10) / sizeof(double);
static const std::size_t pow10_size = sizeof(pow10) / sizeof(double);
namespace numeric
{
@ -23576,7 +23576,7 @@ namespace exprtk
template <typename Type, std::size_t NumberOfParameters>
struct parse_special_function_impl
{
static inline expression_node_ptr process(parser<Type>& p,const details::operator_type opt_type)
static inline expression_node_ptr process(parser<Type>& p,const details::operator_type opt_type, const std::string& sf_name)
{
expression_node_ptr branch[NumberOfParameters];
expression_node_ptr result = error_node();
@ -23592,7 +23592,7 @@ namespace exprtk
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
"ERR126 - Expected '(' for special function",
"ERR126 - Expected '(' for special function '" + sf_name + "'",
exprtk_error_location));
return error_node();
@ -23613,7 +23613,7 @@ namespace exprtk
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
"ERR127 - Expected ',' before next parameter of special function",
"ERR127 - Expected ',' before next parameter of special function '" + sf_name + "'",
exprtk_error_location));
return p.error_node();
@ -23622,7 +23622,15 @@ namespace exprtk
}
if (!p.token_is(token_t::e_rbracket))
{
p.set_error(
make_error(parser_error::e_syntax,
p.current_token(),
"ERR128 - Invalid number of parameters for special function '" + sf_name + "'",
exprtk_error_location));
return p.error_node();
}
else
result = p.expression_generator_.special_function(opt_type,branch);
@ -23634,30 +23642,32 @@ namespace exprtk
inline expression_node_ptr parse_special_function()
{
const std::string sf_name = current_token().value;
// Expect: $fDD(expr0,expr1,expr2) or $fDD(expr0,expr1,expr2,expr3)
if (
!details::is_digit(current_token().value[2]) ||
!details::is_digit(current_token().value[3])
!details::is_digit(sf_name[2]) ||
!details::is_digit(sf_name[3])
)
{
set_error(
make_error(parser_error::e_token,
current_token(),
"ERR128 - Invalid special function[1]: " + current_token().value,
"ERR129 - Invalid special function[1]: " + sf_name,
exprtk_error_location));
return error_node();
}
const int id = (current_token().value[2] - '0') * 10 +
(current_token().value[3] - '0');
const int id = (sf_name[2] - '0') * 10 +
(sf_name[3] - '0');
if (id >= details::e_sffinal)
{
set_error(
make_error(parser_error::e_token,
current_token(),
"ERR129 - Invalid special function[2]: " + current_token().value,
"ERR130 - Invalid special function[2]: " + sf_name,
exprtk_error_location));
return error_node();
@ -23669,8 +23679,8 @@ namespace exprtk
switch (NumberOfParameters)
{
case 3 : return parse_special_function_impl<T,3>::process((*this),opt_type);
case 4 : return parse_special_function_impl<T,4>::process((*this),opt_type);
case 3 : return parse_special_function_impl<T,3>::process((*this), opt_type, sf_name);
case 4 : return parse_special_function_impl<T,4>::process((*this), opt_type, sf_name);
default : return error_node();
}
}
@ -23689,7 +23699,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR130 - Break call within a break call is not allowed",
"ERR131 - Break call within a break call is not allowed",
exprtk_error_location));
return error_node();
@ -23712,7 +23722,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR131 - Failed to parse return expression for 'break' statement",
"ERR132 - Failed to parse return expression for 'break' statement",
exprtk_error_location));
return error_node();
@ -23722,7 +23732,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR132 - Expected ']' at the completion of break's return expression",
"ERR133 - Expected ']' at the completion of break's return expression",
exprtk_error_location));
free_node(node_allocator_,return_expr);
@ -23740,7 +23750,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR133 - Invalid use of 'break', allowed only in the scope of a loop",
"ERR134 - Invalid use of 'break', allowed only in the scope of a loop",
exprtk_error_location));
}
@ -23763,7 +23773,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR134 - Invalid use of 'continue', allowed only in the scope of a loop",
"ERR135 - Invalid use of 'continue', allowed only in the scope of a loop",
exprtk_error_location));
return error_node();
@ -23780,7 +23790,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR135 - Expected '[' as part of vector size definition",
"ERR136 - Expected '[' as part of vector size definition",
exprtk_error_location));
return error_node();
@ -23790,7 +23800,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR136 - Failed to determine size of vector '" + vec_name + "'",
"ERR137 - Failed to determine size of vector '" + vec_name + "'",
exprtk_error_location));
return error_node();
@ -23802,7 +23812,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR137 - Expected a literal number as size of vector '" + vec_name + "'",
"ERR138 - Expected a literal number as size of vector '" + vec_name + "'",
exprtk_error_location));
return error_node();
@ -23821,7 +23831,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR138 - Invalid vector size. Must be an integer greater than zero, size: " +
"ERR139 - Invalid vector size. Must be an integer greater than zero, size: " +
details::to_str(details::numeric::to_int32(vector_size)),
exprtk_error_location));
@ -23841,7 +23851,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR139 - Expected ']' as part of vector size definition",
"ERR140 - Expected ']' as part of vector size definition",
exprtk_error_location));
return error_node();
@ -23853,7 +23863,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR140 - Expected ':=' as part of vector definition",
"ERR141 - Expected ':=' as part of vector definition",
exprtk_error_location));
return error_node();
@ -23867,7 +23877,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR141 - Failed to parse single vector initialiser",
"ERR142 - Failed to parse single vector initialiser",
exprtk_error_location));
return error_node();
@ -23880,7 +23890,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR142 - Expected ']' to close single value vector initialiser",
"ERR143 - Expected ']' to close single value vector initialiser",
exprtk_error_location));
return error_node();
@ -23927,7 +23937,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR143 - Expected '{' as part of vector initialiser list",
"ERR144 - Expected '{' as part of vector initialiser list",
exprtk_error_location));
return error_node();
@ -23947,7 +23957,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR144 - Expected '{' as part of vector initialiser list",
"ERR145 - Expected '{' as part of vector initialiser list",
exprtk_error_location));
return error_node();
@ -23965,7 +23975,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR145 - Expected ',' between vector initialisers",
"ERR146 - Expected ',' between vector initialisers",
exprtk_error_location));
return error_node();
@ -23987,7 +23997,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR146 - Expected ';' at end of vector definition",
"ERR147 - Expected ';' at end of vector definition",
exprtk_error_location));
return error_node();
@ -23999,7 +24009,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR147 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'",
"ERR148 - Initialiser list larger than the number of elements in the vector: '" + vec_name + "'",
exprtk_error_location));
return error_node();
@ -24019,7 +24029,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR148 - Illegal redefinition of local vector: '" + vec_name + "'",
"ERR149 - Illegal redefinition of local vector: '" + vec_name + "'",
exprtk_error_location));
return error_node();
@ -24053,7 +24063,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR149 - Failed to add new local vector '" + vec_name + "' to SEM",
"ERR150 - Failed to add new local vector '" + vec_name + "' to SEM",
exprtk_error_location));
sem_.free_element(nse);
@ -24108,7 +24118,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR150 - Illegal redefinition of local variable: '" + str_name + "'",
"ERR151 - Illegal redefinition of local variable: '" + str_name + "'",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@ -24140,7 +24150,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR151 - Failed to add new local string variable '" + str_name + "' to SEM",
"ERR152 - Failed to add new local string variable '" + str_name + "' to SEM",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@ -24186,7 +24196,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR152 - Illegal variable definition",
"ERR153 - Illegal variable definition",
exprtk_error_location));
return error_node();
@ -24207,7 +24217,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR153 - Expected a symbol for variable definition",
"ERR154 - Expected a symbol for variable definition",
exprtk_error_location));
return error_node();
@ -24217,7 +24227,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR154 - Illegal redefinition of reserved keyword: '" + var_name + "'",
"ERR155 - Illegal redefinition of reserved keyword: '" + var_name + "'",
exprtk_error_location));
return error_node();
@ -24227,7 +24237,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR155 - Illegal redefinition of variable '" + var_name + "'",
"ERR156 - Illegal redefinition of variable '" + var_name + "'",
exprtk_error_location));
return error_node();
@ -24237,7 +24247,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR156 - Illegal redefinition of local variable: '" + var_name + "'",
"ERR157 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
return error_node();
@ -24257,7 +24267,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR157 - Failed to parse initialisation expression",
"ERR158 - Failed to parse initialisation expression",
exprtk_error_location));
return error_node();
@ -24275,7 +24285,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR158 - Expected ';' after variable definition",
"ERR159 - Expected ';' after variable definition",
exprtk_error_location));
free_node(node_allocator_,initialisation_expression);
@ -24303,7 +24313,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR159 - Illegal redefinition of local variable: '" + var_name + "'",
"ERR160 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
free_node(node_allocator_, initialisation_expression);
@ -24335,7 +24345,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR160 - Failed to add new local variable '" + var_name + "' to SEM",
"ERR161 - Failed to add new local variable '" + var_name + "' to SEM",
exprtk_error_location));
free_node(node_allocator_, initialisation_expression);
@ -24372,7 +24382,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR161 - Expected a '{}' for uninitialised var definition",
"ERR162 - Expected a '{}' for uninitialised var definition",
exprtk_error_location));
return error_node();
@ -24382,7 +24392,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR162 - Expected ';' after uninitialised variable definition",
"ERR163 - Expected ';' after uninitialised variable definition",
exprtk_error_location));
return error_node();
@ -24399,7 +24409,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR163 - Illegal redefinition of local variable: '" + var_name + "'",
"ERR164 - Illegal redefinition of local variable: '" + var_name + "'",
exprtk_error_location));
return error_node();
@ -24429,7 +24439,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR164 - Failed to add new local variable '" + var_name + "' to SEM",
"ERR165 - Failed to add new local variable '" + var_name + "' to SEM",
exprtk_error_location));
sem_.free_element(nse);
@ -24462,7 +24472,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR165 - Expected '(' at start of swap statement",
"ERR166 - Expected '(' at start of swap statement",
exprtk_error_location));
return error_node();
@ -24481,7 +24491,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR166 - Expected a symbol for variable or vector element definition",
"ERR167 - Expected a symbol for variable or vector element definition",
exprtk_error_location));
return error_node();
@ -24493,7 +24503,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR167 - First parameter to swap is an invalid vector element: '" + var0_name + "'",
"ERR168 - First parameter to swap is an invalid vector element: '" + var0_name + "'",
exprtk_error_location));
return error_node();
@ -24526,7 +24536,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR168 - First parameter to swap is an invalid variable: '" + var0_name + "'",
"ERR169 - First parameter to swap is an invalid variable: '" + var0_name + "'",
exprtk_error_location));
return error_node();
@ -24540,7 +24550,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR169 - Expected ',' between parameters to swap",
"ERR170 - Expected ',' between parameters to swap",
exprtk_error_location));
if (variable0_generated)
@ -24558,7 +24568,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR170 - Expected a symbol for variable or vector element definition",
"ERR171 - Expected a symbol for variable or vector element definition",
exprtk_error_location));
if (variable0_generated)
@ -24575,7 +24585,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR171 - Second parameter to swap is an invalid vector element: '" + var1_name + "'",
"ERR172 - Second parameter to swap is an invalid vector element: '" + var1_name + "'",
exprtk_error_location));
if (variable0_generated)
@ -24613,7 +24623,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR172 - Second parameter to swap is an invalid variable: '" + var1_name + "'",
"ERR173 - Second parameter to swap is an invalid variable: '" + var1_name + "'",
exprtk_error_location));
if (variable0_generated)
@ -24632,7 +24642,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR173 - Expected ')' at end of swap statement",
"ERR174 - Expected ')' at end of swap statement",
exprtk_error_location));
if (variable0_generated)
@ -24689,7 +24699,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR174 - Return call within a return call is not allowed",
"ERR175 - Return call within a return call is not allowed",
exprtk_error_location));
return error_node();
@ -24713,7 +24723,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR175 - Expected '[' at start of return statement",
"ERR176 - Expected '[' at start of return statement",
exprtk_error_location));
return error_node();
@ -24736,7 +24746,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR176 - Expected ',' between values during call to return",
"ERR177 - Expected ',' between values during call to return",
exprtk_error_location));
return error_node();
@ -24748,7 +24758,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR177 - Zero parameter return statement not allowed",
"ERR178 - Zero parameter return statement not allowed",
exprtk_error_location));
return error_node();
@ -24763,7 +24773,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
prev_token,
"ERR178 - Invalid ']' found during return call",
"ERR179 - Invalid ']' found during return call",
exprtk_error_location));
return error_node();
@ -24816,7 +24826,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR179 - Invalid sequence of variable '"+ symbol + "' and bracket",
"ERR180 - Invalid sequence of variable '"+ symbol + "' and bracket",
exprtk_error_location));
return false;
@ -24864,7 +24874,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR180 - Invalid sequence of brackets",
"ERR181 - Invalid sequence of brackets",
exprtk_error_location));
return false;
@ -24961,7 +24971,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR181 - Failed to generate node for function: '" + symbol + "'",
"ERR182 - Failed to generate node for function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -24987,7 +24997,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR182 - Failed to generate node for vararg function: '" + symbol + "'",
"ERR183 - Failed to generate node for vararg function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -25013,7 +25023,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR183 - Failed to generate node for generic function: '" + symbol + "'",
"ERR184 - Failed to generate node for generic function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -25040,7 +25050,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR184 - Failed to generate node for string function: '" + symbol + "'",
"ERR185 - Failed to generate node for string function: '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -25066,7 +25076,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR185 - Invalid use of reserved symbol '" + symbol + "'",
"ERR186 - Invalid use of reserved symbol '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -25129,7 +25139,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_symtab,
current_token(),
"ERR186 - Failed to create variable: '" + symbol + "'" +
"ERR187 - Failed to create variable: '" + symbol + "'" +
(error_message.empty() ? "" : " - " + error_message),
exprtk_error_location));
@ -25149,7 +25159,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_symtab,
current_token(),
"ERR187 - Failed to resolve symbol: '" + symbol + "'" +
"ERR188 - Failed to resolve symbol: '" + symbol + "'" +
(error_message.empty() ? "" : " - " + error_message),
exprtk_error_location));
}
@ -25161,7 +25171,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR188 - Undefined symbol: '" + symbol + "'",
"ERR189 - Undefined symbol: '" + symbol + "'",
exprtk_error_location));
return error_node();
@ -25268,7 +25278,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_symtab,
current_token(),
"ERR189 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token().value,
"ERR190 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token().value,
exprtk_error_location));
return error_node();
@ -25292,7 +25302,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_numeric,
current_token(),
"ERR190 - Failed generate node for scalar: '" + current_token().value + "'",
"ERR191 - Failed generate node for scalar: '" + current_token().value + "'",
exprtk_error_location));
return error_node();
@ -25306,7 +25316,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_numeric,
current_token(),
"ERR191 - Failed to convert '" + current_token().value + "' to a number",
"ERR192 - Failed to convert '" + current_token().value + "' to a number",
exprtk_error_location));
return error_node();
@ -25333,7 +25343,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR192 - Expected ')' instead of: '" + current_token().value + "'",
"ERR193 - Expected ')' instead of: '" + current_token().value + "'",
exprtk_error_location));
free_node(node_allocator_,branch);
@ -25358,7 +25368,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR193 - Expected ']' instead of: '" + current_token().value + "'",
"ERR194 - Expected ']' instead of: '" + current_token().value + "'",
exprtk_error_location));
free_node(node_allocator_,branch);
@ -25383,7 +25393,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR194 - Expected '}' instead of: '" + current_token().value + "'",
"ERR195 - Expected '}' instead of: '" + current_token().value + "'",
exprtk_error_location));
free_node(node_allocator_,branch);
@ -25423,7 +25433,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR195 - Premature end of expression[1]",
"ERR196 - Premature end of expression[1]",
exprtk_error_location));
return error_node();
@ -25433,7 +25443,7 @@ namespace exprtk
set_error(
make_error(parser_error::e_syntax,
current_token(),
"ERR196 - Premature end of expression[2]",
"ERR197 - Premature end of expression[2]",
exprtk_error_location));
return error_node();
@ -26126,19 +26136,19 @@ namespace exprtk
return false;
else
return (
(details::e_lt == operation) ||
(details::e_lte == operation) ||
(details::e_gt == operation) ||
(details::e_gte == operation) ||
(details::e_eq == operation) ||
(details::e_ne == operation) ||
(details::e_equal == operation) ||
(details::e_and == operation) ||
(details::e_nand == operation) ||
(details:: e_or == operation) ||
(details:: e_nor == operation) ||
(details:: e_xor == operation) ||
(details::e_xnor == operation)
(details::e_lt == operation) ||
(details::e_lte == operation) ||
(details::e_gt == operation) ||
(details::e_gte == operation) ||
(details::e_eq == operation) ||
(details::e_ne == operation) ||
(details::e_equal == operation) ||
(details::e_and == operation) ||
(details::e_nand == operation) ||
(details:: e_or == operation) ||
(details:: e_nor == operation) ||
(details:: e_xor == operation) ||
(details::e_xnor == operation)
);
}

View File

@ -3710,7 +3710,7 @@ follows:
if (exprtk::collect_variables(expression, variable_list))
{
for (auto var : variable_list)
for (const auto& var : variable_list)
{
...
}
@ -3734,7 +3734,7 @@ follows:
if (exprtk::collect_functions(expression, function_list))
{
for (auto func : function_list)
for (const auto& func : function_list)
{
...
}
@ -3779,7 +3779,7 @@ expression string are passed to the exprtk::collect_functions routine.
if (exprtk::collect_functions(expression, sym_tab, function_list))
{
for (auto func : function_list)
for (const auto& func : function_list)
{
...
}
@ -3910,7 +3910,7 @@ function is as follows:
// Differentiate expression at value of x = 12.3 using a reference
// to the x variable
x = T(12.3);
T derivative1 = exprtk::derivative(expression,x);
T derivative1 = exprtk::derivative(expression, x);
// Differentiate expression where value x = 45.6 using name
// of the x variable
@ -3988,7 +3988,7 @@ is as follows:
// Third derivative of expression where value of x = 12.3 using a
// reference to the x variable
x = T(12.3);
T derivative1 = exprtk::third_derivative(expression,x);
T derivative1 = exprtk::third_derivative(expression, x);
// Third derivative of expression where value of x = 45.6 using
// name of the x variable