diff options
author | Alexander Polakov <plhk@sdf.org> | 2013-03-13 21:01:15 +0400 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-03-13 21:11:47 +0100 |
commit | 97cf495c40c2b28aa292014b35161641c42d71b3 (patch) | |
tree | 4735596d441adcf534afbc1163fa946eb00d3b1d | |
parent | 69a251e1e7a1f198b3bf713a28955c676029aa1f (diff) | |
download | xmobar-97cf495c40c2b28aa292014b35161641c42d71b3.tar.gz xmobar-97cf495c40c2b28aa292014b35161641c42d71b3.tar.bz2 |
Shorter lines
-rw-r--r-- | src/Parsers.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Parsers.hs b/src/Parsers.hs index f3b0a2e..9faacb9 100644 --- a/src/Parsers.hs +++ b/src/Parsers.hs @@ -42,7 +42,8 @@ parseString c s = -- | Gets the string and combines the needed parsers stringParser :: String -> Maybe Action -> Parser [[(Widget, ColorString, Maybe Action)]] -stringParser c a = manyTill (textParser c a <|> try (iconParser c a) <|> try (actionParser c) <|> colorParser a) eof +stringParser c a = manyTill (textParser c a <|> try (iconParser c a) <|> + try (actionParser c) <|> colorParser a) eof -- | Parses a maximal string without color markup. textParser :: String -> Maybe Action -> Parser [(Widget, ColorString, Maybe Action)] @@ -74,14 +75,16 @@ actionParser :: String -> Parser [(Widget, ColorString, Maybe Action)] actionParser c = do a <- between (string "<action=") (string ">") (many1 (noneOf ">")) let a' = Just (Spawn a) - s <- manyTill (try (textParser c a') <|> try (iconParser c a') <|> try (colorParser a') <|> actionParser c) (try $ string "</action>") + s <- manyTill (try (textParser c a') <|> try (iconParser c a') <|> + try (colorParser a') <|> actionParser c) (try $ string "</action>") return (concat s) -- | Parsers a string wrapped in a color specification. colorParser :: Maybe Action -> Parser [(Widget, ColorString, Maybe Action)] colorParser a = do c <- between (string "<fc=") (string ">") colors - s <- manyTill (try (textParser c a) <|> try (iconParser c a) <|> try (colorParser a) <|> actionParser c) (try $ string "</fc>") + s <- manyTill (try (textParser c a) <|> try (iconParser c a) <|> + try (colorParser a) <|> actionParser c) (try $ string "</fc>") return (concat s) -- | Parses a color specification (hex or named) |