package inquire
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=0b88d89e24d4cbc0560a7c8d8ec51388990e1b27f24685029997afa52a7c720f
    
    
  sha512=8b62860a8d15e41528a404a6f1b9968c3d79755607b5ea319af2e3e45516e672a785361d278279910928db4054e1800e87bcee0210ff3eabfb330713b368c827
    
    
  doc/inquire.zed/Zed_rope/index.html
Module Zed_rope
Unicode ropes
type rope = tAlias.
Exception raised when trying to access a character which is outside the bounds of a rope.
Construction
val empty : unit -> ropeThe empty rope.
val make : int -> Zed_char.t -> ropemake length char creates a rope of length length containing only char.
val singleton : Zed_char.t -> ropesingleton ch creates a rope of length 1 containing only ch.
Informations
val length : rope -> intReturns the length of the given rope.
val size : rope -> intReturns the size of the given rope.
val is_empty : rope -> boolis_empty rope returns whether str is the empty rope or not.
Random access
val get : rope -> int -> Zed_char.tget rope idx returns the glyph at index idx in rope.
get_raw rope idx returns the character at raw index idx in rope.
Rope manipulation
concat sep l concatenates all strings of l separating them by sep.
sub rope ofs len Returns the sub-rope of rope starting at ofs and of length len.
break rope pos returns the sub-ropes before and after pos in rope. It is more efficient than creating two sub-ropes with sub.
insert rope pos char inserts char in rope at position pos. If char is a combing mark, it's merged to the character at position pos-1
remove rope pos len removes the len characters at position pos in rope
replace rope pos len repl replaces the len characters at position pos in rope by repl.
lchop rope returns rope without is first character. Returns empty if rope is empty.
rchop rope returns rope without is last character. Returns empty if rope is empty.
Iteration, folding and mapping
val iter : (Zed_char.t -> unit) -> rope -> unititer f rope applies f on all characters of rope starting from the left.
val rev_iter : (Zed_char.t -> unit) -> rope -> unitrev_iter f rope applies f an all characters of rope starting from the right.
val fold : (Zed_char.t -> 'a -> 'a) -> rope -> 'a -> 'afold f rope acc applies f on all characters of rope starting from the left, accumulating a value.
val rev_fold : (Zed_char.t -> 'a -> 'a) -> rope -> 'a -> 'arev_fold f rope acc applies f on all characters of rope starting from the right, accumulating a value.
val map : (Zed_char.t -> Zed_char.t) -> rope -> ropemap f rope maps all characters of rope with f.
val rev_map : (Zed_char.t -> Zed_char.t) -> rope -> roperev_map f str maps all characters of rope with f in reverse order.
Iteration and folding on leafs
Note: for all of the following functions, the leaves must absolutely not be modified.
val iter_leaf : (Zed_string.t -> unit) -> rope -> unititer_leaf f rope applies f on all leaves of rope starting from the left.
val rev_iter_leaf : (Zed_string.t -> unit) -> rope -> unititer_leaf f rope applies f on all leaves of rope starting from the right.
val fold_leaf : (Zed_string.t -> 'a -> 'a) -> rope -> 'a -> 'afold f rope acc applies f on all leaves of rope starting from the left, accumulating a value.
val rev_fold_leaf : (Zed_string.t -> 'a -> 'a) -> rope -> 'a -> 'arev_fold f rope acc applies f on all leaves of rope starting from the right, accumulating a value.
Zippers
module Zip : sig ... endmodule Zip_raw : sig ... endBuffers
module String_buffer = Buffermodule Buffer : sig ... endval init : int -> (int -> Zed_char.t) -> ropeval of_string : Zed_string.t -> ropeval to_string : rope -> Zed_string.t