Module Zed_lines
exception Out_of_bounds
Exception raised when trying to access a position outside the
bounds of a set.
type t
Type of sets of line positions.
val length : t -> int
Returns the length of the set, i.e. the number of characters in
the set.
val count : t -> int
Returns the number of newlines in the set.
val empty : t
The empty set.
val line_index : t -> int -> int
line_index set ofs
returns the line number of the line
containing ofs
.
val line_start : t -> int -> int
line_start set idx
returns the offset of the beginning of the
idx
th line of set
.
val append : t -> t -> t
append s1 s2
concatenates two sets of line positions.
val insert : t -> int -> t -> t
insert set offset set'
inserts set
at given positon in
set'
.
val remove : t -> int -> int -> t
remove set offet length
removes length
characters at
offset
in set.
val replace : t -> int -> int -> t -> t
replace set offset length repl
replaces the subset at offset
offset
and length length
by repl
in set
.