clojure.tools.analyzer.ast
Utilities for AST walking/updating
(ast->eav ast)
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.
(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 childrens 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 applieed 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.
(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.
(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.