From dfe39f59f9ad203a8231f85efb54a6030305ca56 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 20 Jun 2016 22:07:22 +0200 Subject: Allow whitespace around expression in parser --- parser.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2