summaryrefslogtreecommitdiffhomepage
path: root/src/Parsers.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2014-09-04 01:30:39 +0200
committerjao <jao@gnu.org>2014-09-04 01:30:39 +0200
commitce60a9fcca7c05fee01758bd49b2f9e410693769 (patch)
treef42c5cba87b5c59a943a7f7d35adc9115bf0d6f8 /src/Parsers.hs
parentd99b82d99e310d78b23ee2b09957391e70fca63d (diff)
downloadxmobar-ce60a9fcca7c05fee01758bd49b2f9e410693769.tar.gz
xmobar-ce60a9fcca7c05fee01758bd49b2f9e410693769.tar.bz2
Linting for the multiline config support patch
Diffstat (limited to 'src/Parsers.hs')
-rw-r--r--src/Parsers.hs16
1 files 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)