repositories
/
cc1516.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
40d54a0
)
Errors nog steeds niet goede token :(
author
pimjager
<pim@pimjager.nl>
Mon, 29 Feb 2016 13:34:31 +0000
(14:34 +0100)
committer
pimjager
<pim@pimjager.nl>
Mon, 29 Feb 2016 13:34:31 +0000
(14:34 +0100)
src/parse.icl
patch
|
blob
|
history
src/yard.icl
patch
|
blob
|
history
diff --git
a/src/parse.icl
b/src/parse.icl
index
cfd4fd1
..
edc23ac
100644
(file)
--- a/
src/parse.icl
+++ b/
src/parse.icl
@@
-52,10
+52,11
@@
parseStmt = parseIfStmt <|> parseWhileStmt <|>
parseIfStmt :: Parser Token Stmt
parseIfStmt = liftM3 IfStmt
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 *>
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
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
where
eq (IdentToken _) (_, IdentToken _) = True
eq (NumberToken _) (_, NumberToken _) = True
diff --git
a/src/yard.icl
b/src/yard.icl
index
bded7fb
..
b5e3c61
100644
(file)
--- 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
instance + Error where
(+) ParseError r = r
(+) r ParseError = r
- (+)
_ r
= r
+ (+)
r _
= r
instance Functor (Parser a) where
fmap f m = liftM f m
instance Functor (Parser a) where
fmap f m = liftM f m