summaryrefslogtreecommitdiff
path: root/calc1.pas
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2015-12-08 22:07:24 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2015-12-08 22:07:24 +0200
commitd64e5deb5cd7c853bef96b9d80919a176b703b26 (patch)
tree85e62bb293cefe75eb319bcb0314d30f59bddbe9 /calc1.pas
parent60da249b49e9e53205ede54f1778349407882203 (diff)
downloadlbasi-d64e5deb5cd7c853bef96b9d80919a176b703b26.tar.gz
lbasi-d64e5deb5cd7c853bef96b9d80919a176b703b26.zip
interpret both + and -
Diffstat (limited to 'calc1.pas')
-rw-r--r--calc1.pas11
1 files changed, 9 insertions, 2 deletions
diff --git a/calc1.pas b/calc1.pas
index 2efd2a3..b5d906b 100644
--- a/calc1.pas
+++ b/calc1.pas
@@ -180,12 +180,19 @@ begin
Eat(TT_Integer);
Op := Current;
- Eat(TT_Minus);
+
+ if Op.TokenType = TT_Plus then
+ Eat(TT_Plus)
+ else
+ Eat(TT_Minus);
Right := Current;
Eat(TT_Integer);
- Result := TokenInteger(Left).Val - TokenInteger(Right).Val;
+ if Op.TokenType = TT_Plus then
+ Result := TokenInteger(Left).Val + TokenInteger(Right).Val
+ else
+ Result := TokenInteger(Left).Val - TokenInteger(Right).Val;
end;
var