Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Zed_rope.Zip
SourceType of zippers. A zipper allow to naviguate in a rope in a convenient and efficient manner. Note that a zipper points to a position between two glyphs, not to a glyph, so in a rope of length len
there is len + 1
positions.
make_f rope pos
creates a new zipper pointing to positon pos
of rope
.
make_b rope pos
creates a new zipper pointing to positon length rope - pos
of rope
.
next zipper
returns the glyph at the right of the zipper and a zipper to the next position. It raises Out_of_bounds
if the zipper points to the end of the rope.
prev zipper
returns the glyph at the left of the zipper and a zipper to the previous position. It raises Out_of_bounds
if the zipper points to the beginning of the rope.
move n zip
moves the zipper by n
glyphs. If n
is negative it is moved to the left and if it is positive it is moved to the right. It raises Out_of_bounds
if the result is outside the bounds of the rope.
at_bos zipper
returns true
if zipper
points to the beginning of the rope.
find_f f zip
search forward for a glyph to satisfy f
. It returns a zipper pointing to the left of the first glyph to satisfy f
, or a zipper pointing to the end of the rope if no such glyph exists.
find_b f zip
search backward for a glyph to satisfy f
. It returns a zipper pointing to the right of the first glyph to satisfy f
, or a zipper pointing to the beginning of the rope if no such glyph exists.
sub zipper len
returns the sub-rope of length len
pointed by zipper
.