@@ -1802,19 +1802,19 @@ data BlockParseState s =
18021802-- not overlap. Block start and end brackets must be different for nesting
18031803-- blocks within blocks.
18041804--
1805−-- >>> p = Parser.blockWithQuotes '{' '}' '"' '\\' Fold.toList
1805+-- >>> p = Parser.blockWithQuotes (== '\\') (== '"') '{' '}' Fold.toList
18061806-- >>> Stream.parse p $ Stream.fromList "{msg: \"hello world\"}"
18071807-- Right "msg: \"hello world\""
18081808--
18091809{-# INLINE blockWithQuotes #-}
18101810blockWithQuotes :: (Monad m, Eq a) =>
1811− a -- ^ Block opening bracket
1811+ (a -> Bool) -- ^ escape char
1812+ -> (a -> Bool) -- ^ quote char, to quote inside brackets
1813+ -> a -- ^ Block opening bracket
18121814 -> a -- ^ Block closing bracket
1813− -> a -- ^ quote char
1814− -> a -- ^ escape char
18151815 -> Fold m a b
18161816 -> Parser a m b
1817−blockWithQuotes bopen bclose quote esc
1817+blockWithQuotes isEsc isQuote bopen bclose
18181818 (Fold fstep finitial fextract) =
18191819 Parser step initial extract
18201820
@@ -1851,13 +1851,13 @@ blockWithQuotes bopen bclose quote esc
18511851 then fmap (Done 0) (fextract s)
18521852 else process s a (BlockUnquoted (level - 1))
18531853 else
1854− if a == quote
1854+ if isQuote a
18551855 then process s a (BlockQuoted level)
18561856 else process s a (BlockUnquoted level)
18571857 step (BlockQuoted level s) a
1858− | a == esc = process s a (BlockQuotedEsc level)
1858+ | isEsc a = process s a (BlockQuotedEsc level)
18591859 | otherwise =
1860− if a == quote
1860+ if isQuote a
18611861 then process s a (BlockUnquoted level)
18621862 else process s a (BlockQuoted level)
18631863 step (BlockQuotedEsc level s) a = process s a (BlockQuoted level)