Skip to content

Commit c6bf174

Browse files
David Rajchenbach-Tellerbrson
David Rajchenbach-Teller
authored andcommitted
---
yaml --- r: 6147 b: refs/heads/master c: 57425b5 h: refs/heads/master i: 6145: b80bdbe 6143: efd3c6b v: v3
1 parent 73ac059 commit c6bf174

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: f9a0d03c7af26558c23abd2a73f2af5653f2ec20
2+
refs/heads/master: 57425b575c08ad2fb53c7a08dc29c224f0f4502b

trunk/src/lib/rope.rs

+68-2
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,78 @@ fn cmp(left: rope, right: rope) -> int {
298298
}
299299
}
300300

301+
/*
302+
Function: eq
303+
304+
Returns:
305+
306+
`true` if both ropes have the same content (regardless of their structure),
307+
`false` otherwise
308+
*/
301309
fn eq(left: rope, right: rope) -> bool {
302310
ret cmp(left, right) == 0;
303311
}
304312

305-
fn leq(left: rope, right: rope) -> bool {
313+
/*
314+
Function: le
315+
316+
Parameters
317+
left - an arbitrary rope
318+
right - an arbitrary rope
319+
320+
Returns:
321+
322+
`true` if `left <= right` in lexicographical order (regardless of their
323+
structure), `false` otherwise
324+
*/
325+
fn le(left: rope, right: rope) -> bool {
306326
ret cmp(left, right) <= 0;
307327
}
308328

329+
/*
330+
Function: lt
331+
332+
Parameters
333+
left - an arbitrary rope
334+
right - an arbitrary rope
335+
336+
Returns:
337+
338+
`true` if `left < right` in lexicographical order (regardless of their
339+
structure), `false` otherwise
340+
*/
309341
fn lt(left: rope, right: rope) -> bool {
310342
ret cmp(left, right) < 0;
311343
}
312344

313-
fn geq(left: rope, right: rope) -> bool {
345+
/*
346+
Function: ge
347+
348+
Parameters
349+
left - an arbitrary rope
350+
right - an arbitrary rope
351+
352+
Returns:
353+
354+
`true` if `left >= right` in lexicographical order (regardless of their
355+
structure), `false` otherwise
356+
*/
357+
fn ge(left: rope, right: rope) -> bool {
314358
ret cmp(left, right) >= 0;
315359
}
316360

361+
/*
362+
Function: gt
363+
364+
Parameters
365+
left - an arbitrary rope
366+
right - an arbitrary rope
367+
368+
Returns:
369+
370+
`true` if `left > right` in lexicographical order (regardless of their
371+
structure), `false` otherwise
372+
*/
317373
fn gt(left: rope, right: rope) -> bool {
318374
ret cmp(left, right) > 0;
319375
}
@@ -349,6 +405,16 @@ fn loop_chars(rope: rope, it: block(char) -> bool) -> bool {
349405
node::content(x) { ret node::loop_chars(x, it) }
350406
}
351407
}
408+
409+
/*
410+
Function: iter_chars
411+
412+
Loop through a rope, char by char, until the end.
413+
414+
Parameters:
415+
rope - A rope to traverse. It may be empty.
416+
it - A block to execute with each consecutive character of the rope.
417+
*/
352418
fn iter_chars(rope: rope, it: block(char)) {
353419
loop_chars(rope) {|x|
354420
it(x);

0 commit comments

Comments
 (0)