Liking cljdoc? Tell your friends :D

clojure.tools.analyzer

Analyzer for clojure code, host agnostic.

Entry point:

  • analyze

Platform implementers must provide dynamic bindings for:

  • macroexpand-1
  • parse
  • create-var
  • var?

Setting up the global env is also required, see clojure.tools.analyzer.env

See clojure.tools.analyzer.core-test for an example on how to setup the analyzer.

Analyzer for clojure code, host agnostic.

Entry point:
* analyze

Platform implementers must provide dynamic bindings for:
* macroexpand-1
* parse
* create-var
* var?

Setting up the global env is also required, see clojure.tools.analyzer.env

See clojure.tools.analyzer.core-test for an example on how to setup the analyzer.
raw docstring

-analyze-formcljmultimethod

source

-parseclj

(-parse form env)

Takes a form and an env map and dispatches on the head of the form, that is a special form.

Takes a form and an env map and dispatches on the head of the form, that is
a special form.
sourceraw docstring

analyzeclj

(analyze form env)

Given a form to analyze and an environment, a map containing:

  • :locals a map from binding symbol to AST of the binding value
  • :context a keyword describing the form's context from the :ctx/* hierarchy. ** :ctx/expr the form is an expression: its value is used ** :ctx/return the form is an expression in return position, derives :ctx/expr ** :ctx/statement the value of the form is not used
  • :ns a symbol representing the current namespace of the form to be analyzed

returns an AST for that form.

Every node in the AST is a map that is guaranteed to have the following keys:

  • :op a keyword describing the AST node
  • :form the form represented by the AST node
  • :env the environment map of the AST node

Additionally if the AST node contains sub-nodes, it is guaranteed to have:

  • :children a vector of the keys of the AST node mapping to the sub-nodes, ordered, when that makes sense

It is considered a node either the top-level node (marked with :top-level true) or a node that can be reached via :children; if a node contains a node-like map that is not reachable by :children, there's no guarantee that such a map will contain the guaranteed keys.

Given a form to analyze and an environment, a map containing:
* :locals     a map from binding symbol to AST of the binding value
* :context    a keyword describing the form's context from the :ctx/* hierarchy.
 ** :ctx/expr      the form is an expression: its value is used
 ** :ctx/return    the form is an expression in return position, derives :ctx/expr
 ** :ctx/statement the value of the form is not used
* :ns         a symbol representing the current namespace of the form to be
              analyzed

returns an AST for that form.

Every node in the AST is a map that is *guaranteed* to have the following keys:
* :op   a keyword describing the AST node
* :form the form represented by the AST node
* :env  the environment map of the AST node

Additionally if the AST node contains sub-nodes, it is guaranteed to have:
* :children a vector of the keys of the AST node mapping to the sub-nodes,
            ordered, when that makes sense

It is considered a node either the top-level node (marked with :top-level true)
or a node that can be reached via :children; if a node contains a node-like
map that is not reachable by :children, there's no guarantee that such a map
will contain the guaranteed keys.
sourceraw docstring

analyze-bodyclj

(analyze-body body env)
source

analyze-constclj

(analyze-const form env & [type])
source

analyze-fn-methodclj

(analyze-fn-method [params & body :as form] {:keys [locals local] :as env})
source

analyze-formcljmultimethod

Like analyze, but does not mark the form with :top-level true

Like analyze, but does not mark the form with :top-level true
sourceraw docstring

analyze-in-envclj

(analyze-in-env env)

Takes an env map and returns a function that analyzes a form in that env

Takes an env map and returns a function that analyzes a form in that env
sourceraw docstring

analyze-letclj

(analyze-let [op bindings & body :as form] {:keys [context loop-id] :as env})
source

analyze-mapclj

(analyze-map form env)
source

analyze-seqclj

(analyze-seq form env)
source

analyze-setclj

(analyze-set form env)
source

analyze-symbolclj

(analyze-symbol sym env)
source

analyze-vectorclj

(analyze-vector form env)
source

create-varclj

(create-var sym env)

Creates a var for sym and returns it

Creates a var for sym and returns it
sourceraw docstring

empty-envclj

(empty-env)

Returns an empty env

Returns an empty env
sourceraw docstring

macroexpandclj

(macroexpand form env)

Repeatedly calls macroexpand-1 on form until it no longer represents a macro form, then returns it.

Repeatedly calls macroexpand-1 on form until it no longer
represents a macro form, then returns it.
sourceraw docstring

macroexpand-1clj

(macroexpand-1 form env)

If form represents a macro form, returns its expansion, else returns form.

If form represents a macro form, returns its expansion,
else returns form.
sourceraw docstring

parseclj

(parse [op & args] env)

Multimethod that dispatches on op, should default to -parse

Multimethod that dispatches on op, should default to -parse
sourceraw docstring

parse-catchclj

(parse-catch [_ etype ename & body :as form] env)
source

parse-defclj

(parse-def [_ sym & expr :as form] {:keys [ns] :as env})
source

parse-doclj

(parse-do [_ & exprs :as form] env)
source

parse-dotclj

(parse-dot [_ target & [m-or-f & args] :as form] env)
source

parse-fn*clj

(parse-fn* [op & args :as form] env)
source

parse-ifclj

(parse-if [_ test then else :as form] env)
source

parse-invokeclj

(parse-invoke [f & args :as form] env)
source

parse-let*clj

(parse-let* form env)
source

parse-letfn*clj

(parse-letfn* [_ bindings & body :as form] env)
source

parse-loop*clj

(parse-loop* form env)
source

parse-newclj

(parse-new [_ class & args :as form] env)
source

parse-quoteclj

(parse-quote [_ expr :as form] env)
source

parse-recurclj

(parse-recur [_ & exprs :as form] {:keys [context loop-locals loop-id] :as env})
source

parse-set!clj

(parse-set! [_ target val :as form] env)
source

parse-throwclj

(parse-throw [_ throw :as form] env)
source

parse-tryclj

(parse-try [_ & body :as form] env)
source

parse-varclj

(parse-var [_ var :as form] env)
source

specialsclj

Set of special forms common to every clojure variant

Set of special forms common to every clojure variant
sourceraw docstring

valid-binding-symbol?clj

(valid-binding-symbol? s)
source

validate-bindingsclj

(validate-bindings [op bindings & _ :as form] env)
source

var?clj

(var? obj)

Returns true if obj represent a var form as returned by create-var

Returns true if obj represent a var form as returned by create-var
sourceraw docstring

wrapping-metaclj

(wrapping-meta {:keys [form env] :as expr})
source

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

× close