on master help sign in
Fix build with GHC < 7.8
commit54f9315e7dd55bc1b82de62f34de7a49f33a7ea2 authorBryan O'Sullivan <bos@serpentine.com> dateWed 22 Jul 2015, 13:34 (11 years ago) parentb5a7ad5
1 file changed+5−2
Data/Aeson/Parser/Internal.hs+5−2
Data/Aeson/Parser/Internal.hs+5−2
@@ -212,7 +212,7 @@ jstring = A.word8 DOUBLE_QUOTE *> jstring_
212212jstring_ :: Parser Text
213213{-# INLINE jstring_ #-}
214214jstring_ = {-# SCC "jstring_" #-} do
215− (s, fin) <- A.runScanner (S 0# 0#) go
215+ (s, fin) <- A.runScanner startState go
216216 _ <- A.anyWord8
217217 s1 <- if isEscaped fin
218218 then case unescape s of
@@ -225,6 +225,7 @@ jstring_ = {-# SCC "jstring_" #-} do
225225 where
226226#if MIN_VERSION_ghc_prim(0,3,1)
227227 isEscaped (S _ escaped) = isTrue# escaped
228+ startState = S 0# 0#
228229 go (S a b) (W8# c)
229230 | isTrue# a = Just (S 0# b)
230231 | isTrue# (word2Int# c ==# 34#) = Nothing -- double quote
@@ -234,11 +235,13 @@ jstring_ = {-# SCC "jstring_" #-} do
234235data S = S Int# Int#
235236#else
236237 isEscaped (S _ escaped) = escaped
238+ startState = S False False
237239 go (S a b) c
238240 | a = Just (S False b)
239241 | c == DOUBLE_QUOTE = Nothing
240− | otherwise = let a' = c == BACKSLASH
242+ | otherwise = let a' = c == backslash
241243 in Just (S a' (a' || b))
244+ where backslash = BACKSLASH
242245
243246data S = S !Bool !Bool
244247#endif