pnm- PNM image format header parsing and pretty printing

Safe HaskellSafe-Infered



Lower-level functions for parsing PNM image format headers. Most users shouldn't need to import this module directly.



data Parse p Source

The result of parsing.


Eq p => Eq (Parse p) 
Ord p => Ord (Parse p) 
Show p => Show (Parse p) 

rawChar :: ByteString -> Parse Word8Source

The next character.

char :: ByteString -> Parse Word8Source

The next non-comment character. Comments can occur in the middle of what might be considered tokens.

dropWhile :: (Word8 -> Bool) -> (ByteString -> Parse Word8) -> ByteString -> Parse ()Source

Drop input while a predicate holds.

takeUntil :: (Word8 -> Bool) -> (ByteString -> Parse Word8) -> ByteString -> Parse ByteStringSource

Take input until a predicate holds.

token :: ByteString -> Parse ByteStringSource

Parse a token.

string :: ByteString -> ByteString -> Parse ()Source

Parse a fixed string.

number :: ByteString -> Parse IntegerSource

Parse a positive decimal number.

decimal :: ByteString -> Maybe IntegerSource

Number conversion.

oneSpace :: ByteString -> Parse ()Source

Parse a single space.

str :: String -> ByteStringSource

Convert from a string. Crashes hard on non-ASCII input.

ht, space, cr, ff, vt, lf :: Word8Source

White space characters.

hash :: Word8Source

Comment start character.

d0, d9, d8, d7, d6, d5, d4, d3, d2, d1 :: Word8Source

Decimal digit characters.