@ -4483,14 +4483,14 @@ namespace exprtk
}
}
static inline control_block * create ( const std : : size_t & size , data_t data_ptr = data_t ( 0 ) , bool dstrct = false )
static inline control_block * create ( const std : : size_t & d size, data_t data_ptr = data_t ( 0 ) , bool dstrct = false )
{
if ( size )
if ( d size)
{
if ( 0 = = data_ptr )
return new control_block ( size ) ;
return new control_block ( d size) ;
else
return new control_block ( size , data_ptr , dstrct ) ;
return new control_block ( d size, data_ptr , dstrct ) ;
}
else
return new control_block ;
@ -18811,6 +18811,18 @@ namespace exprtk
e_usr_constant_type = 1
} ;
enum usr_mode
{
e_usrmode_default = 0 ,
e_usrmode_extended = 1
} ;
usr_mode mode ;
unknown_symbol_resolver ( const usr_mode m = e_usrmode_default )
: mode ( m )
{ }
virtual ~ unknown_symbol_resolver ( )
{ }
@ -18819,12 +18831,22 @@ namespace exprtk
T & default_value ,
std : : string & error_message )
{
if ( e_usrmode_default ! = mode )
return false ;
st = e_usr_variable_type ;
default_value = T ( 0 ) ;
error_message . clear ( ) ;
return true ;
}
virtual bool process ( const std : : string & /* unknown_symbol */ ,
symbol_table_t & /* symbol_table */ ,
std : : string & /* error_message */ )
{
return false ;
}
} ;
enum collect_type
@ -19971,6 +19993,11 @@ namespace exprtk
unknown_symbol_resolver_ = & default_usr_ ;
}
inline void enable_unknown_symbol_resolver ( unknown_symbol_resolver & usr )
{
enable_unknown_symbol_resolver ( & usr ) ;
}
inline void disable_unknown_symbol_resolver ( )
{
resolve_unknown_symbol_ = false ;
@ -22628,6 +22655,26 @@ namespace exprtk
return error_node ( ) ;
}
// Perform compile-time range check
if ( details : : is_constant_node ( index_expr ) )
{
const std : : size_t index = std : : size_t ( index_expr - > value ( ) ) ;
const std : : size_t vec_size = vec - > size ( ) ;
if ( index > = vec_size )
{
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR106 - Index of " + details : : to_str ( index ) + " out of range for "
" vector ' " + symbol + " ' of size " + details : : to_str ( vec_size ) ) ) ;
free_node ( node_allocator_ , index_expr ) ;
return error_node ( ) ;
}
}
return expression_generator_ . vector_element ( symbol , vec , index_expr ) ;
}
@ -22649,7 +22696,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR106 - Zero parameter call to vararg function: "
" ERR107 - Zero parameter call to vararg function: "
+ vararg_function_name + " not allowed " ) ) ;
return error_node ( ) ;
@ -22673,7 +22720,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR107 - Expected ',' for call to vararg function: "
" ERR108 - Expected ',' for call to vararg function: "
+ vararg_function_name ) ) ;
return error_node ( ) ;
@ -22686,7 +22733,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR108 - Zero parameter call to vararg function: "
" ERR109 - Zero parameter call to vararg function: "
+ vararg_function_name + " not allowed " ) ) ;
return error_node ( ) ;
@ -22697,7 +22744,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR109 - Invalid number of parameters to call to vararg function: "
" ERR11 0 - Invalid number of parameters to call to vararg function: "
+ vararg_function_name + " , require at least "
+ details : : to_str ( static_cast < int > ( vararg_function - > min_num_args ( ) ) ) + " parameters " ) ) ;
@ -22708,7 +22755,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR110 - Invalid number of parameters to call to vararg function: "
" ERR111 - Invalid number of parameters to call to vararg function: "
+ vararg_function_name + " , require no more than "
+ details : : to_str ( static_cast < int > ( vararg_function - > max_num_args ( ) ) ) + " parameters " ) ) ;
@ -22770,7 +22817,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
parser_ . current_token ( ) ,
" ERR111 - Failed parameter type check for function ' " + function_name_ + " ', "
" ERR112 - Failed parameter type check for function ' " + function_name_ + " ', "
" Expected ' " + param_seq_list_ [ 0 ] + " ' call set: ' " + param_seq + " ' " ) ) ;
}
else
@ -22790,7 +22837,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
parser_ . current_token ( ) ,
" ERR112 - Failed parameter type check for function ' " + function_name_ + " ', "
" ERR113 - Failed parameter type check for function ' " + function_name_ + " ', "
" Best match: ' " + param_seq_list_ [ max_diff_index ] + " ' call set: ' " + param_seq + " ' " ) ) ;
}
@ -22874,7 +22921,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
parser_ . current_token ( ) ,
" ERR113 - Invalid parameter sequence of ' " + err_param_seq +
" ERR114 - Invalid parameter sequence of ' " + err_param_seq +
" ' for function: " + function_name_ ) ) ;
return ;
@ -22895,7 +22942,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
parser_ . current_token ( ) ,
" ERR114 - Invalid parameter sequence of ' " + err_param_seq +
" ERR115 - Invalid parameter sequence of ' " + err_param_seq +
" ' for function: " + function_name_ ) ) ;
return ;
}
@ -22928,7 +22975,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR115 - Type checker instantiation failure for generic function: " + function_name ) ) ;
" ERR116 - Type checker instantiation failure for generic function: " + function_name ) ) ;
return error_node ( ) ;
}
@ -22942,7 +22989,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR116 - Mismatch in zero parameter condition for generic function: "
" ERR117 - Mismatch in zero parameter condition for generic function: "
+ function_name ) ) ;
return error_node ( ) ;
@ -22960,7 +23007,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR117 - Zero parameter call to generic function: "
" ERR118 - Zero parameter call to generic function: "
+ function_name + " not allowed " ) ) ;
return error_node ( ) ;
@ -22991,7 +23038,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR118 - Expected ',' for call to generic function: " + function_name ) ) ;
" ERR119 - Expected ',' for call to generic function: " + function_name ) ) ;
return error_node ( ) ;
}
@ -23007,7 +23054,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR119 - Zero parameter call to generic function: "
" ERR120 - Zero parameter call to generic function: "
+ function_name + " not allowed " ) ) ;
return error_node ( ) ;
@ -23023,7 +23070,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR120 - Expected ',' for call to generic function: " + function_name ) ) ;
" ERR121 - Expected ',' for call to generic function: " + function_name ) ) ;
return error_node ( ) ;
}
@ -23090,7 +23137,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR121 - Expected ',' for call to string function: " + function_name ) ) ;
" ERR122 - Expected ',' for call to string function: " + function_name ) ) ;
return error_node ( ) ;
}
@ -23105,7 +23152,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR122 - Expected ',' for call to string function: " + function_name ) ) ;
" ERR123 - Expected ',' for call to string function: " + function_name ) ) ;
return error_node ( ) ;
}
@ -23142,7 +23189,7 @@ namespace exprtk
p . set_error (
make_error ( parser_error : : e_syntax ,
p . current_token ( ) ,
" ERR123 - Expected '(' for special function " ) ) ;
" ERR124 - Expected '(' for special function " ) ) ;
return error_node ( ) ;
}
@ -23162,7 +23209,7 @@ namespace exprtk
p . set_error (
make_error ( parser_error : : e_syntax ,
p . current_token ( ) ,
" ERR124 - Expected ',' before next parameter of special function " ) ) ;
" ERR125 - Expected ',' before next parameter of special function " ) ) ;
return p . error_node ( ) ;
}
@ -23191,7 +23238,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_token ,
current_token ( ) ,
" ERR125 - Invalid special function[1]: " + current_token ( ) . value ) ) ;
" ERR126 - Invalid special function[1]: " + current_token ( ) . value ) ) ;
return error_node ( ) ;
}
@ -23203,7 +23250,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_token ,
current_token ( ) ,
" ERR126 - Invalid special function[2]: " + current_token ( ) . value ) ) ;
" ERR127 - Invalid special function[2]: " + current_token ( ) . value ) ) ;
return error_node ( ) ;
}
@ -23234,7 +23281,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR127 - Break call within a break call is not allowed " ) ) ;
" ERR128 - Break call within a break call is not allowed " ) ) ;
return error_node ( ) ;
}
@ -23256,7 +23303,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR128 - Failed to parse return expression for 'break' statement " ) ) ;
" ERR129 - Failed to parse return expression for 'break' statement " ) ) ;
return error_node ( ) ;
}
@ -23265,7 +23312,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR129 - Expected ']' at the completion of break's return expression " ) ) ;
" ERR130 - Expected ']' at the completion of break's return expression " ) ) ;
free_node ( node_allocator_ , return_expr ) ;
@ -23282,7 +23329,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR130 - Invalid use of 'break', allowed only in the scope of a loop " ) ) ;
" ERR131 - Invalid use of 'break', allowed only in the scope of a loop " ) ) ;
}
return error_node ( ) ;
@ -23304,7 +23351,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR131 - Invalid use of 'continue', allowed only in the scope of a loop " ) ) ;
" ERR132 - Invalid use of 'continue', allowed only in the scope of a loop " ) ) ;
return error_node ( ) ;
}
@ -23320,7 +23367,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR132 - Expected '[' as part of vector size definition " ) ) ;
" ERR133 - Expected '[' as part of vector size definition " ) ) ;
return error_node ( ) ;
}
@ -23329,7 +23376,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR133 - Failed to determine size of vector ' " + vec_name + " ' " ) ) ;
" ERR134 - Failed to determine size of vector ' " + vec_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23340,7 +23387,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR134 - Expected a literal number as size of vector ' " + vec_name + " ' " ) ) ;
" ERR135 - Expected a literal number as size of vector ' " + vec_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23358,7 +23405,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR135 - Invalid vector size. Must be an integer greater than zero, size: " +
" ERR136 - Invalid vector size. Must be an integer greater than zero, size: " +
details : : to_str ( details : : numeric : : to_int32 ( vector_size ) ) ) ) ;
return error_node ( ) ;
@ -23377,7 +23424,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR136 - Expected ']' as part of vector size definition " ) ) ;
" ERR137 - Expected ']' as part of vector size definition " ) ) ;
return error_node ( ) ;
}
@ -23388,7 +23435,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR137 - Expected ':=' as part of vector definition " ) ) ;
" ERR138 - Expected ':=' as part of vector definition " ) ) ;
return error_node ( ) ;
}
@ -23401,7 +23448,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR138 - Failed to parse single vector initialiser " ) ) ;
" ERR139 - Failed to parse single vector initialiser " ) ) ;
return error_node ( ) ;
}
@ -23413,7 +23460,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR139 - Expected ']' to close single value vector initialiser " ) ) ;
" ERR140 - Expected ']' to close single value vector initialiser " ) ) ;
return error_node ( ) ;
}
@ -23459,7 +23506,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR140 - Expected '{' as part of vector initialiser list " ) ) ;
" ERR141 - Expected '{' as part of vector initialiser list " ) ) ;
return error_node ( ) ;
}
@ -23478,7 +23525,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR141 - Expected '{' as part of vector initialiser list " ) ) ;
" ERR142 - Expected '{' as part of vector initialiser list " ) ) ;
return error_node ( ) ;
}
@ -23495,7 +23542,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR142 - Expected ',' between vector initialisers " ) ) ;
" ERR143 - Expected ',' between vector initialisers " ) ) ;
return error_node ( ) ;
}
@ -23516,7 +23563,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR143 - Expected ';' at end of vector definition " ) ) ;
" ERR144 - Expected ';' at end of vector definition " ) ) ;
return error_node ( ) ;
}
@ -23527,7 +23574,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR144 - Initialiser list larger than the number of elements in the vector: ' " + vec_name + " ' " ) ) ;
" ERR145 - Initialiser list larger than the number of elements in the vector: ' " + vec_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23546,7 +23593,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR145 - Illegal redefinition of local vector: ' " + vec_name + " ' " ) ) ;
" ERR146 - Illegal redefinition of local vector: ' " + vec_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23579,7 +23626,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR146 - Failed to add new local vector ' " + vec_name + " ' to SEM " ) ) ;
" ERR147 - Failed to add new local vector ' " + vec_name + " ' to SEM " ) ) ;
sem_ . free_element ( nse ) ;
@ -23633,7 +23680,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR147 - Illegal redefinition of local variable: ' " + str_name + " ' " ) ) ;
" ERR148 - Illegal redefinition of local variable: ' " + str_name + " ' " ) ) ;
free_node ( node_allocator_ , initialisation_expression ) ;
@ -23664,7 +23711,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR148 - Failed to add new local string variable ' " + str_name + " ' to SEM " ) ) ;
" ERR149 - Failed to add new local string variable ' " + str_name + " ' to SEM " ) ) ;
free_node ( node_allocator_ , initialisation_expression ) ;
@ -23709,7 +23756,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR149 - Illegal variable definition " ) ) ;
" ERR150 - Illegal variable definition " ) ) ;
return error_node ( ) ;
}
@ -23729,7 +23776,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR150 - Expected a symbol for variable definition " ) ) ;
" ERR151 - Expected a symbol for variable definition " ) ) ;
return error_node ( ) ;
}
@ -23738,7 +23785,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR151 - Illegal redefinition of reserved keyword: ' " + var_name + " ' " ) ) ;
" ERR152 - Illegal redefinition of reserved keyword: ' " + var_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23747,7 +23794,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR152 - Illegal redefinition of variable ' " + var_name + " ' " ) ) ;
" ERR153 - Illegal redefinition of variable ' " + var_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23756,7 +23803,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR153 - Illegal redefinition of local variable: ' " + var_name + " ' " ) ) ;
" ERR154 - Illegal redefinition of local variable: ' " + var_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23775,7 +23822,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR154 - Failed to parse initialisation expression " ) ) ;
" ERR155 - Failed to parse initialisation expression " ) ) ;
return error_node ( ) ;
}
@ -23792,7 +23839,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR155 - Expected ';' after variable definition " ) ) ;
" ERR156 - Expected ';' after variable definition " ) ) ;
free_node ( node_allocator_ , initialisation_expression ) ;
@ -23819,7 +23866,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 + " ' " ) ) ;
free_node ( node_allocator_ , initialisation_expression ) ;
@ -23850,7 +23897,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR157 - Failed to add new local variable ' " + var_name + " ' to SEM " ) ) ;
" ERR158 - Failed to add new local variable ' " + var_name + " ' to SEM " ) ) ;
free_node ( node_allocator_ , initialisation_expression ) ;
@ -23886,7 +23933,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR158 - Expected a '{}' for uninitialised var definition " ) ) ;
" ERR159 - Expected a '{}' for uninitialised var definition " ) ) ;
return error_node ( ) ;
}
@ -23895,7 +23942,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR159 - Expected ';' after uninitialised variable definition " ) ) ;
" ERR160 - Expected ';' after uninitialised variable definition " ) ) ;
return error_node ( ) ;
}
@ -23911,7 +23958,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR160 - Illegal redefinition of local variable: ' " + var_name + " ' " ) ) ;
" ERR161 - Illegal redefinition of local variable: ' " + var_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -23940,7 +23987,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR161 - Failed to add new local variable ' " + var_name + " ' to SEM " ) ) ;
" ERR162 - Failed to add new local variable ' " + var_name + " ' to SEM " ) ) ;
sem_ . free_element ( nse ) ;
@ -23972,7 +24019,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR162 - Expected '(' at start of swap statement " ) ) ;
" ERR163 - Expected '(' at start of swap statement " ) ) ;
return error_node ( ) ;
}
@ -23990,7 +24037,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR163 - Expected a symbol for variable or vector element definition " ) ) ;
" ERR164 - Expected a symbol for variable or vector element definition " ) ) ;
return error_node ( ) ;
}
@ -24001,7 +24048,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR164 - First parameter to swap is an invalid vector element: ' " + var0_name + " ' " ) ) ;
" ERR165 - First parameter to swap is an invalid vector element: ' " + var0_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -24033,7 +24080,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR165 - First parameter to swap is an invalid variable: ' " + var0_name + " ' " ) ) ;
" ERR166 - First parameter to swap is an invalid variable: ' " + var0_name + " ' " ) ) ;
return error_node ( ) ;
}
@ -24046,7 +24093,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR166 - Expected ',' between parameters to swap " ) ) ;
" ERR167 - Expected ',' between parameters to swap " ) ) ;
if ( variable0_generated )
{
@ -24063,7 +24110,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR167 - Expected a symbol for variable or vector element definition " ) ) ;
" ERR168 - Expected a symbol for variable or vector element definition " ) ) ;
if ( variable0_generated )
{
@ -24079,7 +24126,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR168 - Second parameter to swap is an invalid vector element: ' " + var1_name + " ' " ) ) ;
" ERR169 - Second parameter to swap is an invalid vector element: ' " + var1_name + " ' " ) ) ;
if ( variable0_generated )
{
@ -24116,7 +24163,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR169 - Second parameter to swap is an invalid variable: ' " + var1_name + " ' " ) ) ;
" ERR170 - Second parameter to swap is an invalid variable: ' " + var1_name + " ' " ) ) ;
if ( variable0_generated )
{
@ -24134,7 +24181,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR170 - Expected ')' at end of swap statement " ) ) ;
" ERR171 - Expected ')' at end of swap statement " ) ) ;
if ( variable0_generated )
{
@ -24188,7 +24235,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR171 - Return call within a return call is not allowed " ) ) ;
" ERR172 - Return call within a return call is not allowed " ) ) ;
return error_node ( ) ;
}
@ -24211,7 +24258,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR172 - Expected '[' at start of return statement " ) ) ;
" ERR173 - Expected '[' at start of return statement " ) ) ;
return error_node ( ) ;
}
@ -24233,7 +24280,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR173 - Expected ',' between values during call to return " ) ) ;
" ERR174 - Expected ',' between values during call to return " ) ) ;
return error_node ( ) ;
}
@ -24244,7 +24291,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR174 - Zero parameter return statement not allowed " ) ) ;
" ERR175 - Zero parameter return statement not allowed " ) ) ;
return error_node ( ) ;
}
@ -24258,7 +24305,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
prev_token ,
" ERR175 - Invalid ']' found during return call " ) ) ;
" ERR176 - Invalid ']' found during return call " ) ) ;
return error_node ( ) ;
}
@ -24310,7 +24357,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR176 - Invalid sequence of variable ' " + symbol + " ' and bracket " ) ) ;
" ERR177 - Invalid sequence of variable ' " + symbol + " ' and bracket " ) ) ;
return false ;
}
@ -24357,7 +24404,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR177 - Invalid sequence of brackets " ) ) ;
" ERR178 - Invalid sequence of brackets " ) ) ;
return false ;
}
@ -24453,7 +24500,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR178 - Failed to generate node for function: ' " + symbol + " ' " ) ) ;
" ERR179 - Failed to generate node for function: ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24478,7 +24525,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR179 - Failed to generate node for vararg function: ' " + symbol + " ' " ) ) ;
" ERR180 - Failed to generate node for vararg function: ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24503,7 +24550,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR180 - Failed to generate node for generic function: ' " + symbol + " ' " ) ) ;
" ERR181 - Failed to generate node for generic function: ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24529,7 +24576,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR181 - Failed to generate node for string function: ' " + symbol + " ' " ) ) ;
" ERR182 - Failed to generate node for string function: ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24551,7 +24598,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR182 - Invalid use of reserved symbol ' " + symbol + " ' " ) ) ;
" ERR183 - Invalid use of reserved symbol ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24562,22 +24609,24 @@ namespace exprtk
{
if ( ! ( settings_ . rsrvd_sym_usr_disabled ( ) & & details : : is_reserved_symbol ( symbol ) ) )
{
T default_value = T ( 0 ) ;
symbol_table_t & symtab = symtab_store_ . get_symbol_table ( ) ;
std : : string error_message ;
if ( unknown_symbol_resolver : : e_usrmode_default = = unknown_symbol_resolver_ - > mode )
{
T default_value = T ( 0 ) ;
typename unknown_symbol_resolver : : usr_symbol_type usr_symbol_type ;
if ( unknown_symbol_resolver_ - > process ( symbol , usr_symbol_type , default_value , error_message ) )
if ( unknown_symbol_resolver_ - > process ( symbol , usr_symbol_type , default_value , error_message ) )
{
bool create_result = false ;
symbol_table_t & symtab = symtab_store_ . get_symbol_table ( ) ;
switch ( usr_symbol_type )
{
case unknown_symbol_resolver : : e_usr_variable_type : create_result = symtab . create_variable ( symbol , default_value ) ;
case unknown_symbol_resolver : : e_usr_variable_type : create_result = symtab . create_variable ( symbol , default_value ) ;
break ;
case unknown_symbol_resolver : : e_usr_constant_type : create_result = symtab . add_constant ( symbol , default_value ) ;
case unknown_symbol_resolver : : e_usr_constant_type : create_result = symtab . add_constant ( symbol , default_value ) ;
break ;
default : create_result = false ;
@ -24604,21 +24653,49 @@ namespace exprtk
return var ;
}
}
}
set_error (
make_error ( parser_error : : e_symtab ,
current_token ( ) ,
" ERR183 - Failed to create variable: ' " + symbol + " ' " ) ) ;
" ERR184 - Failed to create variable: ' " + symbol + " ' " +
( error_message . empty ( ) ? " " : " - " + error_message ) ) ) ;
return error_node ( ) ;
}
else if ( unknown_symbol_resolver : : e_usrmode_extended = = unknown_symbol_resolver_ - > mode )
{
if ( unknown_symbol_resolver_ - > process ( symbol , symtab , error_message ) )
{
static bool usr_extmode_active = false ;
if ( ! usr_extmode_active )
{
usr_extmode_active = true ;
expression_node_ptr result = parse_symtab_symbol ( ) ;
usr_extmode_active = false ;
if ( result )
{
return result ;
}
}
}
set_error (
make_error ( parser_error : : e_symtab ,
current_token ( ) ,
" ERR185 - Failed to resolve symbol: ' " + symbol + " ' " +
( error_message . empty ( ) ? " " : " - " + error_message ) ) ) ;
}
return error_node ( ) ;
}
}
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR184 - Undefined symbol: ' " + symbol + " ' " ) ) ;
" ERR186 - Undefined symbol: ' " + symbol + " ' " ) ) ;
return error_node ( ) ;
}
@ -24724,7 +24801,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_symtab ,
current_token ( ) ,
" ERR185 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token ( ) . value ) ) ;
" ERR187 - Variable or function detected, yet symbol-table is invalid, Symbol: " + current_token ( ) . value ) ) ;
return error_node ( ) ;
}
@ -24749,7 +24826,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_numeric ,
current_token ( ) ,
" ERR186 - Failed to convert ' " + current_token ( ) . value + " ' to a number " ) ) ;
" ERR188 - Failed to convert ' " + current_token ( ) . value + " ' to a number " ) ) ;
return error_node ( ) ;
}
@ -24775,7 +24852,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR187 - Expected ')' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
" ERR189 - Expected ')' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
free_node ( node_allocator_ , branch ) ;
@ -24799,7 +24876,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR188 - Expected ']' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
" ERR190 - Expected ']' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
free_node ( node_allocator_ , branch ) ;
@ -24823,7 +24900,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR18 9 - Expected '}' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
" ERR191 - Expected '}' instead of: ' " + current_token ( ) . value + " ' " ) ) ;
free_node ( node_allocator_ , branch ) ;
@ -24862,7 +24939,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR190 - Premature end of expression[1] " ) ) ;
" ERR192 - Premature end of expression[1] " ) ) ;
return error_node ( ) ;
}
@ -24871,7 +24948,7 @@ namespace exprtk
set_error (
make_error ( parser_error : : e_syntax ,
current_token ( ) ,
" ERR191 - Premature end of expression[2] " ) ) ;
" ERR193 - Premature end of expression[2] " ) ) ;
return error_node ( ) ;
}
@ -26517,12 +26594,14 @@ namespace exprtk
else if ( all_nodes_variables ( arg_list ) )
return varnode_optimise_varargfunc ( operation , arg_list ) ;
# ifndef exprtk_disable_string_capabilities
if ( details : : e_smulti = = operation )
{
return node_allocator_ - >
allocate < details : : str_vararg_node < Type , details : : vararg_multi_op < Type > > > ( arg_list ) ;
}
else
# endif
{
switch ( operation )
{