fix another parser bug
This commit is contained in:
parent
b3d30e7d70
commit
6ef38df881
1 changed files with 9 additions and 9 deletions
|
@ -43,8 +43,9 @@ buildContentIdentifierList l = case l of
|
||||||
| S8.any (`elem` [':', '\r', '\n']) c || "!" `S8.isPrefixOf` c =
|
| S8.any (`elem` [':', '\r', '\n']) c || "!" `S8.isPrefixOf` c =
|
||||||
charUtf8 '!' <> byteString (toB64' c)
|
charUtf8 '!' <> byteString (toB64' c)
|
||||||
| otherwise = byteString c
|
| otherwise = byteString c
|
||||||
go (c:cs) = buildcid c <> charUtf8 ':' <> go cs
|
|
||||||
go [] = mempty
|
go [] = mempty
|
||||||
|
go (c:[]) = buildcid c
|
||||||
|
go (c:cs) = buildcid c <> charUtf8 ':' <> go cs
|
||||||
|
|
||||||
parseLog :: L.ByteString -> ContentIdentifierLog
|
parseLog :: L.ByteString -> ContentIdentifierLog
|
||||||
parseLog = parseLogNew parseContentIdentifierList
|
parseLog = parseLogNew parseContentIdentifierList
|
||||||
|
@ -59,12 +60,11 @@ parseContentIdentifierList = do
|
||||||
return $ if "!" `S8.isPrefixOf` b
|
return $ if "!" `S8.isPrefixOf` b
|
||||||
then ContentIdentifier $ fromMaybe b (fromB64Maybe' (S.drop 1 b))
|
then ContentIdentifier $ fromMaybe b (fromB64Maybe' (S.drop 1 b))
|
||||||
else ContentIdentifier b
|
else ContentIdentifier b
|
||||||
listparser first rest = do
|
listparser first rest = ifM A8.atEnd
|
||||||
cid <- cidparser
|
( return (first :| reverse rest)
|
||||||
ifM A8.atEnd
|
|
||||||
( return (first :| reverse (cid:rest))
|
|
||||||
, do
|
, do
|
||||||
_ <- A8.char ':'
|
_ <- A8.char ':'
|
||||||
|
cid <- cidparser
|
||||||
listparser first (cid:rest)
|
listparser first (cid:rest)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue