package comby-kernel
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ee6556d8bd9b25ed0445ebe23862e48a
sha512=e6386c8ce5ef14bbcab2b0ead5b1edc39375438f56330d5f02e81e467afe6623a7e299f97f26008d77bbc62850c6dc63a7cbe5b81671b5183ff3adeee5946bb3
doc/comby-kernel.vangstrom/Vangstrom/Unbuffered/index.html
Module Vangstrom.Unbuffered
Source
Unbuffered parsing interface.
Use this module for total control over memory allocation and copying. Parsers run through this module perform no internal buffering. Instead, the user is responsible for managing a buffer containing the entirety of the input that has yet to be consumed by the parser. The Unbuffered.state.Partial
parser state reports to the user how much input the parser consumed during its last run, via the Unbuffered.partial.committed
field. This area of input must be discarded before parsing can resume. Once additional input has been collected, the unconsumed input as well as new input must be passed to the parser state via the Unbuffered.partial.continue
function, together with an indication of whether there is Unbuffered.more
input to come.
The logic that must be implemented in order to make proper use of this module is intricate and tied to your OS environment. It's advisable to use the Buffered
module when initially developing and testing your parsers. For production use-cases, consider the Async and Lwt support that this library includes before attempting to use this module directly.
and 'a partial = {
committed : int;
(*The number of bytes committed during the last input feeding. Callers must drop this number of bytes from the beginning of the input on subsequent calls. See
*)commit
for additional details.continue : bigstring -> off:int -> len:int -> more -> 'a state;
(*A continuation of a parse that requires additional input. The input should include all uncommitted input (as reported by previous partial states) in addition to any new input that has become available, as well as an indication of whether there is
*)more
input to come.
}
state_to_option state
returns Some v
if the parser is in the Done (bs, v)
state and None
otherwise. This function has no effect on the current state of the parser.