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

This commit is contained in:
Arash Partow
2014-12-11 02:59:06 +11:00
parent 7b70dad4cc
commit ecb2a4a1ec
3 changed files with 149 additions and 69 deletions

View File

@ -15656,7 +15656,10 @@ namespace exprtk
}
if (break_loop)
{
parse_pending_string_rangesize(expression);
break;
}
else if (current_state.left < precedence)
break;
@ -15701,13 +15704,8 @@ namespace exprtk
{
expression = parse_ternary_conditional_statement(expression);
}
else if (
token_is(token_t::e_lsqrbracket,false) &&
is_generally_string_node(expression)
)
{
expression = parse_string_range_statement(expression);
}
parse_pending_string_rangesize(expression);
}
}
@ -17211,6 +17209,24 @@ namespace exprtk
return result;
}
inline void parse_pending_string_rangesize(expression_node_ptr& expression)
{
const std::size_t max_rangesize_parses = 100;
std::size_t i = 0;
while
(
(0 != expression) &&
(i++ < max_rangesize_parses) &&
error_list_.empty() &&
token_is(token_t::e_lsqrbracket,false) &&
is_generally_string_node(expression)
)
{
expression = parse_string_range_statement(expression);
}
}
template <typename Allocator,
template <typename,typename> class Sequence>
inline expression_node_ptr simplify(Sequence<expression_node_ptr,Allocator>& expression_list)
@ -19316,13 +19332,8 @@ namespace exprtk
{
branch = parse_ternary_conditional_statement(branch);
}
else if (
token_is(token_t::e_lsqrbracket,false) &&
is_generally_string_node(branch)
)
{
branch = parse_string_range_statement(branch);
}
parse_pending_string_rangesize(branch);
return branch;
}