From da0449d1b0998b76941699ace4a806022b52523d Mon Sep 17 00:00:00 2001 From: pimjager Date: Mon, 29 Feb 2016 14:34:31 +0100 Subject: [PATCH] Errors nog steeds niet goede token :( --- src/parse.icl | 13 ++++++++----- src/yard.icl | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/parse.icl b/src/parse.icl index cfd4fd1..edc23ac 100644 --- a/src/parse.icl +++ b/src/parse.icl @@ -52,10 +52,11 @@ parseStmt = parseIfStmt <|> parseWhileStmt <|> parseIfStmt :: Parser Token Stmt parseIfStmt = liftM3 IfStmt - (satTok IfToken *> parseBBraces parseExpr) - (parseBlock <|> parseOneLine) - (liftM (fromMaybe []) - (optional (satTok ElseToken *> (parseBlock<|> parseOneLine)))) + (satTok IfToken *> parseBBraces parseExpr) + (parseBlock <|> parseOneLine) + (liftM (fromMaybe []) + (optional (satTok ElseToken *> (parseBlock<|> parseOneLine)))) + parseWhileStmt :: Parser Token Stmt parseWhileStmt = satTok WhileToken *> @@ -175,7 +176,9 @@ trans1 t r = trans2 t $ const r derive gPrint TokenValue derive gEq TokenValue satTok :: TokenValue -> Parser Token Token -satTok t = top >>= \tok=:(pos, tv) -> if (eq t tok) (return tok) (fail (printToString tv, pos)) +satTok t = top >>= \tok=:(pos, tv) -> if (eq t tok) + (return tok) + (fail (printToString tv+++printToString t, pos)) where eq (IdentToken _) (_, IdentToken _) = True eq (NumberToken _) (_, NumberToken _) = True diff --git a/src/yard.icl b/src/yard.icl index bded7fb..b5e3c61 100644 --- a/src/yard.icl +++ b/src/yard.icl @@ -24,7 +24,7 @@ runParser (Parser f) i = f i instance + Error where (+) ParseError r = r (+) r ParseError = r - (+) _ r = r + (+) r _ = r instance Functor (Parser a) where fmap f m = liftM f m -- 2.20.1