summaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Reaktor/Parser.hs')
-rw-r--r--src/Reaktor/Parser.hs25
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)