Commit dd9d7703 authored by md9ms's avatar md9ms
Browse files

Move the responsibility for parsing AnyVersion to Dist.Package

parent 625d1b4c
......@@ -256,8 +256,7 @@ parseLicense = anyOf [string s>>return l | (s,l) <- licenses]
parseDependency :: GenParser Char st Dependency
parseDependency = do name <- many1 (letter <|> digit <|> oneOf "-_")
skipMany parseWhite
ver <- parseVersionRange -- XXX Ugly ugly fix, this will
<|> return AnyVersion -- XXX probably break something
ver <- parseVersionRange <|> return AnyVersion
skipMany parseWhite
return $ Dependency name ver
<?> "parseDependency"
......
......@@ -195,7 +195,7 @@ word = many1 letter <?> "word"
-- -----------------------------------------------------------
parseVersionRange :: GenParser Char st VersionRange
parseVersionRange = try (do reservedOp "<"
parseVersionRange = (do reservedOp "<"
v <- parseVersion
return $ EarlierVersion v)
<|> (do reservedOp ">"
......@@ -210,9 +210,6 @@ parseVersionRange = try (do reservedOp "<"
<|> (do reservedOp "=="
v <- parseVersion
return $ ThisVersion v)
<|> (do reservedOp "-"
reserved "any"
return $ AnyVersion)
-- -----------------------------------------------------------
......@@ -381,13 +378,6 @@ hunitTests
"released version 3" ~: "failed"
~: (Right $ release3) ~=? doVersionParse "1.2.3",
-- Version ranges
"Any version" ~: "failed"
~: (Right $ AnyVersion)
~=? doVersionRangeParse "-any",
"Any version space" ~: "failed"
~: (Right $ AnyVersion)
~=? doVersionRangeParse "- any",
"range comparison LaterVersion 1" ~: "failed"
~: True
~=? release3 `withinRange` (LaterVersion release2),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment