Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
e821200c
Commit
e821200c
authored
8 years ago
by
John Ericson
Browse files
Options
Downloads
Patches
Plain Diff
Steal `parseMaybeQuoted` helper for legacy parser
parent
acc460dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cabal/Distribution/ParseUtils.hs
+12
-8
12 additions, 8 deletions
Cabal/Distribution/ParseUtils.hs
with
12 additions
and
8 deletions
Cabal/Distribution/ParseUtils.hs
+
12
−
8
View file @
e821200c
...
...
@@ -19,6 +19,7 @@
-- This module is meant to be local-only to Distribution...
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE Rank2Types #-}
module
Distribution.ParseUtils
(
LineNo
,
PError
(
..
),
PWarning
(
..
),
locatedErrorMsg
,
syntaxError
,
warning
,
runP
,
runE
,
ParseResult
(
..
),
catchParseError
,
parseFail
,
showPWarning
,
...
...
@@ -611,7 +612,7 @@ ifelse (f:fs) = do fs' <- ifelse fs
-- |parse a module name
parseModuleNameQ
::
ReadP
r
ModuleName
parseModuleNameQ
=
parseQuoted
parse
<++
parse
parseModuleNameQ
=
parse
Maybe
Quoted
parse
parseFilePathQ
::
ReadP
r
FilePath
parseFilePathQ
=
parseTokenQ
...
...
@@ -631,7 +632,7 @@ parseBuildTool = do name <- parseBuildToolNameQ
return
$
Dependency
name
ver
parseBuildToolNameQ
::
ReadP
r
PackageName
parseBuildToolNameQ
=
parseQuoted
parseBuildToolName
<++
parseBuildToolName
parseBuildToolNameQ
=
parse
Maybe
Quoted
parseBuildToolName
-- like parsePackageName but accepts symbols in components
parseBuildToolName
::
ReadP
r
PackageName
...
...
@@ -652,15 +653,15 @@ parsePkgconfigDependency = do name <- munch1
return
$
Dependency
(
mkPackageName
name
)
ver
parsePackageNameQ
::
ReadP
r
PackageName
parsePackageNameQ
=
parseQuoted
parse
<++
parse
parsePackageNameQ
=
parse
Maybe
Quoted
parse
parseOptVersion
::
ReadP
r
Version
parseOptVersion
=
parseQuoted
ver
<++
ver
parseOptVersion
=
parse
Maybe
Quoted
ver
where
ver
::
ReadP
r
Version
ver
=
parse
<++
return
nullVersion
parseTestedWithQ
::
ReadP
r
(
CompilerFlavor
,
VersionRange
)
parseTestedWithQ
=
parseQuoted
tw
<++
tw
parseTestedWithQ
=
parse
Maybe
Quoted
tw
where
tw
::
ReadP
r
(
CompilerFlavor
,
VersionRange
)
tw
=
do
compiler
<-
parseCompilerFlavorCompat
...
...
@@ -668,7 +669,7 @@ parseTestedWithQ = parseQuoted tw <++ tw
return
(
compiler
,
version
)
parseLicenseQ
::
ReadP
r
License
parseLicenseQ
=
parseQuoted
parse
<++
parse
parseLicenseQ
=
parse
Maybe
Quoted
parse
-- urgh, we can't define optQuotes :: ReadP r a -> ReadP r a
-- because the "compat" version of ReadP isn't quite powerful enough. In
...
...
@@ -676,10 +677,10 @@ parseLicenseQ = parseQuoted parse <++ parse
-- Hence the trick above to make 'lic' polymorphic.
parseLanguageQ
::
ReadP
r
Language
parseLanguageQ
=
parseQuoted
parse
<++
parse
parseLanguageQ
=
parse
Maybe
Quoted
parse
parseExtensionQ
::
ReadP
r
Extension
parseExtensionQ
=
parseQuoted
parse
<++
parse
parseExtensionQ
=
parse
Maybe
Quoted
parse
parseHaskellString
::
ReadP
r
String
parseHaskellString
=
readS_to_P
reads
...
...
@@ -711,5 +712,8 @@ parseOptCommaList = parseSepList (optional (ReadP.char ','))
parseQuoted
::
ReadP
r
a
->
ReadP
r
a
parseQuoted
=
between
(
ReadP
.
char
'"'
)
(
ReadP
.
char
'"'
)
parseMaybeQuoted
::
(
forall
r
.
ReadP
r
a
)
->
ReadP
r'
a
parseMaybeQuoted
p
=
parseQuoted
p
<++
p
parseFreeText
::
ReadP
.
ReadP
s
String
parseFreeText
=
ReadP
.
munch
(
const
True
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment