From: pimjager Date: Mon, 29 Feb 2016 13:34:31 +0000 (+0100) Subject: Errors nog steeds niet goede token :( X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=da0449d1b0998b76941699ace4a806022b52523d;p=cc1516.git Errors nog steeds niet goede token :( --- 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