keyword-args 0.1.0.2 → 0.1.0.3
raw patch · 3 files changed
+9/−4 lines, 3 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 +7/−1
- src/Main.hs +1/−2
keyword-args.cabal view
@@ -1,5 +1,5 @@ name: keyword-args-version: 0.1.0.2+version: 0.1.0.3 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
@@ -6,9 +6,12 @@ import Text.Parsec ((<|>), many, try, manyTill, char, anyChar, many1, satisfy) import Text.Parsec.String (Parser) +import Text.ParserCombinators.Parsec.Prim hiding (try) import Text.ParserCombinators.Parsec.Char (string, space, tab, newline, alphaNum) +import Control.Monad (liftM2)+ import Text.Parsec.Combinator (eof) import Control.Applicative ((<*), (*>), (<$>))@@ -20,6 +23,9 @@ configParser = catMaybes <$> many line +manyTill1 :: GenParser tok st a -> GenParser tok st end -> GenParser tok st [a]+manyTill1 p end = liftM2 (:) p (manyTill p end)+ configurationOption :: Parser (String, String) configurationOption = do many space@@ -31,7 +37,7 @@ let endOfOption = comment <|> endOfLineOrInput quotedValue = char '"' *> manyTill anyChar (try (char '"')) <* endOfOption- unquotedValue = manyTill anyChar endOfOption+ unquotedValue = manyTill1 anyChar endOfOption value <- quotedValue <|> unquotedValue
src/Main.hs view
@@ -67,8 +67,7 @@ f <- getContents case parseConfig f of- Left e -> do- ioError $ userError $ "Parse error: " ++ show e+ Left e -> ioError $ userError $ "Parse error: " ++ show e Right config -> putStr $ unpack $ encode config