summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-06-20 22:07:22 +0200
committertomsmeding <tom.smeding@gmail.com>2016-06-20 22:07:22 +0200
commitdfe39f59f9ad203a8231f85efb54a6030305ca56 (patch)
tree96558b640bc329e720f2b0b9b67f49729d4975e7
parent7957dc36354a803ba96231c5bf8397a154f0ca59 (diff)
Allow whitespace around expression in parser
-rw-r--r--parser.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/parser.hs b/parser.hs
index 6d8ed6d..636c04f 100644
--- a/parser.hs
+++ b/parser.hs
@@ -157,7 +157,11 @@ pinfixoperator (plus,minus) pterm sumconstr negconstr plusopt noneg = do
pmoreterms thissum +++ return thissum
psum :: Parser AST
-psum = pinfixoperator ('+','-') pproduct Sum Negative False False
+psum = do
+ poptws
+ res <- pinfixoperator ('+','-') pproduct Sum Negative False False
+ poptws
+ return res
pproduct :: Parser AST
pproduct = pinfixoperator ('*','/') pfactor Product Reciprocal True True