@@ -200,10 +200,12 @@ value' = do
200200jstring :: Parser Text
201201jstring = A.word8 DOUBLE_QUOTE *> jstring_
202202
203+data S = S !Bool !Bool
204+
203205-- | Parse a string without a leading quote.
204206jstring_ :: Parser Text
205207jstring_ = {-# SCC "jstring_" #-} do
206− (s, (_, escaped)) <- A.runScanner (False, False) go
208+ (s, S _ escaped) <- A.runScanner (S False False) go
207209 _ <- A.anyWord8
208210 s1 <- if escaped
209211 then case unescape s of
@@ -213,11 +215,11 @@ jstring_ = {-# SCC "jstring_" #-} do
213215 case decodeUtf8' s1 of
214216 Right r -> return r
215217 Left err -> fail $ show err
216− where go (a, b) c
217− | a = Just (False, b)
218− | c == DOUBLE_QUOTE = Nothing
218+ where go (S a b) c
219+ | a = Just (S False b)
220+ | c == DOUBLE_QUOTE = Nothing
219221 | otherwise = let a' = c == backSlash
220− in Just (a', a' || b)
222+ in Just (S a' (a' || b))
221223 where backSlash = BACKSLASH
222224{-# INLINE jstring_ #-}
223225