From: pimjager Date: Mon, 29 Feb 2016 13:34:38 +0000 (+0100) Subject: Merge branch 'master' of https://github.com/dopefishh/cc1516 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=43d45105726b3ad3e5cc5165f8c9b066ec8d2790;hp=cdb033817c0b30f0ff27b0f4aa67b7cf93c36b4d;p=cc1516.git Merge branch 'master' of https://github.com/dopefishh/cc1516 --- diff --git a/src/parse.icl b/src/parse.icl index fc6e740..d64efcb 100644 --- a/src/parse.icl +++ b/src/parse.icl @@ -53,10 +53,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 *> @@ -176,7 +177,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