diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2010-02-12 14:23:09 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2010-02-12 14:23:09 +0100 |
commit | 796d67c238deaa23fcc08d116d16193c8c6e014f (patch) | |
tree | 423c8175606ad6d24522c9800eb711394a4d3646 | |
parent | ade76da78cae90f11a00b229718c765b339ab0cb (diff) | |
download | xmobar-de3987aee79ba8b54fb493e160c0359238a9111c.tar.gz xmobar-de3987aee79ba8b54fb493e160c0359238a9111c.tar.bz2 |
correctly parse static position in config0.10
Ignore-this: c998e16a07bc65f0543ab26c5b155cb5e2b8f536
darcs-hash:20100212132309-d6583-a388b6542ece14051c94b76f8e0b821fef51ee18.gz
-rw-r--r-- | Parsers.hs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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" ++ |