package comby-kernel

  1. Overview
  2. Docs
A match engine for structural code search and replace that supports ~every language

Install

Dune Dependency

Authors

Maintainers

Sources

comby-kernel.1.7.0.tar.gz
md5=ee6556d8bd9b25ed0445ebe23862e48a
sha512=e6386c8ce5ef14bbcab2b0ead5b1edc39375438f56330d5f02e81e467afe6623a7e299f97f26008d77bbc62850c6dc63a7cbe5b81671b5183ff3adeee5946bb3

doc/comby-kernel.vangstrom/Vangstrom/Unbuffered/index.html

Module Vangstrom.UnbufferedSource

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.

Sourcetype more =
  1. | Complete
  2. | Incomplete
Sourcetype 'a state =
  1. | Partial of 'a partial
    (*

    The parser requires more input.

    *)
  2. | Done of int * 'a
    (*

    The parser succeeded, consuming specified bytes.

    *)
  3. | Fail of int * string list * string
    (*

    The parser failed, consuming specified bytes.

    *)
Sourceand 'a partial = {
  1. 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.

    *)
  2. 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.

    *)
}
Sourceval parse : 'a t -> 'a state

parse t runs t and await input if needed.

Sourceval state_to_option : 'a state -> 'a option

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.

Sourceval state_to_result : 'a state -> ('a, string) result

state_to_result state returns Ok v if the parser is in the Done (bs, v) state and Error msg if it is in the Fail or Partial state.

This function has no effect on the current state of the parser.

OCaml

Innovation. Community. Security.