Commit fba225cb authored by John Ericson's avatar John Ericson Committed by Edward Z. Yang
Browse files

Disallow parsing quoted versions with old parser (#4066)

@phadej says no code on Hackage uses this, and the new parser
already disallows it.
parent 453aa45a
......@@ -28,7 +28,7 @@ module Distribution.ParseUtils (
parseFields, parseFieldsFlat,
parseFilePathQ, parseTokenQ, parseTokenQ',
parseModuleNameQ, parseBuildTool, parsePkgconfigDependency,
parseOptVersion, parsePackageNameQ, parseVersionRangeQ,
parseOptVersion, parsePackageNameQ,
parseTestedWithQ, parseLicenseQ, parseLanguageQ, parseExtensionQ,
parseSepList, parseCommaList, parseOptCommaList,
showFilePath, showToken, showTestedWith, showFreeText, parseFreeText,
......@@ -627,7 +627,7 @@ betweenSpaces act = do skipSpaces
parseBuildTool :: ReadP r Dependency
parseBuildTool = do name <- parseBuildToolNameQ
ver <- betweenSpaces $
parseVersionRangeQ <++ return anyVersion
parse <++ return anyVersion
return $ Dependency name ver
parseBuildToolNameQ :: ReadP r PackageName
......@@ -648,15 +648,12 @@ parsePkgconfigDependency :: ReadP r Dependency
parsePkgconfigDependency = do name <- munch1
(\c -> isAlphaNum c || c `elem` "+-._")
ver <- betweenSpaces $
parseVersionRangeQ <++ return anyVersion
parse <++ return anyVersion
return $ Dependency (mkPackageName name) ver
parsePackageNameQ :: ReadP r PackageName
parsePackageNameQ = parseQuoted parse <++ parse
parseVersionRangeQ :: ReadP r VersionRange
parseVersionRangeQ = parseQuoted parse <++ parse
parseOptVersion :: ReadP r Version
parseOptVersion = parseQuoted ver <++ ver
where ver :: ReadP r Version
......
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