@@ -33,6 +33,7 @@ import Data.Vector as Vector hiding ((++))
33import Data.Word (Word8)
33import Data.Word (Word8)
34import qualified Data.Attoparsec as A
34import qualified Data.Attoparsec as A
35import qualified Data.Attoparsec.Zepto as Z
35import qualified Data.Attoparsec.Zepto as Z
36+import qualified Data.ByteString.Char8 as B8
36import qualified Data.ByteString.Unsafe as B
37import qualified Data.ByteString.Unsafe as B
38-- | Parse a top-level JSON value. This must be either an object or
39-- | Parse a top-level JSON value. This must be either an object or
@@ -67,7 +68,7 @@ value :: Parser Value
67value = most <|> (Number <$> number)
68value = most <|> (Number <$> number)
70− c <- anyChar
71+ c <- satisfy (`B8.elem` "{[\"ftn")
72 '{' -> object_
73 '{' -> object_
73 '[' -> array_
74 '[' -> array_
@@ -75,7 +76,7 @@ value = most <|> (Number <$> number)
75 'f' -> string "alse" *> pure (Bool False)
76 'f' -> string "alse" *> pure (Bool False)
76 't' -> string "rue" *> pure (Bool True)
77 't' -> string "rue" *> pure (Bool True)
77 'n' -> string "ull" *> pure Null
78 'n' -> string "ull" *> pure Null
78− _ -> fail "not a valid JSON value"
79+ _ -> error "attoparsec panic! the impossible happened!"
80doubleQuote, backslash :: Word8
81doubleQuote, backslash :: Word8
81doubleQuote = 34
82doubleQuote = 34