Safe Haskell | None |
---|
This module exports some useful Proxy
s that act upon
ParserStatus
values received from downstream.
- skipMalformedChunks :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m r
- retryLeftovers :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m r
- throwParsingErrors :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> EitherP BadInput p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m r
- limitInputLength :: (Monad m, Proxy p, AttoparsecInput a) => Int -> ParserStatus a -> EitherP BadInput p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m r
Documentation
skipMalformedChunks :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m rSource
If a downstream parsing Proxy
reports a parser failure, skip the
whole input chunk being processed, including any left-overs, and
start processing new input as soon as it's available.
Useful when the input found in a single
is
supposed to be well-formed, so it can be safely skipped if it is not.
ParserSupply
a
retryLeftovers :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m rSource
If a downstream parsing Proxy
reports a parsing failure, then
keep retrying with any left-over input, skipping individual bits each
time. If there are no left-overs, then more input is requestsd form
upstream.
throwParsingErrors :: (Monad m, Proxy p, AttoparsecInput a) => ParserStatus a -> EitherP BadInput p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m rSource
If a downstream parsing Proxy
reports a parser failure, then
throw a MalformedInput
error in the EitherP
proxy transformer.
limitInputLength :: (Monad m, Proxy p, AttoparsecInput a) => Int -> ParserStatus a -> EitherP BadInput p (ParserStatus a) (ParserSupply a) (ParserStatus a) (ParserSupply a) m rSource
If a downstream parsing Proxy
doesn't produce a value after
having consumed input of at least the given length, then throw an
InputTooLong
error in the EitherP
proxy transformer.