From 27824d81474ed14810ada11c1baf67ea90242002 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 2 Oct 2007 13:50:14 +0200 Subject: Updated Parsers to latest changes darcs-hash:20071002115014-d6583-b02f9e1446f41300f1d8c9266766531f13be15f3.gz --- Parsers.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Parsers.hs b/Parsers.hs index c7b0600..a236368 100644 --- a/Parsers.hs +++ b/Parsers.hs @@ -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 -- cgit v1.2.3