packages feed

versions 3.4.0 → 3.4.0.1

raw patch · 4 files changed

+18/−7 lines, 4 files

Files

CHANGELOG.md view
@@ -1,6 +1,10 @@ Changelog ========= +3.4.0.1+---------+- Enhanced the whitespace handling in `semver'`, `version'`, and `mess'`.+ 3.4.0 ------ - Removed `ParseV` and surrounding machinery.
Data/Versions.hs view
@@ -80,6 +80,7 @@ import           GHC.Generics import           Text.Megaparsec import           Text.Megaparsec.Char+import qualified Text.Megaparsec.Char.Lexer as L  #if __GLASGOW_HASKELL__ < 841 import Data.Semigroup@@ -539,9 +540,12 @@ versioning :: T.Text -> Either ParsingError Versioning versioning = parse versioning' "versioning" --- | Parse a `Versioning`. Assumes that the version number is the last token in the string.+-- | Parse a `Versioning`. Assumes the version number is the last token in+-- the string. versioning' :: Parsec Void T.Text Versioning-versioning' = try (fmap Ideal semver' <* eof) <|> try (fmap General version' <* eof) <|> (fmap Complex mess' <* eof)+versioning' = choice [ try (fmap Ideal semver'    <* eof)+                     , try (fmap General version' <* eof)+                     , fmap Complex mess'         <* eof ]  -- | Parse a (Ideal) Semantic Version. semver :: T.Text -> Either ParsingError SemVer@@ -549,7 +553,7 @@  -- | Internal megaparsec parser of `semver`. semver' :: Parsec Void T.Text SemVer-semver' = SemVer <$> majorP <*> minorP <*> patchP <*> preRel <*> metaData+semver' = L.lexeme space (SemVer <$> majorP <*> minorP <*> patchP <*> preRel <*> metaData)  -- | Parse a group of digits, which can't be lead by a 0, unless it is 0. digitsP :: Parsec Void T.Text Word@@ -596,7 +600,7 @@  -- | Internal megaparsec parser of `version`. version' :: Parsec Void T.Text Version-version' = Version <$> optional (try epochP) <*> chunks <*> preRel+version' = L.lexeme space (Version <$> optional (try epochP) <*> chunks <*> preRel)  epochP :: Parsec Void T.Text Word epochP = read <$> (some digitChar <* char ':')@@ -607,7 +611,7 @@  -- | Internal megaparsec parser of `mess`. mess' :: Parsec Void T.Text Mess-mess' = try node <|> leaf+mess' = L.lexeme space (try node <|> leaf)  leaf :: Parsec Void T.Text Mess leaf = VLeaf <$> tchunks
test/Test.hs view
@@ -118,6 +118,9 @@          $ semver "1.2.3-alpha.2" == semver "1.2.3-alpha.2+a1b2c3.1") :         map (\(a,b) -> testCase (T.unpack $ a <> " < " <> b) $ comp semver a b)         (zip semverOrd $ tail semverOrd)+      , testGroup "Whitespace Handling"+        [ testCase "1.2.3-1[ ]" $ parse semver' "semver whitespace" "1.2.3-1 " @?= Right (SemVer 1 2 3 [[Digits 1]] [])+        ]       ]     , testGroup "(General) Versions"       [ testGroup "Good Versions" $
versions.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: afb8248e886b4197b3f7e3c3eb5132afb1409a8ac97bcf914795a9a3fd2ffdd7+-- hash: 2ae1eaeefbbfa3bff2f7d8525f103438a0cc4a2c5e14f63037e222adabda359a  name:           versions-version:        3.4.0+version:        3.4.0.1 synopsis:       Types and parsers for software version numbers. description:    A library for parsing and comparing software version numbers. We like to give version numbers to our software in a myriad of ways. Some ways follow strict guidelines for incrementing and comparison. Some follow conventional wisdom and are generally self-consistent. Some are just plain asinine. This library provides a means of parsing and comparing /any/ style of versioning, be it a nice Semantic Version like this:                 .