@@ -58,7 +58,6 @@ import Data.Aeson.Types.Internal (IResult(..), JSONPath, Object, Result(..), Val
5858import Data.Attoparsec.ByteString.Char8 (Parser, char, decimal, endOfInput, isDigit_w8, signed, string)
5959import Data.Function (fix)
6060import Data.Functor.Compat (($>))
61−import Data.Bits (testBit)
6261import Data.Scientific (Scientific)
6362import Data.Text (Text)
6463import Data.Vector (Vector)
@@ -324,18 +323,7 @@ jstring = A.word8 DOUBLE_QUOTE *> jstring_
324323-- | Parse a string without a leading quote.
325324jstring_ :: Parser Text
326325{-# INLINE jstring_ #-}
327−jstring_ = do
328− s <- A.takeWhile (\w -> w /= DOUBLE_QUOTE && w /= BACKSLASH && not (testBit w 7))
329− let txt = TE.decodeUtf8 s
330− w <- A.peekWord8
331− case w of
332− Nothing -> fail "string without end"
333− Just DOUBLE_QUOTE -> A.anyWord8 *> return txt
334− _ -> jstringSlow s
335−
336−jstringSlow :: B.ByteString -> Parser Text
337−{-# INLINE jstringSlow #-}
338−jstringSlow s' = {-# SCC "jstringSlow" #-} do
326+jstring_ = {-# SCC "jstring_" #-} do
339327#if MIN_VERSION_ghc_prim(0,3,1)
340328 (s, S _ escaped) <- A.runScanner startState go <* A.anyWord8
341329 -- We escape only if there are
@@ -344,10 +332,10 @@ jstringSlow s' = {-# SCC "jstringSlow" #-} do
344332 -- Note: if/when text will have fast ascii -> text conversion
345333 -- (e.g. uses utf8 encoding) we can have further speedup.
346334 if isTrue# escaped
347− then case unescapeText (s' <> s) of
335+ then case unescapeText s of
348336 Right r -> return r
349337 Left err -> fail $ show err
350− else return (TE.decodeUtf8 (s' <> s))
338+ else return (TE.decodeUtf8 s)
351339 where
352340 startState = S 0# 0#
353341 go (S skip escaped) (W8# c)
@@ -365,7 +353,7 @@ jstringSlow s' = {-# SCC "jstringSlow" #-} do
365353data S = S Int# Int#
366354#else
367355 s <- A.scan startState go <* A.anyWord8
368− case unescapeText (s' <> s) of
356+ case unescapeText s of
369357 Right r -> return r
370358 Left err -> fail $ show err
371359 where