diff --git a/expr.c b/expr.c index 15738d6..61622b9 100644 --- a/expr.c +++ b/expr.c @@ -49,7 +49,7 @@ static int parseValue(const char** pp, long* v) val = strtol(p, &e, 0); if (e == p) return 0; /* no number */ - if (isalpha((unsigned char)*p)) + if (isalpha((unsigned char)*e)||*e=='.') { /* followed by rubbish */ return 0; diff --git a/testscript b/testscript index 168ee74..19d2c50 100644 --- a/testscript +++ b/testscript @@ -78,5 +78,12 @@ x=0?; 1?; 2?; -4? x=a030b a(030)b a( 030 )b "a"030"b" a(%x 030)b # $(x) should be: a030b a24b a24b a24b a18b +x=030b (030)b ( 030 )b 030"b" %x 030'b' +# $(x) should be: 030b 24b 24b 24b 18b + +x=-0bla -0.1 +# $(x) should be: -0bla -0.1 + x=-2**2 0-2**2 0+-2**2 0--2**2 # $(x) should be: 4 -4 4 -4 +