package patience_diff

  1. Overview
  2. Docs

Module Patience_diff.HunkSource

In diff terms, a hunk is a unit of consecutive ranges with some Same context before and after Next, Prev, and Replace ranges. Each hunk contains information about the original arrays, specifically the starting indexes and the number of elements in both arrays to which the hunk refers.

Furthermore, a diff is essentially a list of hunks. The simplest case is a diff with infinite context, consisting of exactly one hunk.

Sourcetype 'a t = {
  1. prev_start : int;
  2. prev_size : int;
  3. next_start : int;
  4. next_size : int;
  5. ranges : 'a Patience_diff_lib__.Range.t list;
}
Sourceval ranges : 'a t -> 'a Patience_diff_lib__.Range.t list
Sourceval next_size : 'a t -> int
Sourceval next_start : 'a t -> int
Sourceval prev_size : 'a t -> int
Sourceval prev_start : 'a t -> int
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
Sourceval all_same : 'a t -> bool

all_same t returns true if t contains only Same ranges.

Sourceval concat_map : 'a t -> f:('a Patience_diff_lib__.Range.t -> 'b Patience_diff_lib__.Range.t list) -> 'b t

concat_map t ~f applies List.concat_map on t.ranges.

Sourcemodule Stable : sig ... end
OCaml

Innovation. Community. Security.