From 44cee79bb701bd71deb40d39774c117c025e8829 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez <vincent@snarc.org> Date: Sat, 21 May 2016 08:15:34 +0100 Subject: [PATCH] updates --- Data/Git/Parser.hs | 4 ++-- Data/Git/Storage/Object.hs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Data/Git/Parser.hs b/Data/Git/Parser.hs index c1a8b08..c3b9ac2 100644 --- a/Data/Git/Parser.hs +++ b/Data/Git/Parser.hs @@ -15,7 +15,7 @@ module Data.Git.Parser , tillEOL , skipEOL , skipASCII - , takeWhileASCII + , takeUntilASCII -- * Simple re-export , A.anyWord8 , takeBytes @@ -59,7 +59,7 @@ eitherParseChunks f = AL.eitherResult . AL.parse f takeBytes = A.take -takeWhileASCII pred = undefined +takeUntilASCII char = AL.takeWhile (\c -> if fromEnum c < 0x80 then fromEnum c == fromEnum char else True) tillEOL = A.takeWhile (/= asciiEOL) skipEOL = A.word8 asciiEOL >> return () diff --git a/Data/Git/Storage/Object.hs b/Data/Git/Storage/Object.hs index 796e44f..37a6922 100644 --- a/Data/Git/Storage/Object.hs +++ b/Data/Git/Storage/Object.hs @@ -207,7 +207,7 @@ tagParse = do P.skipEOL type_ <- objectTypeUnmarshall <$> (P.string "type " >> takeTill ((==) 0x0a)) P.skipEOL - tag <- P.string "tag " >> P.takeTill ((==) 0x0a) + tag <- P.string "tag " >> P.tillEOL -- PC.takeTill ((==) 0x0a) P.skipEOL tagger <- P.string "tagger " >> parsePerson P.skipEOL @@ -215,9 +215,9 @@ tagParse = do return $ Tag object type_ tag tagger signature parsePerson = do - name <- B.init <$> P.takeWhileASCII ((/=) '<') + name <- B.init <$> P.takeUntilASCII '<' P.skipASCII '<' - email <- P.takeWhileASCII ((/=) '>') + email <- P.takeUntilASCII '>' _ <- P.string "> " time <- PC.decimal :: Parser Integer _ <- P.string " " -- GitLab