Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
3fca557e
Commit
3fca557e
authored
Jan 15, 2017
by
Oleg Grenrus
Browse files
Add readGenericPackageDescription to ReadP parser
parent
eda30d31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/PackageDescription/Parse.hs
View file @
3fca557e
...
...
@@ -19,6 +19,10 @@
module
Distribution.PackageDescription.Parse
(
-- * Package descriptions
readGenericPackageDescription
,
parseGenericPackageDescription
,
-- ** Deprecated names
readPackageDescription
,
parsePackageDescription
,
...
...
@@ -592,10 +596,14 @@ readHookedBuildInfo :: Verbosity -> FilePath -> IO HookedBuildInfo
readHookedBuildInfo
=
readAndParseFile
withFileContents
parseHookedBuildInfo
-- |Parse the given package file.
readPackageDescription
::
Verbosity
->
FilePath
->
IO
GenericPackageDescription
readPackageDescription
=
readAndParseFile
withUTF8FileContents
parsePackageDescription
readPackageDescription
=
readGenericPackageDescription
{-# DEPRECATED readPackageDescription "Use readGenericPackageDescription, old name is missleading." #-}
-- | Parse the given package file.
readGenericPackageDescription
::
Verbosity
->
FilePath
->
IO
GenericPackageDescription
readGenericPackageDescription
=
readAndParseFile
withUTF8FileContents
parseGenericPackageDescription
stanzas
::
[
Field
]
->
[[
Field
]]
stanzas
[]
=
[]
...
...
@@ -713,12 +721,16 @@ skipField = modify tail
--FIXME: this should take a ByteString, not a String. We have to be able to
-- decode UTF8 and handle the BOM.
parsePackageDescription
::
String
->
ParseResult
GenericPackageDescription
parsePackageDescription
=
parseGenericPackageDescription
{-# DEPRECATED parsePackageDescription "Use parseGenericPackageDescription, old name is missleading" #-}
-- | Parses the given file into a 'GenericPackageDescription'.
--
-- In Cabal 1.2 the syntax for package descriptions was changed to a format
-- with sections and possibly indented property descriptions.
parsePackageDescription
::
String
->
ParseResult
GenericPackageDescription
parsePackageDescription
file
=
do
parse
Generic
PackageDescription
::
String
->
ParseResult
GenericPackageDescription
parse
Generic
PackageDescription
file
=
do
-- This function is quite complex because it needs to be able to parse
-- both pre-Cabal-1.2 and post-Cabal-1.2 files. Additionally, it contains
...
...
Cabal/Distribution/Simple.hs
View file @
3fca557e
...
...
@@ -237,10 +237,8 @@ confPkgDescr hooks verbosity mb_path = do
Just
path
->
return
path
#
ifdef
CABAL_PARSEC
info
verbosity
"Using Parsec parser"
descr
<-
readGenericPackageDescription
verbosity
pdfile
#
else
descr
<-
readPackageDescription
verbosity
pdfile
#
endif
descr
<-
readGenericPackageDescription
verbosity
pdfile
return
(
Just
pdfile
,
descr
)
buildAction
::
UserHooks
->
BuildFlags
->
Args
->
IO
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment