Make Composite's text parser handle text containing double quotes (#304)

This commit is contained in:
Shane 2024-01-09 01:19:51 +00:00 committed by GitHub
parent 2d9b6abc74
commit 91e7a1bfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -194,9 +194,10 @@ parseRow = parse $ do
unquoted = A.takeWhile1 (A.notInClass ",\"()")
quoted = A.char '"' *> contents <* A.char '"'
where
contents = fold <$> many (unquote <|> unescape)
contents = fold <$> many (unquote <|> unescape <|> quote)
where
unquote = A.takeWhile1 (A.notInClass "\"\\")
unescape = A.char '\\' *> do
BS.singleton <$> do
A.char '\\' <|> A.char '"'
quote = "\"" <$ A.string "\"\""