Create and evaluate nodes.
All nodes represent Clojure/ClojureScript/EDN.
Create and evaluate nodes. All nodes represent Clojure/ClojureScript/EDN.
The Clojure reader can add positional metadata.
This metadata is not in the original source, and therefore assumed to be uninteresting to users of rewrite-cljc.
Clojure will add :line
and :column
to quoted lists.
Sci, and therefore Babashka does the same for all elements that accept metadata and adds :end-line
and :end-column
The Clojure reader can add positional metadata. This metadata is not in the original source, and therefore assumed to be uninteresting to users of rewrite-cljc. Clojure will add `:line` and `:column` to quoted lists. Sci, and therefore Babashka does the same for all elements that accept metadata and adds `:end-line` and `:end-column`
(child-sexprs node)
Returns children for node
converted to forms.
Returns children for `node` converted to forms.
(children node)
Returns child nodes for node
.
Returns child nodes for `node`.
(comma-node s)
Create comma node of string s
, where s
is one or more comma characters.
Create comma node of string `s`, where `s` is one or more comma characters.
(comma-separated nodes)
Interleave nodes
with ", "
nodes.
Interleave `nodes` with `", "` nodes.
(comma? node)
Returns true if node
represents one or more commas.
Returns true if `node` represents one or more commas.
(comment-node s)
Create node representing a comment with text s
.
Create node representing a comment with text `s`.
(comment? node)
Returns true if node
is a comment.
Returns true if `node` is a comment.
(deref-node children)
Create node representing the dereferencing of a form (i.e. @...
)
where children
is either a sequence of nodes or a single node.
Create node representing the dereferencing of a form (i.e. `@...`) where `children` is either a sequence of nodes or a single node.
(eval-node children)
Create node representing an inline evaluation (i.e. #=...
)
where children
is either a sequence of nodes or a single node.
Create node representing an inline evaluation (i.e. `#=...`) where `children` is either a sequence of nodes or a single node.
(fn-node children)
Create node representing an anonymous function with children
.
Create node representing an anonymous function with `children`.
(form-meta form)
Same as clojure.core/meta
but respects [[rewrite-cljc/elide-metadata]].
Use when you want to omit reader generated metadata on forms.
Same as `clojure.core/meta` but respects [[rewrite-cljc/*elide-metadata*]]. Use when you want to omit reader generated metadata on forms.
(forms-node children)
Create top-level node wrapping multiple children
(equivalent to an implicit do
at the top-level).
Create top-level node wrapping multiple `children` (equivalent to an implicit `do` at the top-level).
(inner? node)
Returns true if node
can have children.
Returns true if `node` can have children.
(integer-node value)
(integer-node value base)
Create node representing an integer value
in base
.
base
defaults to 10.
Create node representing an integer `value` in `base`. `base` defaults to 10.
(keyword-node k & [namespaced?])
Create node representing a keyword k
. If namespaced?
is true
a keyword à la ::x
or ::ns/x
(i.e. namespaced/aliased/auto-resolved) is generated.
Create node representing a keyword `k`. If `namespaced?` is `true` a keyword à la `::x` or `::ns/x` (i.e. namespaced/aliased/auto-resolved) is generated.
(leader-length node)
Returns number of characters before children for node
.
Returns number of characters before children for `node`.
(length node)
Return number of characters for the string version of node
.
Return number of characters for the string version of `node`.
(line-separated nodes)
Interleave nodes
with newline nodes.
Interleave `nodes` with newline nodes.
(linebreak? node)
Returns true if node
represents one or more linebreaks.
Returns true if `node` represents one or more linebreaks.
(list-node children)
Create a node representing a list with children
.
Create a node representing a list with `children`.
(map-node children)
Create a node representing an map with children
.
Create a node representing an map with `children`.
(meta-node children)
(meta-node metadata data)
Create node representing a form data
and its metadata
.
Create node representing a form `data` and its `metadata`.
(namespaced-map-node children)
Create a node representing a namespaced map. There are 3 types of namespaced maps:
prefix namespaced map
The prefix is a keyword which specifies to a namespace.
Example: #:my.name.space{:a 1}
auto-resolve alias namespaced map
The prefix is an auto-resolve keyword specifies a namespace alias.
Example: #::ns-alias{:b 3}
auto-resolve namespaced map
The prefix is ::
which specifies the current namespace.
Example: #::{:c 4}
First child is the prefix, followed by optional whitespace then map node. TODO: this still seems hacky to me. Prefix must be a token-node with a keyword value. Use (keyword ':') for auto-resolve.
Create a node representing a namespaced map. There are 3 types of namespaced maps: 1. prefix namespaced map The prefix is a keyword which specifies to a namespace. Example: `#:my.name.space{:a 1}` 2. auto-resolve alias namespaced map The prefix is an auto-resolve keyword specifies a namespace alias. Example: `#::ns-alias{:b 3}` 3. auto-resolve namespaced map The prefix is `::` which specifies the current namespace. Example: `#::{:c 4}` First child is the prefix, followed by optional whitespace then map node. TODO: this still seems hacky to me. Prefix must be a token-node with a keyword value. Use (keyword ':') for auto-resolve.
(newline-node s)
Create newline node of string s
, where s
is one or more linebreak characters.
Create newline node of string `s`, where `s` is one or more linebreak characters.
(newlines n)
Create node representing n
newline characters.
Create node representing `n` newline characters.
(node? x)
Returns true if x
is a rewrite-cljc created node.
Returns true if `x` is a rewrite-cljc created node.
(printable-only? node)
Return true if node
cannot be converted to an s-expression element.
Return true if `node` cannot be converted to an s-expression element.
(quote-node children)
Create node representing a quoted form where children
is either a sequence of nodes or a single node.
Create node representing a quoted form where `children` is either a sequence of nodes or a single node.
(raw-meta-node children)
(raw-meta-node metadata data)
Create node representing a form data
and its metadata
using the
#^
prefix.
Create node representing a form `data` and its `metadata` using the `#^` prefix.
(reader-macro-node children)
(reader-macro-node macro-node form-node)
Create node representing a reader macro (i.e. #... ...
) with children
.
Create node representing a reader macro (i.e. `#... ...`) with `children`.
(regex-node pattern-string)
Create node representing a regex with pattern-string
Create node representing a regex with `pattern-string`
(replace-children node children)
Returns node
replacing current children with children
.
Returns `node` replacing current children with `children`.
(set-node children)
Create a node representing a set with children
.
Create a node representing a set with `children`.
(sexpr node)
Return node
converted to form.
Return `node` converted to form.
(sexprs nodes)
Return forms for nodes
. Nodes that do not represent s-expression are skipped.
Return forms for `nodes`. Nodes that do not represent s-expression are skipped.
(spaces n)
Create node representing n
spaces.
Create node representing `n` spaces.
(string node)
Return the string version of node
.
Return the string version of `node`.
(string-node lines)
Create node representing a string value where lines
can be a sequence of strings or a single string.
Create node representing a string value where `lines` can be a sequence of strings or a single string.
(syntax-quote-node children)
Create node representing a syntax-quoted form where children
is either a sequence of nodes or a single node.
Create node representing a syntax-quoted form where `children` is either a sequence of nodes or a single node.
(tag node)
Returns keyword representing type of node
.
Returns keyword representing type of `node`.
(token-node value)
(token-node value string-value)
Create node for an unspecified token of value
.
Create node for an unspecified token of `value`.
(uneval-node children)
Create node representing an uneval #_
form with children
.
Create node representing an uneval `#_` form with `children`.
(unquote-node children)
Create node representing an unquoted form (i.e. ~...
) where children
.
is either a sequence of nodes or a single node.
Create node representing an unquoted form (i.e. `~...`) where `children`. is either a sequence of nodes or a single node.
(unquote-splicing-node children)
Create node representing an unquote-spliced form (i.e. ~@...
) where children
.
is either a sequence of nodes or a single node.
Create node representing an unquote-spliced form (i.e. `~@...`) where `children`. is either a sequence of nodes or a single node.
(value node)
DEPRECATED: Get first child as a pair of tag/sexpr (if inner node),
or just the node's own sexpr. (use explicit analysis of children
child-sexprs
instead)
DEPRECATED: Get first child as a pair of tag/sexpr (if inner node), or just the node's own sexpr. (use explicit analysis of `children` `child-sexprs` instead)
(var-node children)
Create node representing a var
where children
is either a sequence of nodes or a single node.
Create node representing a var where `children` is either a sequence of nodes or a single node.
(vector-node children)
Create a node representing a vector with children
.
Create a node representing a vector with `children`.
(whitespace-node s)
Create whitespace node of string s
, where s
is one or more space characters.
Create whitespace node of string `s`, where `s` is one or more space characters.
(whitespace-nodes s)
Convert string s
of whitespace to whitespace/newline nodes.
Convert string `s` of whitespace to whitespace/newline nodes.
(whitespace-or-comment? node)
Return true when node
represents whitespace or comment.
Return true when `node` represents whitespace or comment.
(whitespace? node)
Returns true if node
represents Clojure whitespace.
Returns true if `node` represents Clojure whitespace.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close