diff options
Diffstat (limited to 'Monitors')
-rw-r--r-- | Monitors/Common.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Monitors/Common.hs b/Monitors/Common.hs index e4c1562..8a51159 100644 --- a/Monitors/Common.hs +++ b/Monitors/Common.hs @@ -30,6 +30,8 @@ module Monitors.Common ( , getNumbers , getNumbersAsString , getAllBut + , getAfterString + , skipTillString , parseTemplate -- ** String Manipulation -- $strings @@ -207,6 +209,16 @@ skipRestOfLine = do many $ noneOf "\n\r" newline +getAfterString :: String -> Parser String +getAfterString s = + do { try $ manyTill skipRestOfLine $ string s + ; v <- manyTill anyChar $ newline + ; return v + } <|> return ("<" ++ s ++ " not found!>") + +skipTillString :: String -> Parser String +skipTillString s = + manyTill skipRestOfLine $ string s -- | Parses the output template string templateStringParser :: Parser (String,String,String) |