parsergen-0.2.0.2: TH parser generator for splitting bytestring into fixed-width fields

Safe HaskellSafe-Infered

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

Synopsis

Documentation

data Parser a Source

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.

parse :: Parser a -> ByteString -> Either String aSource

Run a parser.

atEnd :: Parser BoolSource

Indicate whether the end of the input has been reached.

string :: ByteString -> Parser ()Source

Match a string exactly.

take :: Int -> Parser ByteStringSource

Consume n bytes of input.

unsafeTake :: Int -> Parser ByteStringSource

Consume n bytes of input without checking if it's available

skip :: Int -> Parser ()Source

Skip n bytes of input

unsafeSkip :: Int -> Parser ()Source

Skip n bytes of input without checking if it's available

takeWhile :: (Word8 -> Bool) -> Parser ByteStringSource

Consume input while the predicate returns True.