Liking cljdoc? Tell your friends :D

clojure.tools.analyzer.ast

Utilities for AST walking/updating

Utilities for AST walking/updating
raw docstring

ast->eavclj

(ast->eav ast)

Returns an EAV representation of the current AST that can be used by Datomic's Datalog.

Returns an EAV representation of the current AST that can be used by
Datomic's Datalog.
sourceraw docstring

childrenclj

(children ast)

Return a vector of the children expression of the AST node, if it has any. The children expressions are kept in order and flattened so that the returning vector contains only nodes and not vectors of nodes.

Return a vector of the children expression of the AST node, if it has any.
The children expressions are kept in order and flattened so that the returning
vector contains only nodes and not vectors of nodes.
sourceraw docstring

children*clj

(children* {:keys [children] :as ast})

Return a vector of vectors of the children node key and the children expression of the AST node, if it has any. The returned vector returns the children in the order as they appear in the :children field of the AST, and the children expressions may be either a node or a vector of nodes.

Return a vector of vectors of the children node key and the children expression
of the AST node, if it has any.
The returned vector returns the children in the order as they appear in the
:children field of the AST, and the children expressions may be either a node
or a vector of nodes.
sourceraw docstring

cyclingclj

(cycling & fns*)

Combine the given passes in a single pass that will be applied repeatedly to the AST until applying it another time will have no effect

Combine the given passes in a single pass that will be applied repeatedly
to the AST until applying it another time will have no effect
sourceraw docstring

nodesclj

(nodes ast)

Returns a lazy-seq of all the nodes in the given AST, in depth-first pre-order.

Returns a lazy-seq of all the nodes in the given AST, in depth-first pre-order.
sourceraw docstring

postwalkclj

(postwalk ast f)
(postwalk ast f reversed?)

Shorthand for (walk ast identity f reversed?)

Shorthand for (walk ast identity f reversed?)
sourceraw docstring

prewalkclj

(prewalk ast f)

Shorthand for (walk ast f identity)

Shorthand for (walk ast f identity)
sourceraw docstring

update-childrenclj

(update-children ast f)
(update-children ast f reversed?)

Applies f to each AST children node, replacing it with the returned value. If reversed? is not-nil, pre and post will be applied starting from the last children of the AST node to the first one. Short-circuits on reduced.

Applies `f` to each AST children node, replacing it with the returned value.
If reversed? is not-nil, `pre` and `post` will be applied starting from the last
children of the AST node to the first one.
Short-circuits on reduced.
sourceraw docstring

update-children-reducedclj

(update-children-reduced ast f)
(update-children-reduced ast f reversed?)

Like update-children but returns a reduced holding the AST if f short-circuited.

Like update-children but returns a reduced holding the AST if f short-circuited.
sourceraw docstring

walkclj

(walk ast pre post)
(walk ast pre post reversed?)

Walk the ast applying pre when entering the nodes, and post when exiting. Both functions must return a valid node since the returned value will replace the node in the AST which was given as input to the function. If reversed? is not-nil, pre and post will be applied starting from the last children of the AST node to the first one. Short-circuits on reduced.

Walk the ast applying `pre` when entering the nodes, and `post` when exiting.
Both functions must return a valid node since the returned value will replace
the node in the AST which was given as input to the function.
If reversed? is not-nil, `pre` and `post` will be applied starting from the last
children of the AST node to the first one.
Short-circuits on reduced.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close