Utilities for AST walking/updating
Utilities for AST walking/updating
(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.
(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.
(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.
(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
(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.
(postwalk ast f)
(postwalk ast f reversed?)
Shorthand for (walk ast identity f reversed?)
Shorthand for (walk ast identity f reversed?)
(prewalk ast f)
Shorthand for (walk ast f identity)
Shorthand for (walk ast f identity)
(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.
(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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close