From 476970172777cdd921793db3050cd46f9070b223 Mon Sep 17 00:00:00 2001 From: Sam Fredrickson Date: Mon, 6 Oct 2008 16:31:10 -0700 Subject: [PATCH] Fixed bug that prevented the subtraction operator. In a previous bugfix, I let the dash ("-") in numbers, but that ate up lone dashes as numbers. This patch prevents that by ensuring that a number with a dash at the start has digits. --- src/parser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index 70c6cfa..7987bdf 100644 --- a/src/parser.c +++ b/src/parser.c @@ -44,7 +44,13 @@ static bool isNumber(char *s) bool isnum = true; if(len && s[0] == '-') - i = 1; + { + // if it's just a dash, it's not a number. + if(len == 1) + isnum = false; + else + i = 1; + } for(; isnum && i < len; ++i) if(!isdigit(s[i]) && s[i] != '.') isnum = false; -- 2.11.4.GIT