C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html
This commit is contained in:
parent
061d61ecc9
commit
d96275b5d0
26
exprtk.hpp
26
exprtk.hpp
|
@ -2436,9 +2436,10 @@ namespace exprtk
|
|||
/*
|
||||
Permit symbols that contain a 'dot'
|
||||
Allowed : abc.xyz, a123.xyz, abc.123, abc_.xyz a123_.xyz abc._123
|
||||
Disallowed: abc.<white-space>, abc.<eof>, abc.<operator +,-,*,/...>
|
||||
Disallowed: .abc, abc.<white-space>, abc.<eof>, abc.<operator +,-,*,/...>
|
||||
*/
|
||||
if (
|
||||
(s_itr_ != initial_itr) &&
|
||||
!is_end(s_itr_ + 1) &&
|
||||
details::is_letter_or_digit(*s_itr_ + 1) &&
|
||||
('_' != (*s_itr_ + 1))
|
||||
|
@ -17071,11 +17072,13 @@ namespace exprtk
|
|||
for (std::size_t i = 1; i < symbol.size(); ++i)
|
||||
{
|
||||
if (
|
||||
(!details::is_letter(symbol[i])) &&
|
||||
(!details:: is_digit(symbol[i])) &&
|
||||
!details::is_letter_or_digit(symbol[i]) &&
|
||||
('_' != symbol[i])
|
||||
)
|
||||
{
|
||||
if (('.' == symbol[i]) && (i < (symbol.size() - 1)))
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -17095,11 +17098,13 @@ namespace exprtk
|
|||
for (std::size_t i = 1; i < symbol.size(); ++i)
|
||||
{
|
||||
if (
|
||||
(!details::is_letter(symbol[i])) &&
|
||||
(!details:: is_digit(symbol[i])) &&
|
||||
!details::is_letter_or_digit(symbol[i]) &&
|
||||
('_' != symbol[i])
|
||||
)
|
||||
{
|
||||
if (('.' == symbol[i]) && (i < (symbol.size() - 1)))
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -17518,8 +17523,19 @@ namespace exprtk
|
|||
{
|
||||
return details::is_function(expr.control_block_->expr);
|
||||
}
|
||||
|
||||
static inline bool is_null(const expression<T>& expr)
|
||||
{
|
||||
return details::is_null_node(expr.control_block_->expr);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline bool is_valid(const expression<T>& expr)
|
||||
{
|
||||
return !expression_helper<T>::is_null(expr);
|
||||
}
|
||||
|
||||
namespace parser_error
|
||||
{
|
||||
enum error_mode
|
||||
|
|
|
@ -65,6 +65,7 @@ void composite()
|
|||
for (std::size_t i = 0; i < parser.error_count(); ++i)
|
||||
{
|
||||
error_t error = parser.get_error(i);
|
||||
|
||||
printf("Error: %02d Position: %02d Type: [%14s] Msg: %s\tExpression: %s\n",
|
||||
static_cast<unsigned int>(i),
|
||||
static_cast<unsigned int>(error.token.position),
|
||||
|
|
|
@ -291,6 +291,8 @@ of C++ compilers:
|
|||
+----------+---------------------------------------------------------+
|
||||
| nequal | Not-equal test between x and y using normalized epsilon |
|
||||
+----------+---------------------------------------------------------+
|
||||
| pow | x to the power of y. (eg: pow(x,y) == x ^ y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| root | Nth-Root of x. where n is a positive integer. |
|
||||
| | (eg: root(x,3) == x^(1/3)) |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
|
Loading…
Reference in New Issue