@@ -298,22 +298,78 @@ fn cmp(left: rope, right: rope) -> int {
298
298
}
299
299
}
300
300
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
+ */
301
309
fn eq ( left: rope, right: rope) -> bool {
302
310
ret cmp ( left, right) == 0 ;
303
311
}
304
312
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 {
306
326
ret cmp ( left, right) <= 0 ;
307
327
}
308
328
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
+ */
309
341
fn lt ( left : rope , right : rope ) -> bool {
310
342
ret cmp ( left, right) < 0 ;
311
343
}
312
344
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 {
314
358
ret cmp ( left, right) >= 0 ;
315
359
}
316
360
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
+ */
317
373
fn gt ( left : rope , right : rope ) -> bool {
318
374
ret cmp ( left, right) > 0 ;
319
375
}
@@ -349,6 +405,16 @@ fn loop_chars(rope: rope, it: block(char) -> bool) -> bool {
349
405
node:: content ( x) { ret node:: loop_chars ( x, it) }
350
406
}
351
407
}
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
+ */
352
418
fn iter_chars ( rope : rope , it : block ( char ) ) {
353
419
loop_chars ( rope) { |x|
354
420
it ( x) ;
0 commit comments