Safe Haskell | None |
---|---|
Language | Haskell98 |
ParserGen.Parser
Description
Based on Data.Attoparsec.Zepto by Bryan O'Sullivan 2011
A tiny, highly specialized combinator parser for ByteString
strings. Designed to split bytestrings into fields with fixed widths.
unsafe versions of the functions do not perform checks that there is enough data left in the bytestring
- data Parser a
- parse :: Parser a -> ByteString -> Either String a
- ensureBytesLeft :: Int -> Parser ()
- atEnd :: Parser Bool
- string :: ByteString -> Parser ()
- anyChar :: Parser Char
- word8 :: Word8 -> Parser ()
- take :: Int -> Parser ByteString
- unsafeTake :: Int -> Parser ByteString
- skip :: Int -> Parser ()
- unsafeSkip :: Int -> Parser ()
- takeWhile :: (Word8 -> Bool) -> Parser ByteString
Documentation
A simple parser.
This monad is strict in its state, and the monadic bind operator
(>>=
) evaluates each result to weak head normal form before
passing it along.
ensureBytesLeft :: Int -> Parser () Source
string :: ByteString -> Parser () Source
Match a string exactly.
take :: Int -> Parser ByteString Source
Consume n
bytes of input.
unsafeTake :: Int -> Parser ByteString Source
Consume n
bytes of input without checking if it's available
unsafeSkip :: Int -> Parser () Source
Skip n
bytes of input without checking if it's available