From ce60a9fcca7c05fee01758bd49b2f9e410693769 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 4 Sep 2014 01:30:39 +0200 Subject: Linting for the multiline config support patch --- src/Parsers.hs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Parsers.hs b/src/Parsers.hs index b4a2d59..f7be1e3 100644 --- a/src/Parsers.hs +++ b/src/Parsers.hs @@ -25,7 +25,7 @@ import Runnable import Commands import Actions -import Control.Monad (guard, mzero) +import Control.Monad (guard, mzero, liftM) import qualified Data.Map as Map import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Perm @@ -248,21 +248,15 @@ parseConfig = runParser parseConf fields "Config" . stripComments strField e n = field e n strMulti - strMulti = do - scan '"' + strMulti = scan '"' where scan lead = do spaces char lead s <- manyTill anyChar (rowCont <|> unescQuote) - ( char '"' >> return s ) - <|> ( scan '\\' >>= return . (s ++) ) - rowCont = try $ (char '\\') >> (string "\n") - unescQuote = (lookAhead $ noneOf "\\") >> (lookAhead $ string "\"") - - strDel t n = char '"' strErr t n - strErr t n = "the " ++ t ++ " of the string field " ++ n ++ - " - a double quote (\")." + (char '"' >> return s) <|> liftM (s ++) (scan '\\') + rowCont = try $ char '\\' >> string "\n" + unescQuote = lookAhead (noneOf "\\") >> lookAhead (string "\"") wrapSkip x = many space >> x >>= \r -> many space >> return r sepEndSpc = mapM_ (wrapSkip . try . string) -- cgit v1.2.3