From 4b03cb96fd234ca3e85581e218668f68afc16375 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Sun, 10 Mar 2019 17:04:29 +0000 Subject: [PATCH] Handle ending ; --- AST.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AST.hs b/AST.hs index 73523d6..6b9928d 100644 --- a/AST.hs +++ b/AST.hs @@ -8,10 +8,14 @@ newtype Program = Program [AST] deriving Show instance Read Program where - readPrec = fmap Program $ lift $ sepBy1 (readS_to_P reads) $ do + readPrec = fmap Program $ lift $ do + asts <- sepBy1 (readS_to_P reads) $ do skipSpaces char ';' skipSpaces + optional $ char ';' + skipSpaces + return asts data AST = Function String [String] Expr | Eval Expr -- 2.30.2