Safe Haskell | None |
---|---|
Language | Haskell2010 |
Scanner.Internal
Description
Scanner implementation
Synopsis
- newtype Scanner a = Scanner {}
- type Next a r = ByteString -> a -> Result r
- data Result r
- scan :: Scanner r -> ByteString -> Result r
- anyWord8 :: Scanner Word8
- takeWhile :: (Word8 -> Bool) -> Scanner ByteString
- take :: Int -> Scanner ByteString
- endOfInput :: Scanner Bool
- string :: ByteString -> Scanner ()
- lookAhead :: Scanner (Maybe Word8)
- foldlWhile :: (Word8 -> Bool) -> (a -> Word8 -> a) -> a -> Scanner a
- foldlWhile1 :: (Word8 -> Bool) -> (a -> Word8 -> a) -> a -> Scanner a
- satisfy :: (Word8 -> Bool) -> Scanner Word8
- satisfyMaybe :: (Word8 -> Bool) -> Scanner (Maybe Word8)
- decimal :: Integral n => Scanner n
Documentation
CPS scanner without backtracking
Scanner result
endOfInput :: Scanner Bool Source #
Returns True
when there is no more input
string :: ByteString -> Scanner () Source #
Consume the specified string
Warning: it is not optimized yet, so for for small string it is better
to consume it byte-by-byte using word8
foldlWhile :: (Word8 -> Bool) -> (a -> Word8 -> a) -> a -> Scanner a Source #
Fold over the octets, which satisfy the predicate
foldlWhile1 :: (Word8 -> Bool) -> (a -> Word8 -> a) -> a -> Scanner a Source #
Fold over the octets, which satisfy the predicate, ensuring that there's at least one
satisfy :: (Word8 -> Bool) -> Scanner Word8 Source #
Consume a single octet which satisfies the predicate and fail if it does not
satisfyMaybe :: (Word8 -> Bool) -> Scanner (Maybe Word8) Source #
Consume a single octet in case it satisfies the predicate