packages feed

flatparse 0.4.0.2 → 0.4.1.0

raw patch · 5 files changed

+36/−4 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

flatparse.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           flatparse-version:        0.4.0.2+version:        0.4.1.0 synopsis:       High-performance parsing from strict bytestrings description:    @Flatparse@ is a high-performance parsing library for strict bytestring input. See the README for more information:                 <https://github.com/AndrasKovacs/flatparse>.
src/FlatParse/Basic.hs view
@@ -405,7 +405,7 @@             go line (col + 1) ((i, pos):poss)        sorted :: [(Int, Pos)]-      sorted = sortBy (\(_, i) (_, j) -> compare j i) (zip [0..] poss)+      sorted = sortBy (\(_, i) (_, j) -> compare i j) (zip [0..] poss)    in case runParser (go 0 0 sorted) str of        OK res _ -> snd <$> sortBy (comparing fst) res
src/FlatParse/Basic/Base.hs view
@@ -261,6 +261,9 @@ -- | Read the given number of bytes as a 'ByteString'. -- -- Throws a runtime error if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. take :: Int -> ParserT st e B.ByteString take (I# n#) = take# n# {-# inline take #-}@@ -269,6 +272,9 @@ --   available. -- -- Throws a runtime error if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. take# :: Int# -> ParserT st e B.ByteString take# n# = Common.withPosInt# n# (takeUnsafe# n#) {-# inline take# #-}@@ -277,6 +283,9 @@ --   available. -- -- Undefined behaviour if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. takeUnsafe# :: Int# -> ParserT st e B.ByteString takeUnsafe# n# = ParserT \fp eob s st ->     case n# <=# minusAddr# eob s of@@ -285,6 +294,9 @@ {-# inline takeUnsafe# #-}  -- | Consume the rest of the input. May return the empty bytestring.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. takeRest :: ParserT st e B.ByteString takeRest = ParserT \fp eob s st ->   let n# = minusAddr# eob s
src/FlatParse/Common/Position.hs view
@@ -12,9 +12,17 @@ import GHC.Exts  -- | Byte offset counted backwards from the end of the buffer.+--   Note: the `Ord` instance for `Pos` considers the earlier positions to be+--   smaller. newtype Pos = Pos { unPos :: Int }     deriving stock (Show)-    deriving (Eq, Ord) via Int+    deriving Eq via Int++instance Ord Pos where+  (<=) (Pos x) (Pos y) = y <= x+  {-# inline (<=) #-}+  compare (Pos x) (Pos y) = compare y x+  {-# inline compare #-}  -- | A pair of positions. data Span = Span !Pos !Pos
src/FlatParse/Stateful/Base.hs view
@@ -264,6 +264,9 @@ --   available. -- -- Throws a runtime error if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. take :: Int -> ParserT st r e B.ByteString take (I# n#) = take# n# {-# inline take #-}@@ -272,6 +275,9 @@ --   available. -- -- Throws a runtime error if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. take# :: Int# -> ParserT st r e B.ByteString take# n# = Common.withPosInt# n# (takeUnsafe# n#) {-# inline take# #-}@@ -279,7 +285,10 @@ -- | Read @i#@ bytes as a 'ByteString'. Fails if newer than @i#@ bytes are --   available. -----   Undefined behaviour if given a negative integer.+-- Undefined behaviour if given a negative integer.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. takeUnsafe# :: Int# -> ParserT st r e B.ByteString takeUnsafe# i# = ParserT \fp !r eob s n st ->     case i# <=# minusAddr# eob s of@@ -288,6 +297,9 @@ {-# inline takeUnsafe# #-}  -- | Consume the rest of the input. May return the empty bytestring.+--+-- This does no copying. The 'B.ByteString' returned is a "slice" of the input,+-- and will keep it alive. To avoid this, use 'B.copy' on the output. takeRest :: ParserT st r e B.ByteString takeRest = ParserT \fp !r eob s n st ->   let i# = minusAddr# eob s