From d5f66b27b2cd7c36eb7c2e81b0cdca10c5a5ef90 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 24 Jan 2019 17:22:03 +0100 Subject: src: ByteString -> Text --- src/Reaktor/Parser.hs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/Reaktor/Parser.hs') 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) -- cgit v1.2.3