|
19 | 19 |
|
20 | 20 | Because this API contains many functions, we offer the following categorized listing:
|
21 | 21 |
|
22 |
| - **Create a zipper** |
| 22 | + **Create a zipper and move to first non-whitespace/comment node** |
23 | 23 | [[of-node]]
|
24 |
| - [[of-node*]] |
25 | 24 | [[of-string]]
|
26 | 25 | [[of-file]]
|
27 | 26 |
|
| 27 | + **Create a zipper without skipping any nodes** |
| 28 | + [[of-node*]] |
| 29 | + [[of-string*]] |
| 30 | + [[of-file*]] |
| 31 | +
|
28 | 32 | **Move**
|
29 | 33 | [[left]]
|
30 | 34 | [[right]]
|
|
225 | 229 | "Create and return zipper from a rewrite-clj `node` (likely parsed by [[rewrite-clj.parser]]),
|
226 | 230 | and move to the first non-whitespace/non-comment child. If node is not forms node, is wrapped in forms node
|
227 | 231 | for a consistent root.
|
228 |
| -
|
229 | 232 | Optional `opts` can specify:
|
230 | 233 | - `:track-position?` set to `true` to enable ones-based row/column tracking, see [docs on position tracking](/doc/01-user-guide.adoc#position-tracking).
|
231 | 234 | - `:auto-resolve` specify a function to customize namespaced element auto-resolve behavior, see [docs on namespaced elements](/doc/01-user-guide.adoc#namespaced-elements)"
|
|
270 | 273 |
|
271 | 274 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
272 | 275 | (defn of-string
|
273 |
| - "Create and return zipper from all forms in Clojure/ClojureScript/EDN string `s`. |
| 276 | + "Create and return zipper from all forms in Clojure/ClojureScript/EDN string `s`, and move to the first non-whitespace/non-comment child. |
| 277 | +
|
| 278 | + See [[of-string*]] for same but with no automatic move. |
274 | 279 |
|
275 | 280 | Optional `opts` can specify:
|
276 | 281 | - `:track-position?` set to `true` to enable ones-based row/column tracking, see [docs on position tracking](/doc/01-user-guide.adoc#position-tracking).
|
277 | 282 | - `:auto-resolve` specify a function to customize namespaced element auto-resolve behavior, see [docs on namespaced elements](/doc/01-user-guide.adoc#namespaced-elements)"
|
278 | 283 | ([s] (rewrite-clj.zip.base/of-string s))
|
279 | 284 | ([s opts] (rewrite-clj.zip.base/of-string s opts)))
|
280 | 285 |
|
| 286 | +;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base |
| 287 | +(defn ^{:added "1.1.46"} of-string* |
| 288 | + "Create and return zipper from all forms in Clojure/ClojureScript/END string `s`, and do no automatic move. |
| 289 | +
|
| 290 | + See [[of-string]] for same but with automatic move to first interesting node. |
| 291 | +
|
| 292 | + Optional `opts` can specify: |
| 293 | + - `:track-position?` set to `true` to enable ones-based row/column tracking, see [docs on position tracking](/doc/01-user-guide.adoc#position-tracking). |
| 294 | + - `:auto-resolve` specify a function to customize namespaced element auto-resolve behavior, see [docs on namespaced elements](/doc/01-user-guide.adoc#namespaced-elements)" |
| 295 | + ([s] (rewrite-clj.zip.base/of-string* s)) |
| 296 | + ([s opts] (rewrite-clj.zip.base/of-string* s opts))) |
| 297 | + |
281 | 298 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
282 | 299 | (defn ^{:added "0.4.0"} string
|
283 | 300 | "Return string representing the current node in `zloc`."
|
|
797 | 814 |
|
798 | 815 | When `p?` is not specified `f` is called on all locations.
|
799 | 816 |
|
800 |
| - Note that by default a newly created zipper automatically navigates to the first non-whitespace |
801 |
| - 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: |
| 817 | + To walk all nodes, you'll want to walk from the root node. |
| 818 | + You can do this by, for example, using [[of-string*]] instead of [[of-string]]. |
802 | 819 |
|
803 | 820 | ```Clojure
|
804 |
| - (-> (zip/of-string \"my clojure forms\") |
805 |
| - zip/up |
| 821 | + (-> (zip/of-string* \"my clojure forms\") |
806 | 822 | (zip/prewalk ...))
|
807 | 823 | ```
|
808 | 824 |
|
|
840 | 856 |
|
841 | 857 | When `p?` is not specified `f` is called on all locations.
|
842 | 858 |
|
843 |
| - Note that by default a newly created zipper automatically navigates to the first non-whitespace |
844 |
| - 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: |
| 859 | + To walk all nodes, you'll want to walk from the root node. |
| 860 | + You can do this by, for example, using [[of-string*]] instead of [[of-string]]. |
845 | 861 |
|
846 | 862 | ```Clojure
|
847 |
| - (-> (zip/of-string \"my clojure forms\") |
848 |
| - zip/up |
| 863 | + (-> (zip/of-string* \"my clojure forms\") |
849 | 864 | (zip/postwalk ...))
|
850 | 865 | ```
|
851 | 866 |
|
|
943 | 958 |
|
944 | 959 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base
|
945 | 960 | (defn of-file
|
946 |
| - "Create and return zipper from all forms in Clojure/ClojureScript/EDN File `f`. |
| 961 | + "Create and return zipper from all forms in Clojure/ClojureScript/EDN File `f`, and move to the first non-whitespace/non-comment child. |
| 962 | +
|
| 963 | + See [[of-file*]] for same but with no automatic move. |
947 | 964 |
|
948 | 965 | Optional `opts` can specify:
|
949 | 966 | - `:track-position?` set to `true` to enable ones-based row/column tracking, see [docs on position tracking](/doc/01-user-guide.adoc#position-tracking).
|
950 | 967 | - `:auto-resolve` specify a function to customize namespaced element auto-resolve behavior, see [docs on namespaced elements](/doc/01-user-guide.adoc#namespaced-elements)"
|
951 | 968 | ([f] (rewrite-clj.zip.base/of-file f))
|
952 | 969 | ([f opts] (rewrite-clj.zip.base/of-file f opts))))
|
953 | 970 |
|
| 971 | +#?(:clj |
| 972 | + |
| 973 | +;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.zip.base |
| 974 | +(defn ^{:added "1.1.46"} of-file* |
| 975 | + "Create and return zipper from all forms in Clojure/ClojureScript/EDN File `f`, and do no automatic move. |
| 976 | +
|
| 977 | + See [[of-file]] for same but with automatic move to first interesting node. |
| 978 | +
|
| 979 | + Optional `opts` can specify: |
| 980 | + - `:track-position?` set to `true` to enable ones-based row/column tracking, see [docs on position tracking](/doc/01-user-guide.adoc#position-tracking). |
| 981 | + - `:auto-resolve` specify a function to customize namespaced element auto-resolve behavior, see [docs on namespaced elements](/doc/01-user-guide.adoc#namespaced-elements)" |
| 982 | + ([f] (rewrite-clj.zip.base/of-file* f)) |
| 983 | + ([f opts] (rewrite-clj.zip.base/of-file* f opts)))) |
| 984 | + |
954 | 985 |
|
955 | 986 | ;; DO NOT EDIT FILE, automatically imported from: rewrite-clj.custom-zipper.core
|
956 | 987 | (defn right*
|
|
0 commit comments