module Text.Playlist.Internal.Attoparsec
( isEOL
, isEq
, skipEq
, skipSpace
, skipLine
) where
import Data.Attoparsec.ByteString
import Data.Word (Word8)
import Data.Word8 (isSpace)
isEOL :: Word8 -> Bool
isEOL :: Word8 -> Bool
isEOL Word8
x = Word8
x Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
10 Bool -> Bool -> Bool
|| Word8
x Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
13
isEq :: Word8 -> Bool
isEq :: Word8 -> Bool
isEq = (Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
== Word8
61)
skipEq :: Parser ()
skipEq :: Parser ()
skipEq = Parser ()
skipSpace Parser () -> Parser () -> Parser ()
forall a b.
Parser ByteString a -> Parser ByteString b -> Parser ByteString b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (Word8 -> Bool) -> Parser ()
skip Word8 -> Bool
isEq Parser () -> Parser () -> Parser ()
forall a b.
Parser ByteString a -> Parser ByteString b -> Parser ByteString b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Parser ()
skipSpace
skipSpace :: Parser ()
skipSpace :: Parser ()
skipSpace = (Word8 -> Bool) -> Parser ()
skipWhile Word8 -> Bool
isSpace
skipLine :: Parser ()
skipLine :: Parser ()
skipLine = (Word8 -> Bool) -> Parser ()
skipWhile (Bool -> Bool
not (Bool -> Bool) -> (Word8 -> Bool) -> Word8 -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word8 -> Bool
isEOL) Parser () -> Parser () -> Parser ()
forall a b.
Parser ByteString a -> Parser ByteString b -> Parser ByteString b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Parser ()
skipSpace