CPS scanner without backtracking
Modulescanner-0.3.2Haskell2010
Scanner
Fast not-backtracking incremental scanner for bytestrings
Unlike attoparsec or most of other parser combinator libraries, scanner doesn't support backtracking. But you probably don't need it anyway, at least if you need fast parser.
Scanner processes input incrementally. When more input is needed, scanner returns More continuation. All the already processed input is discarded.
Synopsis
- newtype Scanner
- data Result
- value scan
- value scanOnly
- value scanLazy
- value scanWith
- value anyWord8
- value anyChar8
- value word8
- value char8
- value take
- value takeWhile
- value takeWhileChar8
- value string
- value skipWhile
- value skipSpace
- value lookAhead
- value lookAheadChar8
- value foldlWhile
- value foldlWhile1
- value satisfy
- value satisfyMaybe
- value decimal
- Packagescanner-0.3.2
- Exports23
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceScanner.hs
Scanner result
Constructors
Done ByteString rSuccessful result with the rest of input
Fail ByteString StringScanner failed with rest of input and error message
More (ByteString -> Result r)Need more input
Run scanner with the input
Scan the complete input, without resupplying
Scan lazy bytestring by resupplying scanner with chunks
Scan with the provided resupply action
Consume the next word
It fails if end of input
Consume the next 8-bit char
It fails if end of input
Consume the specified word or fail
Consume the specified 8-bit char or fail
Take the specified number of bytes
Take input while the predicate is True
Take input while the predicate is True
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
Skip any input while the preducate is True
Skip space
Return the next byte, if any, without consuming it
Return the next byte, if any, without consuming it
Fold over the octets, which satisfy the predicate
Fold over the octets, which satisfy the predicate, ensuring that there's at least one
Consume a single octet which satisfies the predicate and fail if it does not
Consume a single octet in case it satisfies the predicate
Parse a non-negative decimal number in ASCII