diff options
author | tv <tv@krebsco.de> | 2019-01-24 17:22:03 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-24 17:25:19 +0100 |
commit | d5f66b27b2cd7c36eb7c2e81b0cdca10c5a5ef90 (patch) | |
tree | d0da96518550cf181194d1a3f02ef3680454448e /src/Reaktor/Parser.hs | |
parent | a4b7708483dd32bc7256288faefa300d3fc13f7b (diff) |
src: ByteString -> Textv0.1.2
Diffstat (limited to 'src/Reaktor/Parser.hs')
-rw-r--r-- | src/Reaktor/Parser.hs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/Reaktor/Parser.hs b/src/Reaktor/Parser.hs index 1b358fc..f226ad5 100644 --- a/src/Reaktor/Parser.hs +++ b/src/Reaktor/Parser.hs @@ -1,37 +1,36 @@ {-# LANGUAGE OverloadedStrings #-} module Reaktor.Parser where +import Prelude.Extended import Control.Applicative -import Data.ByteString (ByteString) -import Data.Attoparsec.ByteString.Char8 ---import qualified Data.ByteString.Char8.Extended as BS -import qualified Data.ByteString.Char8 as BS +import Data.Attoparsec.Text import qualified Data.Char +import qualified Data.Text.Extended as T import Reaktor.Internal -prefix :: Parser ByteString -prefix = BS.pack <$> many (satisfy Data.Char.isAlphaNum <|> +prefix :: Parser Text +prefix = T.pack <$> many (satisfy Data.Char.isAlphaNum <|> satisfy (flip elem (":.-@/!~[]\\`_^{|}" :: String))) -command :: Parser ByteString -command = BS.pack <$> many1 (satisfy Data.Char.isAlphaNum) +command :: Parser Text +command = T.pack <$> many1 (satisfy Data.Char.isAlphaNum) nospcrlfcl :: Parser Char nospcrlfcl = satisfy (flip notElem ("\NUL\CR\LF :" :: String)) <?> "nospcrlfcl" -middle :: Parser ByteString +middle :: Parser Text middle = - BS.pack <$> ((:) <$> nospcrlfcl <*> many (char ':' <|> nospcrlfcl)) + T.pack <$> ((:) <$> nospcrlfcl <*> many (char ':' <|> nospcrlfcl)) <?> "middle" -trailing :: Parser ByteString +trailing :: Parser Text trailing = - BS.pack <$> many (char ':' <|> char ' ' <|> nospcrlfcl) + T.pack <$> many (char ':' <|> char ' ' <|> nospcrlfcl) <?> "trailing" -params :: Parser [ByteString] +params :: Parser [Text] params = (do a <- many (char ' ' *> middle) b <- optional (char ' ' *> char ':' *> trailing) |