packages feed

megaparsec 4.1.0 → 4.1.1

raw patch · 8 files changed

+66/−34 lines, 8 filesdep ~megaparsecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: megaparsec

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+## Megaparsec 4.1.1++* Fixed bug in implementation of `sepEndBy` and `sepEndBy1` and removed+  deprecation notes for these functions.++* Added tests for `sepEndBy` and `sepEndBy1`.+ ## Megaparsec 4.1.0  * Relaxed dependency on `base`, so that minimal required version of `base`
Text/Megaparsec.hs view
@@ -78,6 +78,8 @@   , option   , sepBy   , sepBy1+  , sepEndBy+  , sepEndBy1   , skipMany   , skipSome     -- Deprecated combinators@@ -85,8 +87,6 @@   , chainl1   , chainr   , chainr1-  , sepEndBy-  , sepEndBy1     -- * Character parsing   , newline   , crlf
Text/Megaparsec/Char.hs view
@@ -70,7 +70,7 @@ -- | Parses a newline character.  newline :: MonadParsec s m Char => m Char-newline = char '\n' <?> "newline"+newline = char '\n'  -- | Parses a carriage return character followed by a newline -- character. Returns sequence of characters parsed.@@ -89,7 +89,7 @@ -- | Parses a tab character.  tab :: MonadParsec s m Char => m Char-tab = char '\t' <?> "tab"+tab = char '\t'  -- | Skips /zero/ or more white space characters. --
Text/Megaparsec/Combinator.hs view
@@ -24,15 +24,15 @@   , option   , sepBy   , sepBy1+  , sepEndBy+  , sepEndBy1   , skipMany   , skipSome     -- Deprecated combinators   , chainl   , chainl1   , chainr-  , chainr1-  , sepEndBy-  , sepEndBy1 )+  , chainr1 ) where  import Control.Applicative@@ -148,6 +148,22 @@ sepBy1 p sep = (:) <$> p <*> many (sep *> p) {-# INLINE sepBy1 #-} +-- | @sepEndBy p sep@ parses /zero/ or more occurrences of @p@,+-- separated and optionally ended by @sep@. Returns a list of values+-- returned by @p@.++sepEndBy :: Alternative m => m a -> m sep -> m [a]+sepEndBy p sep = sepEndBy1 p sep <|> pure []+{-# INLINE sepEndBy #-}++-- | @sepEndBy1 p sep@ parses /one/ or more occurrences of @p@,+-- separated and optionally ended by @sep@. Returns a list of values+-- returned by @p@.++sepEndBy1 :: Alternative m => m a -> m sep -> m [a]+sepEndBy1 p sep = (:) <$> p <*> ((sep *> sepEndBy p sep) <|> pure [])+{-# INLINE sepEndBy1 #-}+ -- | @skipMany p@ applies the parser @p@ /zero/ or more times, skipping -- its result. --@@ -220,23 +236,3 @@   scan = flip id <$> p <*> rst   rst  = (flip <$> op <*> scan) <|> pure id {-# INLINE chainr1 #-}---- | @sepEndBy p sep@ parses /zero/ or more occurrences of @p@,--- separated and optionally ended by @sep@. Returns a list of values--- returned by @p@.--{-# DEPRECATED sepEndBy "Use @sepBy p sep <* optional sep@ instead." #-}--sepEndBy :: Alternative m => m a -> m sep -> m [a]-sepEndBy p sep = sepBy p sep <* optional sep-{-# INLINE sepEndBy #-}---- | @sepEndBy1 p sep@ parses /one/ or more occurrences of @p@,--- separated and optionally ended by @sep@. Returns a list of values--- returned by @p@.--{-# DEPRECATED sepEndBy1 "Use @sepBy1 p sep <* optional sep@ instead." #-}--sepEndBy1 :: Alternative m => m a -> m sep -> m [a]-sepEndBy1 p sep = sepBy1 p sep <* optional sep-{-# INLINE sepEndBy1 #-}
Text/Megaparsec/Lexer.hs view
@@ -162,7 +162,7 @@ -- Character and string literals  -- | The lexeme parser parses a single literal character without--- quotes. Purpose of this parser is to help with parsing of commonly used+-- quotes. Purpose of this parser is to help with parsing of conventional -- escape sequences. It's your responsibility to take care of character -- literal syntax in your language (by surrounding it with single quotes or -- similar).@@ -273,7 +273,7 @@ -- -- > lexeme        = L.lexeme spaceConsumer -- > integer       = lexeme L.integer--- > signedInteger = signed spaceConsumer integer+-- > signedInteger = L.signed spaceConsumer integer  signed :: (MonadParsec s m Char, Num a) => m () -> m a -> m a signed spc p = ($) <$> option id (lexeme spc sign) <*> p
megaparsec.cabal view
@@ -28,7 +28,7 @@ -- possibility of such damage.  name:                megaparsec-version:             4.1.0+version:             4.1.1 cabal-version:       >= 1.10 license:             BSD3 license-file:        LICENSE.md@@ -97,7 +97,7 @@                    , Bugs.Bug39                    , Util   build-depends:     base                   >= 4.6 && < 5-                   , megaparsec             >= 4.1.0+                   , megaparsec             >= 4.1.1                    , HUnit                  >= 1.2 && < 1.4                    , test-framework         >= 0.6 && < 1                    , test-framework-hunit   >= 0.2 && < 0.4@@ -121,7 +121,7 @@                    , Prim                    , Util   build-depends:     base                   >= 4.6 && < 5-                   , megaparsec             >= 4.1.0+                   , megaparsec             >= 4.1.1                    , mtl                    == 2.*                    , transformers           == 0.4.*                    , QuickCheck             >= 2.4 && < 3@@ -139,7 +139,7 @@   type:              exitcode-stdio-1.0   ghc-options:       -O2 -Wall -rtsopts   build-depends:     base                   >= 4.6 && < 5-                   , megaparsec             >= 4.1.0+                   , megaparsec             >= 4.1.1                    , criterion              >= 0.6.2.1 && < 1.2                    , text                   >= 1.2 && < 2                    , bytestring             >= 0.10 && < 2
tests/Combinator.hs view
@@ -55,6 +55,8 @@         , testProperty "combinator option"    prop_option         , testProperty "combinator sepBy"     prop_sepBy         , testProperty "combinator sepBy1"    prop_sepBy1+        , testProperty "combinator sepEndBy"  prop_sepEndBy+        , testProperty "combinator sepEndBy1" prop_sepEndBy1         , testProperty "combinator skipMany"  prop_skipMany         , testProperty "combinator skipSome"  prop_skipSome ] @@ -175,6 +177,33 @@           | c == 'a' && n == 0 = Right "a"           | n == 0    = posErr 0 s [uneCh c, exCh 'a']           | c == '-'  = posErr (length s) s [uneEof, exCh 'a']+          | otherwise = posErr (g n) s [uneCh c, exCh '-', exEof]+        s = intersperse '-' (replicate n 'a') ++ maybeToList c'++prop_sepEndBy :: NonNegative Int -> Maybe Char -> Property+prop_sepEndBy n' c' = checkParser p r s+  where n = getNonNegative n'+        c = fromJust c'+        p = sepEndBy (char 'a') (char '-')+        a = Right $ replicate n 'a'+        r | isNothing c' = a+          | c == 'a' && n == 0 = Right "a"+          | n == 0    = posErr 0 s [uneCh c, exCh 'a', exEof]+          | c == '-'  = a+          | otherwise = posErr (g n) s [uneCh c, exCh '-', exEof]+        s = intersperse '-' (replicate n 'a') ++ maybeToList c'++prop_sepEndBy1 :: NonNegative Int -> Maybe Char -> Property+prop_sepEndBy1 n' c' = checkParser p r s+  where n = getNonNegative n'+        c = fromJust c'+        p = sepEndBy1 (char 'a') (char '-')+        a = Right $ replicate n 'a'+        r | isNothing c' && n >= 1 = a+          | isNothing c' = posErr 0 s [uneEof, exCh 'a']+          | c == 'a' && n == 0 = Right "a"+          | n == 0    = posErr 0 s [uneCh c, exCh 'a']+          | c == '-'  = a           | otherwise = posErr (g n) s [uneCh c, exCh '-', exEof]         s = intersperse '-' (replicate n 'a') ++ maybeToList c' 
tests/Expr.hs view
@@ -151,7 +151,7 @@ -- representation.  expr :: MonadParsec s m Char => m Node-expr = makeExprParser term table <?> "expression"+expr = makeExprParser term table  term :: MonadParsec s m Char => m Node term = parens expr <|> (Val <$> integer) <?> "term"