C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html
diff --git a/exprtk.hpp b/exprtk.hpp
index 1fbe8d9..54a660d 100644
--- a/exprtk.hpp
+++ b/exprtk.hpp
@@ -2439,9 +2439,9 @@
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_ != initial_itr) &&
+ !is_end(s_itr_ + 1) &&
+ !details::is_letter_or_digit(*(s_itr_ + 1)) &&
('_' != (*(s_itr_ + 1)))
)
break;
@@ -2459,21 +2459,23 @@
{
/*
Attempt to match a valid numeric value in one of the following formats:
- 01. 123456
- 02. 123.456
- 03. 123.456e3
- 04. 123.456E3
- 05. 123.456e+3
- 06. 123.456E+3
- 07. 123.456e-3
- 08. 123.456E-3
- 09. .1234
- 10. .1234e3
- 11. .1234E+3
- 12. .1234e+3
- 13. .1234E-3
- 14. .1234e-3
+ (01) 123456
+ (02) 123456.
+ (03) 123.456
+ (04) 123.456e3
+ (05) 123.456E3
+ (06) 123.456e+3
+ (07) 123.456E+3
+ (08) 123.456e-3
+ (09) 123.456E-3
+ (00) .1234
+ (11) .1234e3
+ (12) .1234E+3
+ (13) .1234e+3
+ (14) .1234E-3
+ (15) .1234e-3
*/
+
const char* initial_itr = s_itr_;
bool dot_found = false;
bool e_found = false;
diff --git a/exprtk_test.cpp b/exprtk_test.cpp
index d0f6ccd..5319a74 100644
--- a/exprtk_test.cpp
+++ b/exprtk_test.cpp
@@ -332,6 +332,11 @@
test_t("7-2",+5.0),
test_t("8-1",+7.0),
test_t("9-0",+9.0),
+ test_t("2.*3",+6.0),
+ test_t("2.*3.",+6.0),
+ test_t("2.+3",+5.0),
+ test_t("2.+3.",+5.0),
+ test_t("123.*456.",+56088.0),
test_t(" 0 - 9 ",-9.0),
test_t(" 1 - 8 ",-7.0),
test_t(" 2 - 7 ",-5.0),
@@ -1596,7 +1601,11 @@
test_xy<T>("var a := 2; (a / 1) == a",T(0),T(0),T(1)),
test_xy<T>("var a := 2; (0 + a) == a",T(0),T(0),T(1)),
test_xy<T>("var a := 2; (a + 0) == a",T(0),T(0),T(1)),
- test_xy<T>("var a := 2; (1 * a) == a",T(0),T(0),T(1))
+ test_xy<T>("var a := 2; (1 * a) == a",T(0),T(0),T(1)),
+ test_xy<T>("var a.b := 3; (2 * a.b ) == 6",T(0),T(0),T(1)),
+ test_xy<T>("var aa.bb := 3; (2 * aa.bb ) == 6",T(0),T(0),T(1)),
+ test_xy<T>("var aaa.bbb := 3; (2 * aaa.bbb) == 6",T(0),T(0),T(1)),
+ test_xy<T>("var a1.b2 := 3; (2 * a1.b2 ) == 6",T(0),T(0),T(1))
};
static const std::size_t test_list_size = sizeof(test_list) / sizeof(test_xy<T>);
diff --git a/readme.txt b/readme.txt
index ee212de..0550b70 100644
--- a/readme.txt
+++ b/readme.txt
@@ -853,7 +853,7 @@
similar to those found in imperative languages. This form of pseudo
function will have a name, it may have a set of one or more inputs and
will return at least one value as its result. Futhermore the function
-when invoked, may cause a side-effect that changes the state the of
+when invoked, may cause a side-effect that changes the state of the
host program.
As an example the following is a pseudo-code definition of a free
@@ -1318,8 +1318,8 @@
During compilation when the DCE optimisation is applied to the above
expression, statement 2 will be removed from the expression, as it has
no bearing on the final result of expression, the rest of the
-statements will all remain. Hence optimised version of the expression
-is as follows:
+statements will all remain. The optimised form of the expression is as
+follows:
var x := 2; // Statement 1
var y := x + 2; // Statement 2
@@ -1341,7 +1341,7 @@
consequent 'y + 1' will be evaluated, its value will be returned and
subsequently assigned to the variable 'x'. Otherwise the alternative
'2 * z' will be evaluated and its value will be returned. This is
-essentially the simplest form of an if-then-else statement, As simple
+essentially the simplest form of an if-then-else statement. A simple
variation of the expression where the value of the if-statement is
used within another statement is as follows: