json-tokens 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+11/−5 lines, 3 filesdep ~bytesmithPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytesmith
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- json-tokens.cabal +2/−2
- src/Json/Token.hs +5/−3
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for json-tokenize +## 0.1.0.1 -- 2019-09-30++* Make library compatible with `bytesmith-0.3`.+ ## 0.1.0.0 -- 2019-09-27 * First version. Released on an unsuspecting world.
json-tokens.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: json-tokens-version: 0.1.0.0+version: 0.1.0.1 synopsis: Tokenize JSON description: Convert JSON to a token stream. This libary focuses on@@ -67,7 +67,7 @@ , bytestring >=0.10.8 && <0.11 , array-builder >=0.1 && <0.2 , text-short >=0.1.3 && <0.2- , bytesmith >=0.2 && <0.3+ , bytesmith >=0.3 && <0.4 , primitive >=0.7 && <0.8 , byteslice >=0.1.3 && <0.2 , array-chunks >=0.1.1 && <0.2
src/Json/Token.hs view
@@ -102,9 +102,11 @@ decode :: Bytes -> Either TokenException (SmallArray Token) decode !bs = runST $ do !b <- B.new- P.parseBytesST (P.skipWhile isSpace *> manyTokens b) bs >>= \case+ P.parseBytesEffectfully (P.skipWhile isSpace *> manyTokens b) bs >>= \case P.Failure err -> pure (Left err)- P.Success cs _ -> pure (Right cs)+ -- Since manyTokens only completes once the end of the input+ -- has been reached, we do not need to check the length here.+ P.Success (P.Slice _ _ cs) -> pure (Right cs) manyTokens :: Builder s Token@@ -181,7 +183,7 @@ P.effect (PM.writeByteArray dst ix (c2w '\f')) go (ix + 1) 'u' -> do- w <- Latin.hexWord16 InvalidEscapeSequence+ w <- Latin.hexFixedWord16 InvalidEscapeSequence if w >= 0xD800 && w < 0xDFFF then go =<< P.effect (encodeUtf8Char dst ix '\xFFFD') else go =<< P.effect (encodeUtf8Char dst ix (w16ToChar w))