diff --git a/Data/Git/Parser.hs b/Data/Git/Parser.hs index c1a8b08294252f82dc3c344bc6fe0044f7a081d2..c3b9ac2509f8c4cb17dd36064f732b4a458f9771 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 796e44fd955e80bfa63d9251d249475202a446ba..37a6922767d97f96de035716688a2f0697085373 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 " "