summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Perner <martin@perner.cc>2011-08-27 13:29:50 +0200
committerMartin Perner <martin@perner.cc>2011-08-27 13:41:45 +0200
commit9f3d337e753826da3f48cc45b664f4a919a67058 (patch)
tree964c3768609be66ce6dae43e72409d7c19c8e15d
parentd17958115fbb80d5baf58830f33390cd21acedac (diff)
downloadxmobar-9f3d337e753826da3f48cc45b664f4a919a67058.tar.gz
xmobar-9f3d337e753826da3f48cc45b664f4a919a67058.tar.bz2
Fix the detection of the end of the command array
It was only looked for a ']' followed by space-characters and either a '}' or ','. This looks good in generally but considering that a command can have as its last input parameter an array e.g. ... , Run Something ["Do"] , Run XMonadLog ] , sepChar = "%" } ... This will not work unless 'Something' is the last command in the array. This patch fixes this problem, as a ',' is only accepted if it is not followed by a "Run".
-rw-r--r--src/Parsers.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Parsers.hs b/src/Parsers.hs
index baaa287..f5f00a9 100644
--- a/src/Parsers.hs
+++ b/src/Parsers.hs
@@ -159,7 +159,8 @@ parseConfig = runParser parseConf fields "Config" . stripComments
return ("Static {" ++ p ++ "}")
tillFieldEnd = staticPos <|> many (noneOf ",}\n\r")
- commandsEnd = wrapSkip (string "]") >> oneOf "},"
+ commandsEnd = wrapSkip (string "]") >> (string "}" <|> notNextRun)
+ notNextRun = do { string ","; notFollowedBy $ wrapSkip $ string "Run"; return ","}
readCommands = manyTill anyChar (try commandsEnd) >>= read' commandsErr . flip (++) "]"
strField e n = field e n . between (strDel "start" n) (strDel "end" n) . many $ noneOf "\"\n\r"