Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-attoparsec for openSUSE:Factory checked in at 2021-03-28 11:55:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-attoparsec (Old) and /work/SRC/openSUSE:Factory/.ghc-attoparsec.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-attoparsec" Sun Mar 28 11:55:39 2021 rev:24 rq:881529 version:0.14.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-attoparsec/ghc-attoparsec.changes 2021-03-10 08:58:02.130937303 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-attoparsec.new.2401/ghc-attoparsec.changes 2021-03-28 11:57:39.560292861 +0200 @@ -1,0 +2,13 @@ +Tue Mar 23 08:31:04 UTC 2021 - psim...@suse.com + +- Update attoparsec to version 0.14.1. + 0.14.1 + + * Added `Data.Attoparsec.ByteString.getChunk`. + + 0.14.0 + + * Added `Data.Attoparsec.ByteString.takeWhileIncluding`. + * Make `Data.Attoparsec.{Text,ByteString}.Lazy.parseOnly` accept lazy input. + +------------------------------------------------------------------- Old: ---- attoparsec-0.13.2.5.tar.gz attoparsec.cabal New: ---- attoparsec-0.14.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-attoparsec.spec ++++++ --- /var/tmp/diff_new_pack.EDdIZR/_old 2021-03-28 11:57:40.052293297 +0200 +++ /var/tmp/diff_new_pack.EDdIZR/_new 2021-03-28 11:57:40.056293300 +0200 @@ -19,13 +19,12 @@ %global pkg_name attoparsec %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.13.2.5 +Version: 0.14.1 Release: 0 Summary: Fast combinator parsing for bytestrings and text License: BSD-3-Clause URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-array-devel BuildRequires: ghc-bytestring-devel @@ -60,7 +59,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ attoparsec-0.13.2.5.tar.gz -> attoparsec-0.14.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Char8.hs new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Char8.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Char8.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Char8.hs 2001-09-09 03:46:40.000000000 +0200 @@ -489,30 +489,39 @@ {-# SPECIALIZE rational :: Parser Scientific #-} rational = scientifically realToFrac --- | Parse a rational number. +-- | Parse a 'Double'. -- -- This parser accepts an optional leading sign character, followed by --- at least one decimal digit. The syntax similar to that accepted by --- the 'read' function, with the exception that a trailing @\'.\'@ or --- @\'e\'@ /not/ followed by a number is not consumed. +-- at most one decimal digit. The syntax is similar to that accepted by +-- the 'read' function, with the exception that a trailing @\'.\'@ is +-- consumed. +-- +-- === Examples +-- +-- These examples use this helper: +-- +-- @ +-- r :: 'Parser' a -> 'Data.ByteString.ByteString' -> 'Data.Attoparsec.ByteString.Result' a +-- r p s = 'feed' ('Data.Attoparsec.parse' p s) 'mempty' +-- @ -- -- Examples with behaviour identical to 'read', if you feed an empty -- continuation to the first result: -- --- >rational "3" == Done 3.0 "" --- >rational "3.1" == Done 3.1 "" --- >rational "3e4" == Done 30000.0 "" --- >rational "3.1e4" == Done 31000.0, "" +-- > double "3" == Done "" 3.0 +-- > double "3.1" == Done "" 3.1 +-- > double "3e4" == Done "" 30000.0 +-- > double "3.1e4" == Done "" 31000.0 +-- > double "3e" == Done "e" 3.0 -- -- Examples with behaviour identical to 'read': -- --- >rational ".3" == Fail "input does not start with a digit" --- >rational "e3" == Fail "input does not start with a digit" +-- > double ".3" == Fail ".3" _ _ +-- > double "e3" == Fail "e3" _ _ -- --- Examples of differences from 'read': +-- Example of difference from 'read': -- --- >rational "3.foo" == Done 3.0 ".foo" --- >rational "3e" == Done 3.0 "e" +-- > double "3.foo" == Done "foo" 3.0 -- -- This function does not accept string representations of \"NaN\" or -- \"Infinity\". diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Internal.hs new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Internal.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Internal.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Internal.hs 2001-09-09 03:46:40.000000000 +0200 @@ -53,7 +53,9 @@ , runScanner , takeWhile , takeWhile1 + , takeWhileIncluding , takeTill + , getChunk -- ** Consume all remaining input , takeByteString @@ -277,6 +279,46 @@ else return $ concatReverse (s:acc) {-# INLINE takeWhileAcc #-} +-- | Consume input until immediately after the predicate returns 'True', and return +-- the consumed input. +-- +-- This parser will consume at least one 'Word8' or fail. +takeWhileIncluding :: (Word8 -> Bool) -> Parser B.ByteString +takeWhileIncluding p = do + (s', t) <- B8.span p <$> get + case B8.uncons t of + -- Since we reached a break point and managed to get the next byte, + -- input can not have been exhausted thus we succed and advance unconditionally. + Just (h, _) -> do + let s = s' `B8.snoc` h + advance (B8.length s) + return s + -- The above isn't true so either we ran out of input or we need to process the next chunk. + Nothing -> do + continue <- inputSpansChunks (B8.length s') + if continue + then takeWhileIncAcc p [s'] + -- Our spec says that if we run out of input we fail. + else fail "takeWhileIncluding reached end of input" +{-# INLINE takeWhileIncluding #-} + +takeWhileIncAcc :: (Word8 -> Bool) -> [B.ByteString] -> Parser B.ByteString +takeWhileIncAcc p = go + where + go acc = do + (s', t) <- B8.span p <$> get + case B8.uncons t of + Just (h, _) -> do + let s = s' `B8.snoc` h + advance (B8.length s) + return (concatReverse $ s:acc) + Nothing -> do + continue <- inputSpansChunks (B8.length s') + if continue + then go (s':acc) + else fail "takeWhileIncAcc reached end of input" +{-# INLINE takeWhileIncAcc #-} + takeRest :: Parser [ByteString] takeRest = go [] where @@ -297,6 +339,17 @@ takeLazyByteString :: Parser L.ByteString takeLazyByteString = L.fromChunks `fmap` takeRest +-- | Return the rest of the current chunk without consuming anything. +-- +-- If the current chunk is empty, then ask for more input. +-- If there is no more input, then return 'Nothing' +getChunk :: Parser (Maybe ByteString) +getChunk = do + input <- wantInput + if input + then Just <$> get + else return Nothing + data T s = T {-# UNPACK #-} !Int s scan_ :: (s -> [ByteString] -> Parser r) -> s -> (s -> Word8 -> Maybe s) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Lazy.hs new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Lazy.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString/Lazy.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/ByteString/Lazy.hs 2001-09-09 03:46:40.000000000 +0200 @@ -33,6 +33,7 @@ , module Data.Attoparsec.ByteString -- * Running parsers , parse + , parseOnly , parseTest -- ** Result conversion , maybeResult @@ -47,7 +48,7 @@ import qualified Data.Attoparsec.Internal.Types as T import Data.Attoparsec.ByteString hiding (IResult(..), Result, eitherResult, maybeResult, - parse, parseWith, parseTest) + parse, parseOnly, parseWith, parseTest) -- | The result of a parse. data Result r = Fail ByteString [String] String @@ -108,3 +109,16 @@ eitherResult (Done _ r) = Right r eitherResult (Fail _ [] msg) = Left msg eitherResult (Fail _ ctxs msg) = Left (intercalate " > " ctxs ++ ": " ++ msg) + +-- | Run a parser that cannot be resupplied via a 'T.Partial' result. +-- +-- This function does not force a parser to consume all of its input. +-- Instead, any residual input will be discarded. To force a parser +-- to consume all of its input, use something like this: +-- +-- @ +--'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput') +-- @ +parseOnly :: A.Parser a -> ByteString -> Either String a +parseOnly p = eitherResult . parse p +{-# INLINE parseOnly #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString.hs new/attoparsec-0.14.1/Data/Attoparsec/ByteString.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/ByteString.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/ByteString.hs 2001-09-09 03:46:40.000000000 +0200 @@ -66,7 +66,9 @@ , I.runScanner , I.takeWhile , I.takeWhile1 + , I.takeWhileIncluding , I.takeTill + , I.getChunk -- ** Consume all remaining input , I.takeByteString diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/Combinator.hs new/attoparsec-0.14.1/Data/Attoparsec/Combinator.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/Combinator.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/Combinator.hs 2001-09-09 03:46:40.000000000 +0200 @@ -43,11 +43,12 @@ import Control.Applicative (Applicative(..), (<$>)) import Data.Monoid (Monoid(mappend)) #endif -import Control.Applicative (Alternative(..), empty, liftA2, many, (<|>)) +import Control.Applicative (Alternative(..), liftA2, many, (<|>)) import Control.Monad (MonadPlus(..)) import Data.Attoparsec.Internal.Types (Parser(..), IResult(..)) import Data.Attoparsec.Internal (endOfInput, atEnd, satisfyElem) import Data.ByteString (ByteString) +import Data.Foldable (asum) import Data.Text (Text) import qualified Data.Attoparsec.Zepto as Z import Prelude hiding (succ) @@ -58,7 +59,7 @@ -- This combinator is provided for compatibility with Parsec. -- attoparsec parsers always backtrack on failure. try :: Parser i a -> Parser i a -try p = p +try = id {-# INLINE try #-} -- | Name the parser, in case failure occurs. @@ -75,7 +76,7 @@ -- until one of them succeeds. Returns the value of the succeeding -- action. choice :: Alternative f => [f a] -> f a -choice = foldr (<|>) empty +choice = asum {-# SPECIALIZE choice :: [Parser ByteString a] -> Parser ByteString a #-} {-# SPECIALIZE choice :: [Parser Text a] -> Parser Text a #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/Text/Lazy.hs new/attoparsec-0.14.1/Data/Attoparsec/Text/Lazy.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/Text/Lazy.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/Text/Lazy.hs 2001-09-09 03:46:40.000000000 +0200 @@ -34,6 +34,7 @@ , module Data.Attoparsec.Text -- * Running parsers , parse + , parseOnly , parseTest -- ** Result conversion , maybeResult @@ -47,7 +48,7 @@ import qualified Data.Attoparsec.Text as A import qualified Data.Text as T import Data.Attoparsec.Text hiding (IResult(..), Result, eitherResult, - maybeResult, parse, parseWith, parseTest) + maybeResult, parse, parseOnly, parseWith, parseTest) -- | The result of a parse. data Result r = Fail Text [String] String @@ -99,3 +100,16 @@ eitherResult (Done _ r) = Right r eitherResult (Fail _ [] msg) = Left msg eitherResult (Fail _ ctxs msg) = Left (intercalate " > " ctxs ++ ": " ++ msg) + +-- | Run a parser that cannot be resupplied via a 'T.Partial' result. +-- +-- This function does not force a parser to consume all of its input. +-- Instead, any residual input will be discarded. To force a parser +-- to consume all of its input, use something like this: +-- +-- @ +--'parseOnly' (myParser 'Control.Applicative.<*' 'endOfInput') +-- @ +parseOnly :: A.Parser a -> Text -> Either String a +parseOnly p = eitherResult . parse p +{-# INLINE parseOnly #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/Data/Attoparsec/Text.hs new/attoparsec-0.14.1/Data/Attoparsec/Text.hs --- old/attoparsec-0.13.2.5/Data/Attoparsec/Text.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/Data/Attoparsec/Text.hs 2001-09-09 03:46:40.000000000 +0200 @@ -360,30 +360,39 @@ {-# SPECIALIZE rational :: Parser Scientific #-} rational = scientifically realToFrac --- | Parse a rational number. +-- | Parse a 'Double'. -- -- This parser accepts an optional leading sign character, followed by --- at least one decimal digit. The syntax similar to that accepted by --- the 'read' function, with the exception that a trailing @\'.\'@ or --- @\'e\'@ /not/ followed by a number is not consumed. +-- at most one decimal digit. The syntax is similar to that accepted by +-- the 'read' function, with the exception that a trailing @\'.\'@ is +-- consumed. +-- +-- === Examples +-- +-- These examples use this helper: +-- +-- @ +-- r :: 'Parser' a -> 'Data.Text.Text' -> 'Data.Attoparsec.Text.Result' a +-- r p s = 'feed' ('Data.Attoparsec.parse' p s) 'mempty' +-- @ -- -- Examples with behaviour identical to 'read', if you feed an empty -- continuation to the first result: -- --- >rational "3" == Done 3.0 "" --- >rational "3.1" == Done 3.1 "" --- >rational "3e4" == Done 30000.0 "" --- >rational "3.1e4" == Done 31000.0, "" +-- > r double "3" == Done "" 3.0 +-- > r double "3.1" == Done "" 3.1 +-- > r double "3e4" == Done "" 30000.0 +-- > r double "3.1e4" == Done "" 31000.0 +-- > r double "3e" == Done "e" 3.0 -- -- Examples with behaviour identical to 'read': -- --- >rational ".3" == Fail "input does not start with a digit" --- >rational "e3" == Fail "input does not start with a digit" +-- > r double ".3" == Fail ".3" _ _ +-- > r double "e3" == Fail "e3" _ _ -- --- Examples of differences from 'read': +-- Example of difference from 'read': -- --- >rational "3.foo" == Done 3.0 ".foo" --- >rational "3e" == Done 3.0 "e" +-- > r double "3.foo" == Done "foo" 3.0 -- -- This function does not accept string representations of \"NaN\" or -- \"Infinity\". diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/attoparsec.cabal new/attoparsec-0.14.1/attoparsec.cabal --- old/attoparsec-0.13.2.5/attoparsec.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/attoparsec.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,12 +1,12 @@ name: attoparsec -version: 0.13.2.5 +version: 0.14.1 license: BSD3 license-file: LICENSE category: Text, Parsing author: Bryan O'Sullivan <b...@serpentine.com> maintainer: Bryan O'Sullivan <b...@serpentine.com>, Ben Gamari <b...@smart-cactus.org> stability: experimental -tested-with: GHC == 7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.2, GHC ==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.1, GHC==8.10.1 +tested-with: GHC == 7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.2, GHC ==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.4, GHC==8.10.4, GHC == 9.0.1 synopsis: Fast combinator parsing for bytestrings and text cabal-version: 2.0 homepage: https://github.com/bgamari/attoparsec @@ -46,7 +46,7 @@ scientific >= 0.3.1 && < 0.4, transformers >= 0.2 && (< 0.4 || >= 0.4.1.0) && < 0.6, text >= 1.1.1.3, - ghc-prim <0.7 + ghc-prim <0.8 if impl(ghc < 7.4) build-depends: bytestring < 0.10.4.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/changelog.md new/attoparsec-0.14.1/changelog.md --- old/attoparsec-0.13.2.5/changelog.md 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/changelog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,12 @@ +0.14.1 + +* Added `Data.Attoparsec.ByteString.getChunk`. + +0.14.0 + +* Added `Data.Attoparsec.ByteString.takeWhileIncluding`. +* Make `Data.Attoparsec.{Text,ByteString}.Lazy.parseOnly` accept lazy input. + 0.13.2.1 * Improved performance of `Data.Attoparsec.Text.asciiCI` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/attoparsec-0.13.2.5/tests/QC/ByteString.hs new/attoparsec-0.14.1/tests/QC/ByteString.hs --- old/attoparsec-0.13.2.5/tests/QC/ByteString.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/attoparsec-0.14.1/tests/QC/ByteString.hs 2001-09-09 03:46:40.000000000 +0200 @@ -121,6 +121,18 @@ PL.Done t' h' -> t === t' .&&. toStrictBS h === h' _ -> property False +takeWhileIncluding :: Word8 -> L.ByteString -> Property +takeWhileIncluding w s = + let s' = L.cons w $ L.snoc s (w+1) + (h_,t_) = L.span (<=w) s' + (h,t) = + case L.uncons t_ of + Nothing -> (h_, t_) + Just (n, nt) -> (h_ `L.snoc` n, nt) + in w < 255 ==> case PL.parse (P.takeWhileIncluding (<=w)) s' of + PL.Done t' h' -> t === t' .&&. toStrictBS h === h' + _ -> property False + takeTill :: Word8 -> L.ByteString -> Property takeTill w s = let (h,t) = L.break (==w) s @@ -131,6 +143,19 @@ takeWhile1_empty :: Property takeWhile1_empty = parseBS (P.takeWhile1 undefined) L.empty === Nothing +getChunk :: L.ByteString -> Property +getChunk s = + maybe (property False) (=== L.toChunks s) $ + parseBS getChunks s + where getChunks = go [] + go res = do + mchunk <- P.getChunk + case mchunk of + Nothing -> return (reverse res) + Just chunk -> do + _ <- P.take (B.length chunk) + go (chunk:res) + endOfInput :: L.ByteString -> Property endOfInput s = parseBS P.endOfInput s === if L.null s then Just () @@ -181,6 +206,8 @@ , testProperty "takeWhile" takeWhile , testProperty "takeWhile1" takeWhile1 , testProperty "takeWhile1_empty" takeWhile1_empty + , testProperty "takeWhileIncluding" takeWhileIncluding + , testProperty "getChunk" getChunk , testProperty "word8" word8 , testProperty "members" members , testProperty "nonmembers" nonmembers