summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2010-02-12 14:23:09 +0100
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2010-02-12 14:23:09 +0100
commit796d67c238deaa23fcc08d116d16193c8c6e014f (patch)
tree423c8175606ad6d24522c9800eb711394a4d3646
parentade76da78cae90f11a00b229718c765b339ab0cb (diff)
downloadxmobar-796d67c238deaa23fcc08d116d16193c8c6e014f.tar.gz
xmobar-796d67c238deaa23fcc08d116d16193c8c6e014f.tar.bz2
correctly parse static position in config0.10
Ignore-this: c998e16a07bc65f0543ab26c5b155cb5e2b8f536 darcs-hash:20100212132309-d6583-a388b6542ece14051c94b76f8e0b821fef51ee18.gz
-rw-r--r--Parsers.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Parsers.hs b/Parsers.hs
index b969c8b..88b25f1 100644
--- a/Parsers.hs
+++ b/Parsers.hs
@@ -147,7 +147,14 @@ parseConfig = runParser parseConf fields "Config" . stripComments
pLowerOnStart = field lowerOnStart "lowerOnStart" $ tillFieldEnd >>= read' "lowerOnStart"
pCommands = field commands "commands" $ readCommands
- tillFieldEnd = many $ noneOf ",}\n\r"
+ staticPos = do string "Static"
+ wrapSkip (string "{")
+ p <- many (noneOf "}")
+ wrapSkip (string "}")
+ string ","
+ return ("Static {" ++ p ++ "}")
+ tillFieldEnd = staticPos <|> many (noneOf ",}\n\r")
+
commandsEnd = wrapSkip (string "]") >> oneOf "},"
readCommands = manyTill anyChar (try commandsEnd) >>= read' commandsErr . flip (++) "]"
@@ -164,7 +171,7 @@ parseConfig = runParser parseConf fields "Config" . stripComments
read' d s = case reads s of
[(x, _)] -> return x
- _ -> fail $ "error reading field: " ++ d
+ _ -> fail $ "error reading the " ++ d ++ " field: " ++ s
commandsErr :: String
commandsErr = "commands: this usually means that a command could not be parsed.\n" ++