aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Reaktor/Parser.hs')
-rw-r--r--src/Reaktor/Parser.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Reaktor/Parser.hs b/src/Reaktor/Parser.hs
index 12d5ace..1b358fc 100644
--- a/src/Reaktor/Parser.hs
+++ b/src/Reaktor/Parser.hs
@@ -1,35 +1,37 @@
{-# LANGUAGE OverloadedStrings #-}
module Reaktor.Parser where
-import Control.Applicative
-import Data.Attoparsec.ByteString.Char8
-import qualified Data.ByteString.Char8.Extended as BS
+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 qualified Data.Char
-import Reaktor.Internal
+import Reaktor.Internal
-prefix :: Parser Prefix
+prefix :: Parser ByteString
prefix = BS.pack <$> many (satisfy Data.Char.isAlphaNum <|>
satisfy (flip elem (":.-@/!~[]\\`_^{|}" :: String)))
-command :: Parser Command
+command :: Parser ByteString
command = BS.pack <$> many1 (satisfy Data.Char.isAlphaNum)
nospcrlfcl :: Parser Char
nospcrlfcl =
satisfy (flip notElem ("\NUL\CR\LF :" :: String)) <?> "nospcrlfcl"
-middle :: Parser Param
+middle :: Parser ByteString
middle =
BS.pack <$> ((:) <$> nospcrlfcl <*> many (char ':' <|> nospcrlfcl))
<?> "middle"
-trailing :: Parser Param
+trailing :: Parser ByteString
trailing =
BS.pack <$> many (char ':' <|> char ' ' <|> nospcrlfcl)
<?> "trailing"
-params :: Parser [Param]
+params :: Parser [ByteString]
params = (do
a <- many (char ' ' *> middle)
b <- optional (char ' ' *> char ':' *> trailing)