X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=src%2Fparse.icl;h=56bc554a605794a58c39c5a7b363636dda1d30f8;hb=c126dc3a1f66f959407cf3cf33bcba01142591c6;hp=af50de669050fc4f1a083517d9b85c231216eb8e;hpb=96be5e0151b236a425025cf96e8dade73ee74fcf;p=cc1516.git diff --git a/src/parse.icl b/src/parse.icl index af50de6..56bc554 100644 --- a/src/parse.icl +++ b/src/parse.icl @@ -168,7 +168,7 @@ parseTuple p = satTok BraceOpenToken *> <* satTok BraceCloseToken trans2 :: TokenValue (TokenValue -> a) -> Parser Token a -trans2 t f = liftM (f o snd) $ satTok t +trans2 t f = liftM (f o thd3) $ satTok t trans1 :: TokenValue a -> Parser Token a trans1 t r = trans2 t $ const r @@ -176,14 +176,14 @@ 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) +satTok t = top >>= \tok=:(pos1, pos2, tv) -> if (eq t tok) (return tok) - (fail (printToString tv+++printToString t, pos)) + (fail (printToString tv+++printToString t, pos1)) where - eq (IdentToken _) (_, IdentToken _) = True - eq (NumberToken _) (_, NumberToken _) = True - eq (CharToken _) (_, CharToken _) = True - eq x (_, y) = gEq {|*|} x y + eq (IdentToken _) (_, _, IdentToken _) = True + eq (NumberToken _) (_, _, NumberToken _) = True + eq (CharToken _) (_, _, CharToken _) = True + eq x (_, _, y) = gEq {|*|} x y parseSepList :: TokenValue (Parser Token a) -> Parser Token [a] parseSepList sep p =