Rope
core :: RopeCharIterator :: _max
Maximum position to iterate on (e.g. Rope.length)core :: RopeCharIterator :: defaultinit
core :: RopeCharIterator :: max
Maximum position to iterate on (e.g. Rope.length)core :: RopeCharIterator :: max=
Maximum position to iterate on (e.g. Rope.length)core :: RopeCharIterator :: subs=
Substrings of the Ropecore $ RopeCharIterator :: SELF
Type of this instance, automatically specialized in every classcore :: RopeCharIterator :: _max
Maximum position to iterate on (e.g. Rope.length)core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: IndexedIterator :: defaultinit
core :: RopeCharIterator :: defaultinit
core :: Object :: defaultinit
core :: Iterator :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: RopeCharIterator :: max
Maximum position to iterate on (e.g. Rope.length)core :: RopeCharIterator :: max=
Maximum position to iterate on (e.g. Rope.length)core :: Object :: native_class_name
The class name of the object in CString format.Iterator
whose elements are sorted by the function
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: RopeCharIterator :: subs=
Substrings of the Rope
# Forward iterator on the chars of a `Rope`
private class RopeCharIterator
super IndexedIterator[Char]
# Position in current `String`
var pns: Int is noautoinit
# Current `String` being iterated on
var str: String is noautoinit
# Substrings of the Rope
var subs: IndexedIterator[String] is noautoinit
# Maximum position to iterate on (e.g. Rope.length)
var max: Int is noautoinit
# Position (char) in the Rope (0-indexed)
var pos: Int is noautoinit
init from(root: Concat, pos: Int) do
subs = new RopeSubstrings.from(root, pos)
pns = pos - subs.index
self.pos = pos
str = subs.item
max = root.length - 1
end
redef fun item do return str[pns]
redef fun is_ok do return pos <= max
redef fun index do return pos
redef fun next do
pns += 1
pos += 1
if pns < subs.item.length then return
if not subs.is_ok then return
subs.next
if not subs.is_ok then return
str = subs.item
pns = 0
end
end
lib/core/text/ropes.nit:454,1--493,3