keyword-args 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+18/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- keyword-args.cabal +1/−1
- src/Data/KeywordArgs/Parse.hs +17/−7
keyword-args.cabal view
@@ -1,5 +1,5 @@ name: keyword-args-version: 0.1.0.3+version: 0.1.0.4 synopsis: Extract data from a keyword-args config file format description: Extracts data from a configuration file with keywords
src/Data/KeywordArgs/Parse.hs view
@@ -26,22 +26,32 @@ manyTill1 :: GenParser tok st a -> GenParser tok st end -> GenParser tok st [a] manyTill1 p end = liftM2 (:) p (manyTill p end) +isValidKeyChar :: Char -> Bool+isValidKeyChar c = c /= '#' && (not . isSpace) c+++isValidValueChar :: Char -> Bool+isValidValueChar c = c /= '#'++ configurationOption :: Parser (String, String) configurationOption = do many space - option <- many1 (satisfy (not . isSpace))-- many1 space+ keyword <- manyTill1 (satisfy isValidKeyChar) (many1 (char ' ')) let- endOfOption = comment <|> endOfLineOrInput- quotedValue = char '"' *> manyTill anyChar (try (char '"')) <* endOfOption- unquotedValue = manyTill1 anyChar endOfOption+ endOfOption = endOfLineOrInput <|> comment + quotedValue = char '"' *>+ manyTill1 (satisfy isValidValueChar) (try (char '"')) <*+ endOfOption++ unquotedValue = manyTill1 (satisfy isValidValueChar) endOfOption+ value <- quotedValue <|> unquotedValue - return (option, value)+ return (keyword, value) comment :: Parser () comment =