diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-10-02 13:50:14 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-10-02 13:50:14 +0200 |
commit | 27824d81474ed14810ada11c1baf67ea90242002 (patch) | |
tree | 73257e26a5065a9864b8897e6b4ede19cadb22b1 | |
parent | d5d5844e0767b1060240860a49dd008a5bc732f4 (diff) | |
download | xmobar-27824d81474ed14810ada11c1baf67ea90242002.tar.gz xmobar-27824d81474ed14810ada11c1baf67ea90242002.tar.bz2 |
Updated Parsers to latest changes
darcs-hash:20071002115014-d6583-b02f9e1446f41300f1d8c9266766531f13be15f3.gz
-rw-r--r-- | Parsers.hs | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -43,9 +43,9 @@ formatting template. parseString :: Config -> String -> IO [(String, String)] parseString config s = case (parse (stringParser config) "" s) of - Left _ -> return [("Could not parse string: " ++ s - , (fgColor config))] - Right x -> return x + Left _ -> return [("Could not parse string: " ++ s + , (fgColor config))] + Right x -> return x -- | Gets the string and combines the needed parsers stringParser :: Config -> Parser [(String, String)] @@ -83,9 +83,9 @@ colorSpec = -- | Parses the output template string templateStringParser :: Config -> Parser (String,String,String) templateStringParser c = - do{ s <- many $ noneOf (sepChar c) - ; (com,_,_) <- templateCommandParser c - ; ss <- many $ noneOf (sepChar c) + do{ s <- many $ noneOf (sepChar c) + ; (com,_,_) <- templateCommandParser c + ; ss <- many $ noneOf (sepChar c) ; return (com, s, ss) } @@ -107,10 +107,10 @@ templateParser c = many (templateStringParser c) parseTemplate :: Config -> String -> IO [(Runnable,String,String)] parseTemplate config s = do str <- case (parse (templateParser config) "" s) of - Left _ -> return [("","","")] - Right x -> return x + Left _ -> return [("","","")] + Right x -> return x let comList = map alias (commands config) - m = Map.fromList $ zip comList (commands config) + m = Map.fromList $ zip comList (commands config) return $ combine config m str -- | Given a finite "Map" and a parsed templatet produces the @@ -119,5 +119,5 @@ combine :: Config -> Map.Map String Runnable -> [(String, String, String)] -> [( combine _ _ [] = [] combine config m ((ts,s,ss):xs) = [(com, s, ss)] ++ combine config m xs - where com = Map.findWithDefault dflt ts m - dflt = Run $ Com ts [] [] (refresh config) --"<" ++ ts ++ " not found!>" + where com = Map.findWithDefault dflt ts m + dflt = Run $ Com ts [] [] 10 |