Commit bba80735 authored by nominolo@gmail.com's avatar nominolo@gmail.com
Browse files

Allow lower-case spellings for boolean fields.

parent 39c03860
...@@ -182,7 +182,7 @@ executableFieldDescrs = ...@@ -182,7 +182,7 @@ executableFieldDescrs =
binfoFieldDescrs :: [FieldDescr BuildInfo] binfoFieldDescrs :: [FieldDescr BuildInfo]
binfoFieldDescrs = binfoFieldDescrs =
[ simpleField "buildable" [ simpleField "buildable"
(text . show) parseReadS (text . show) parseBool
buildable (\val binfo -> binfo{buildable=val}) buildable (\val binfo -> binfo{buildable=val})
, commaListField "build-tools" , commaListField "build-tools"
showDependency parseBuildTool showDependency parseBuildTool
...@@ -253,7 +253,7 @@ flagFieldDescrs = ...@@ -253,7 +253,7 @@ flagFieldDescrs =
showFreeText (munch (const True)) showFreeText (munch (const True))
flagDescription (\val fl -> fl{ flagDescription = val }) flagDescription (\val fl -> fl{ flagDescription = val })
, simpleField "default" , simpleField "default"
(text . show) parseReadS (text . show) parseBool
flagDefault (\val fl -> fl{ flagDefault = val }) flagDefault (\val fl -> fl{ flagDefault = val })
] ]
......
...@@ -59,7 +59,7 @@ module Distribution.ParseUtils ( ...@@ -59,7 +59,7 @@ module Distribution.ParseUtils (
parseSepList, parseCommaList, parseOptCommaList, parseSepList, parseCommaList, parseOptCommaList,
showFilePath, showToken, showTestedWith, showDependency, showFreeText, showFilePath, showToken, showTestedWith, showDependency, showFreeText,
field, simpleField, listField, commaListField, optsField, liftField, field, simpleField, listField, commaListField, optsField, liftField,
parseReadS, parseReadSQ, parseQuoted, parseReadS, parseReadSQ, parseQuoted, parseBool
) where ) where
import Distribution.Compiler (CompilerFlavor) import Distribution.Compiler (CompilerFlavor)
...@@ -477,6 +477,10 @@ parseFilePathQ = parseTokenQ ...@@ -477,6 +477,10 @@ parseFilePathQ = parseTokenQ
parseReadS :: Read a => ReadP r a parseReadS :: Read a => ReadP r a
parseReadS = readS_to_P reads parseReadS = readS_to_P reads
parseBool :: ReadP r Bool
parseBool = choice [ (string "true" <++ string "True") >> return True
, (string "false" <++ string "False") >> return False ]
parseBuildTool :: ReadP r Dependency parseBuildTool :: ReadP r Dependency
parseBuildTool = do name <- parseBuildToolNameQ parseBuildTool = do name <- parseBuildToolNameQ
skipSpaces skipSpaces
......
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