Commit b8ce8c99 authored by quasicomputational's avatar quasicomputational
Browse files

Allow 2.4-spec files to be parsed.

Lexically, they're identical to 2.2, but the semantics of globs have
changed slightly.
parent c718a22f
......@@ -16,6 +16,7 @@ data CabalSpecVersion
| CabalSpecV1_24
| CabalSpecV2_0
| CabalSpecV2_2
| CabalSpecV2_4
deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic)
cabalSpecLatest :: CabalSpecVersion
......@@ -30,20 +31,27 @@ cabalSpecFeatures CabalSpecV2_2 = Set.fromList
[ Elif
, CommonStanzas
]
cabalSpecFeatures CabalSpecV2_4 = Set.fromList
[ Elif
, CommonStanzas
]
cabalSpecSupports :: CabalSpecVersion -> [Int] -> Bool
cabalSpecSupports CabalSpecOld v = v < [1,21]
cabalSpecSupports CabalSpecV1_22 v = v < [1,23]
cabalSpecSupports CabalSpecV1_24 v = v < [1,25]
cabalSpecSupports CabalSpecV2_0 v = v < [2,1]
cabalSpecSupports CabalSpecV2_2 _ = True
cabalSpecSupports CabalSpecV2_2 v = v < [2,3]
cabalSpecSupports CabalSpecV2_4 _ = True
specHasCommonStanzas :: CabalSpecVersion -> HasCommonStanzas
specHasCommonStanzas CabalSpecV2_2 = HasCommonStanzas
specHasCommonStanzas CabalSpecV2_4 = HasCommonStanzas
specHasCommonStanzas _ = NoCommonStanzas
specHasElif :: CabalSpecVersion -> HasElif
specHasElif CabalSpecV2_2 = HasElif
specHasElif CabalSpecV2_4 = HasElif
specHasElif _ = NoElif
-------------------------------------------------------------------------------
......
......@@ -125,7 +125,7 @@ parseGenericPackageDescription bs = do
setCabalSpecVersion ver
-- if we get too new version, fail right away
case ver of
Just v | v > mkVersion [2,2] -> parseFailure zeroPos
Just v | v > mkVersion [2,4] -> parseFailure zeroPos
"Unsupported cabal-version. See https://github.com/haskell/cabal/issues/4899."
_ -> pure ()
......@@ -200,6 +200,7 @@ parseGenericPackageDescription' cabalVerM lexWarnings utf8WarnPos fs = do
return v
let specVer
| cabalVer >= mkVersion [2,3] = CabalSpecV2_4
| cabalVer >= mkVersion [2,1] = CabalSpecV2_2
| cabalVer >= mkVersion [1,25] = CabalSpecV2_0
| cabalVer >= mkVersion [1,23] = CabalSpecV1_24
......
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