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

This commit is contained in:
Arash Partow 2016-10-13 11:22:37 +11:00
parent 5694e5d915
commit 6760336fb1
2 changed files with 21 additions and 7 deletions

View File

@ -2427,11 +2427,25 @@ namespace exprtk
{ {
const char* initial_itr = s_itr_; const char* initial_itr = s_itr_;
while ( while (!is_end(s_itr_))
(!is_end(s_itr_)) &&
(details::is_letter_or_digit(*s_itr_) || ((*s_itr_) == '_'))
)
{ {
if (!details::is_letter_or_digit(*s_itr_) && ('_' != (*s_itr_)))
{
if ('.' != (*s_itr_))
break;
/*
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>
*/
if (
!is_end(s_itr_ + 1) &&
details::is_letter_or_digit(*s_itr_ + 1) &&
('_' != (*s_itr_ + 1))
)
break;
}
++s_itr_; ++s_itr_;
} }

View File

@ -2770,8 +2770,8 @@ into account when using ExprTk:
(07) Variable, vector, string variable and function names must begin (07) Variable, vector, string variable and function names must begin
with a letter (A-Z or a-z), then can be comprised of any with a letter (A-Z or a-z), then can be comprised of any
combination of letters, digits and underscores. (eg: x, var1 or combination of letters, digits, underscores and dots. (eg: x,
power_func99) var1 or power_func99, person.age, item.size.0)
(08) Expression lengths and sub-expression lists are limited only by (08) Expression lengths and sub-expression lists are limited only by
storage capacity. storage capacity.