|
190 | 190 |
|
191 | 191 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.custom-zipper.core
|
192 | 192 | (defn root
|
193 |
| - "Zips all the way up `zloc` and returns zipper at the root node, reflecting any changes." |
| 193 | + "Zips all the way up `zloc` and returns the root node, reflecting any changes." |
194 | 194 | [zloc] (rewrite-clj.custom-zipper.core/root zloc))
|
195 | 195 |
|
196 | 196 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
|
241 | 241 |
|
242 | 242 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
243 | 243 | (defn length
|
244 |
| - "Return length of printable string of current node in `zloc`." |
| 244 | + "Return length of printable [[string]] of current node in `zloc`." |
245 | 245 | [zloc] (rewrite-clj.zip.base/length zloc))
|
246 | 246 |
|
247 | 247 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
|
306 | 306 | (defn edit
|
307 | 307 | "Return `zloc` with the current node replaced with the result of:
|
308 | 308 |
|
309 |
| - (`f` (s-expression node) `args`) |
| 309 | + `(apply f (s-expr current-node) args)` |
310 | 310 |
|
311 |
| - `f` should return a node. |
312 |
| - The result of `f` will be coerced to a node if possible. |
| 311 | + The result of `f`, if not already a node, will be coerced to a node if possible. |
313 | 312 |
|
314 | 313 | See docs for [sexpr nuances](/doc/01-user-guide.adoc#sexpr-nuances)."
|
315 | 314 | [zloc f & args] (apply rewrite-clj.zip.editz/edit zloc f args))
|
|
366 | 365 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.findz
|
367 | 366 | (defn find-next
|
368 | 367 | "Return `zloc` located to the next node satisfying predicate `p?` else `nil`.
|
369 |
| - Search starts one movement `f` from the current node continues via `f`. |
| 368 | + Search starts one movement `f` from the current node and continues via `f`. |
370 | 369 |
|
371 | 370 | `f` defaults to [[rewrite-clj.zip/right]]"
|
372 | 371 | ([zloc p?] (rewrite-clj.zip.findz/find-next zloc p?))
|
|
439 | 438 |
|
440 | 439 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.findz
|
441 | 440 | (defn find-next-token
|
442 |
| - "Return `zloc` location to the next token node satisfying predicate `p?` else `nil`. |
| 441 | + "Return `zloc` located to the next token node satisfying predicate `p?` else `nil`. |
443 | 442 | Search starts one movement `f` after the current node and continues via `f`.
|
444 | 443 |
|
445 | 444 | `f` defaults to [[rewrite-clj.zip/right]]"
|
|
463 | 462 |
|
464 | 463 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.insert
|
465 | 464 | (defn insert-right
|
466 |
| - "Return zipper with `item` inserted to the right of the current node in `zloc`. |
| 465 | + "Return zipper with `item` inserted to the right of the current node in `zloc`, without moving location. |
467 | 466 | Will insert a space if necessary."
|
468 | 467 | [zloc item] (rewrite-clj.zip.insert/insert-right zloc item))
|
469 | 468 |
|
470 | 469 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.insert
|
471 | 470 | (defn insert-left
|
472 |
| - "Return zipper with `item` inserted to the left of the current node in `zloc`. |
| 471 | + "Return zipper with `item` inserted to the left of the current node in `zloc`, without moving location. |
473 | 472 | Will insert a space if necessary."
|
474 | 473 | [zloc item] (rewrite-clj.zip.insert/insert-left zloc item))
|
475 | 474 |
|
476 | 475 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.insert
|
477 | 476 | (defn insert-child
|
478 |
| - "Return zipper with `item` inserted as the first child of the current node in `zloc`." |
| 477 | + "Return zipper with `item` inserted as the first child of the current node in `zloc`, without moving location." |
479 | 478 | [zloc item] (rewrite-clj.zip.insert/insert-child zloc item))
|
480 | 479 |
|
481 | 480 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.insert
|
482 | 481 | (defn append-child
|
483 |
| - "Return zipper with `item` appended as last child of the current node in `zloc`. |
| 482 | + "Return zipper with `item` inserted as the last child of the current node in `zloc`, without moving. |
484 | 483 | Will insert a space if necessary."
|
485 | 484 | [zloc item] (rewrite-clj.zip.insert/append-child zloc item))
|
486 | 485 |
|
487 | 486 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
488 | 487 | (defn left
|
489 |
| - "Return zipper with location moved left to next non-whitespace/non-comment node in `zloc`." |
| 488 | + "Return zipper with location moved left to next non-whitespace/non-comment sibling of current node in `zloc`." |
490 | 489 | [zloc] (rewrite-clj.zip.move/left zloc))
|
491 | 490 |
|
492 | 491 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
493 | 492 | (defn right
|
494 |
| - "Return zipper with location moved right to next non-whitespace/non-comment node in `zloc`." |
| 493 | + "Return zipper with location moved right to next non-whitespace/non-comment sibling of current node in `zloc`." |
495 | 494 | [zloc] (rewrite-clj.zip.move/right zloc))
|
496 | 495 |
|
497 | 496 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
498 | 497 | (defn up
|
499 |
| - "Return zipper with location moved up to next non-whitespace/non-comment node in `zloc`." |
| 498 | + "Return zipper with location moved up to next non-whitespace/non-comment parent of current node in `zloc`, or `nil` if at the top." |
500 | 499 | [zloc] (rewrite-clj.zip.move/up zloc))
|
501 | 500 |
|
502 | 501 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
503 | 502 | (defn down
|
504 |
| - "Return zipper with location moved down to next non-whitespace/non-comment node in `zloc`." |
| 503 | + "Return zipper with location moved down to the first non-whitespace/non-comment child node of the current node in `zloc`, or nil if no applicable children." |
505 | 504 | [zloc] (rewrite-clj.zip.move/down zloc))
|
506 | 505 |
|
507 | 506 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
508 | 507 | (defn prev
|
509 |
| - "Return zipper with location moved to the previous depth-first non-whitespace/non-comment node in `zloc`." |
| 508 | + "Return zipper with location moved to the previous depth-first non-whitespace/non-comment node in `zloc`. If already at root, returns nil." |
510 | 509 | [zloc] (rewrite-clj.zip.move/prev zloc))
|
511 | 510 |
|
512 | 511 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
513 | 512 | (defn next
|
514 |
| - "Return zipper with location moved to the next depth-first non-whitespace/non-comment node in `zloc`." |
| 513 | + "Return zipper with location moved to the next depth-first non-whitespace/non-comment node in `zloc`. |
| 514 | + End can be detected with [[end?]], if already at end, stays there." |
515 | 515 | [zloc] (rewrite-clj.zip.move/next zloc))
|
516 | 516 |
|
517 | 517 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
518 | 518 | (defn leftmost
|
519 |
| - "Return zipper with location moved to the leftmost non-whitespace/non-comment node in `zloc`." |
| 519 | + "Return zipper with location moved to the leftmost non-whitespace/non-comment sibling of current node in `zloc`." |
520 | 520 | [zloc] (rewrite-clj.zip.move/leftmost zloc))
|
521 | 521 |
|
522 | 522 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
523 | 523 | (defn rightmost
|
524 |
| - "Return zipper with location moved to the rightmost non-whitespace/non-comment node in `zloc`." |
| 524 | + "Return zipper with location moved to the rightmost non-whitespace/non-comment sibling of current node in `zloc`." |
525 | 525 | [zloc] (rewrite-clj.zip.move/rightmost zloc))
|
526 | 526 |
|
527 | 527 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
528 | 528 | (defn leftmost?
|
529 |
| - "Return true if at leftmost non-whitespace/non-comment node in `zloc`." |
| 529 | + "Return true if at leftmost non-whitespace/non-comment sibling node in `zloc`." |
530 | 530 | [zloc] (rewrite-clj.zip.move/leftmost? zloc))
|
531 | 531 |
|
532 | 532 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
533 | 533 | (defn rightmost?
|
534 |
| - "Return true if at rightmost non-whitespace/non-comment node in `zloc`." |
| 534 | + "Return true if at rightmost non-whitespace/non-comment sibling node in `zloc`." |
535 | 535 | [zloc] (rewrite-clj.zip.move/rightmost? zloc))
|
536 | 536 |
|
537 | 537 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.move
|
|
743 | 743 | - or a valid zipper
|
744 | 744 | WARNING: when function `f` changes the location in the zipper, normal traversal will be affected.
|
745 | 745 |
|
746 |
| - When `p?` is not specified `f` is called all locations. |
| 746 | + When `p?` is not specified `f` is called on all locations. |
747 | 747 |
|
748 | 748 | Note that by default a newly created zipper automatically navigates to the first non-whitespace
|
749 | 749 | node. If you want to be sure to walk all forms in a zipper, you'll want to navigate one up prior to your walk:
|
|
785 | 785 | - or a valid zipper
|
786 | 786 | WARNING: when function `f` changes the location in the zipper, normal traversal will be affected.
|
787 | 787 |
|
788 |
| - When `p?` is not specified `f` is called all locations. |
| 788 | + When `p?` is not specified `f` is called on all locations. |
789 | 789 |
|
790 | 790 | Note that by default a newly created zipper automatically navigates to the first non-whitespace
|
791 | 791 | node. If you want to be sure to walk all forms in a zipper, you'll want to navigate one up prior to your walk:
|
|
836 | 836 |
|
837 | 837 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.whitespace
|
838 | 838 | (defn ^{:added "0.5.0"} insert-space-left
|
839 |
| - "Return zipper with `n` space whitespace node inserted to the left of the current node in `zloc`. |
| 839 | + "Return zipper with `n` space whitespace node inserted to the left of the current node in `zloc`, without moving location. |
840 | 840 | `n` defaults to 1."
|
841 | 841 | ([zloc] (rewrite-clj.zip.whitespace/insert-space-left zloc))
|
842 | 842 | ([zloc n] (rewrite-clj.zip.whitespace/insert-space-left zloc n)))
|
843 | 843 |
|
844 | 844 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.whitespace
|
845 | 845 | (defn ^{:added "0.5.0"} insert-space-right
|
846 |
| - "Return zipper with `n` space whitespace node inserted to the right of the current node in `zloc`. |
| 846 | + "Return zipper with `n` space whitespace node inserted to the right of the current node in `zloc`, without moving location. |
847 | 847 | `n` defaults to 1."
|
848 | 848 | ([zloc] (rewrite-clj.zip.whitespace/insert-space-right zloc))
|
849 | 849 | ([zloc n] (rewrite-clj.zip.whitespace/insert-space-right zloc n)))
|
850 | 850 |
|
851 | 851 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.whitespace
|
852 | 852 | (defn ^{:added "0.5.0"} insert-newline-left
|
853 |
| - "Return zipper with `n` newlines node inserted to the left of the current node in `zloc`. |
| 853 | + "Return zipper with `n` newlines node inserted to the left of the current node in `zloc`, without moving location. |
854 | 854 | `n` defaults to 1."
|
855 | 855 | ([zloc] (rewrite-clj.zip.whitespace/insert-newline-left zloc))
|
856 | 856 | ([zloc n] (rewrite-clj.zip.whitespace/insert-newline-left zloc n)))
|
857 | 857 |
|
858 | 858 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.whitespace
|
859 | 859 | (defn ^{:added "0.5.0"} insert-newline-right
|
860 |
| - "Return zipper with `n` newlines node inserted to the right of the current node in `zloc`. |
| 860 | + "Return zipper with `n` newlines node inserted to the right of the current node in `zloc`, without moving location. |
861 | 861 | `n` defaults to 1."
|
862 | 862 | ([zloc] (rewrite-clj.zip.whitespace/insert-newline-right zloc))
|
863 | 863 | ([zloc n] (rewrite-clj.zip.whitespace/insert-newline-right zloc n)))
|
@@ -989,7 +989,9 @@ NOTE: This function does not skip, nor provide any special handling for whitespa
|
989 | 989 | (defn edit*
|
990 | 990 | "Raw version of [[edit]].
|
991 | 991 |
|
992 |
| -Returns zipper with value of `(f current-node args)` replacing current node in `zloc` |
| 992 | +Returns zipper with value of `(apply f current-node args)` replacing current node in `zloc`. |
| 993 | + |
| 994 | + The result of `f` should be a rewrite-clj node. |
993 | 995 |
|
994 | 996 | NOTE: This function does not skip, nor provide any special handling for whitespace/comment nodes."
|
995 | 997 | [zloc f & args] (apply rewrite-clj.custom-zipper.core/edit zloc f args))
|
|
0 commit comments