diff --git a/exprtk.hpp b/exprtk.hpp index 1e33de8..b2542ee 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -2427,11 +2427,25 @@ namespace exprtk { const char* initial_itr = s_itr_; - while ( - (!is_end(s_itr_)) && - (details::is_letter_or_digit(*s_itr_) || ((*s_itr_) == '_')) - ) + while (!is_end(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., abc. + */ + if ( + !is_end(s_itr_ + 1) && + details::is_letter_or_digit(*s_itr_ + 1) && + ('_' != (*s_itr_ + 1)) + ) + break; + } + ++s_itr_; } diff --git a/readme.txt b/readme.txt index 56d1aef..ed39952 100644 --- a/readme.txt +++ b/readme.txt @@ -2769,9 +2769,9 @@ into account when using ExprTk: function names are case-insensitive. (07) Variable, vector, string variable and function names must begin - with a letter (A-Z or a-z), then can be comprised of any - combination of letters, digits and underscores. (eg: x, var1 or - power_func99) + with a letter (A-Z or a-z), then can be comprised of any + combination of letters, digits, underscores and dots. (eg: x, + var1 or power_func99, person.age, item.size.0) (08) Expression lengths and sub-expression lists are limited only by storage capacity.