1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
{:all-keys
[[:op "The node op"]
[:form "The clojure form from which the node originated"]
[:env "The environment map"]
^:optional
[:children "A vector of keywords, representing the children nodes of this node, in order of evaluation"]
^:optional
[:raw-forms "If this node's :form has been macroexpanded, a sequence of all the intermediate forms from the original form to the macroexpanded form"]
^:optional
[:top-level "`true` if this is the root node"]]
:node-keys
[{:op :binding
:doc "Node for a binding symbol"
:keys [[:form "The binding symbol"]
[:name "The binding symbol"]
[:local "One of :arg, :catch, :fn, :let, :letfn or :loop"]
^:optional
[:arg-id "When :local is :arg, the parameter index"]
^:optional
[:variadic? "When :local is :arg, a boolean indicating whether this parameter binds to a variable number of arguments"]
^:optional ^:children
[:init "When :local is :let, :letfn or :loop, an AST node representing the bound value"]]}
{:op :catch
:doc "Node for a catch expression"
:keys [[:form "`(catch class local body*)`"]
^:children
[:class "A :maybe-class AST node representing the type of exception to catch"]
^:children
[:local "The :binding AST node for the caught exception"]
^:children
[:body "Synthetic :do AST node (with :body? `true`) representing the body of the catch clause"]]}
{:op :const
:doc "Node for a constant literal or a quoted collection literal"
:keys [[:form "A constant literal or a quoted collection literal"]
[:literal? "`true`"]
[:type "one of :nil, :bool, :keyword, :symbol, :string, :number, :type, :record, :map, :vector, :set, :seq, :char, :regex, :class, :var, or :unknown"]
[:val "The value of the constant node"]
^:optional ^:children
[:meta "An AST node representing the metadata of the constant value, if present. The node will be either a :map node or a :const node with :type :map"]]}
{:op :def
:doc "Node for a def special-form expression"
:keys [[:form "`(def name docstring? init?)`"]
[:name "The var symbol to define in the current namespace"]
[:var "The var object created (or found, if it already existed) named by the symbol :name in the current namespace"]
^:optional ^:children
[:meta "An AST node representing the metadata attached to :name, if present. The node will be either a :map node or a :const node with :type :map"]
^:optional ^:children
[:init "An AST node representing the initial value of the var"]
^:optional
[:doc "The docstring for this var"]]}
{:op :do
:doc "Node for a do special-form expression or for another special-form's body"
:keys [[:form "`(do statement* ret)`"]
^:children
[:statements "A vector of AST nodes representing all but the last expression in the do body"]
^:children
[:ret "An AST node representing the last expression in the do body (the block's return value)"]
^:optional
[:body? "`true` if this node is a synthetic body"]]}
{:op :fn
:doc "Node for a fn* special-form expression"
:keys [[:form "`(fn* name? [arg*] body*)` or `(fn* name? method*)`"]
[:variadic? "`true` if this function contains a variadic arity method"]
[:max-fixed-arity "The number of arguments taken by the fixed-arity method taking the most arguments"]
^:optional ^:children
[:local "A :binding AST node with :local :fn representing the function's local name, if one is supplied"]
^:children
[:methods "A vector of :fn-method AST nodes representing the fn method arities"]
[:once "`true` if the fn is marked as `^:once fn*`, meaning it will only be executed once and thus allowing for the clearing of closed-over locals"]]}
{:op :fn-method
:doc "Node for an arity method in a fn* expression"
:keys [[:form "`([arg*] body*)`"]
[:loop-id "Unique symbol identifying this method as a target for recursion"]
[:variadic? "`true` if this fn-method takes a variable number of arguments"]
^:children
[:params "A vector of :binding AST nodes with :local :arg representing this fn-method args"]
[:fixed-arity "The number of non-variadic args this fn-method takes"]
^:children
[:body "Synthetic :do node (with :body? `true`) representing the body of this fn-method"]]}
{:op :host-call
:doc "Node for a host interop call"
:keys [[:form "`(.method target arg*)`"]
[:method "Symbol naming the method to call"]
^:children
[:target "An AST node representing the target object"]
^:children
[:args "A vector of AST nodes representing the args passed to the method call"]]}
{:op :host-field
:doc "Node for a host interop field access"
:keys [[:form "`(.-field target)`"]
[:field "Symbol naming the field to access"]
^:children
[:target "An AST node representing the target object"]
[:assignable? "`true`"]]}
{:op :host-interop
:doc "Node for a no-arg host interop call or for a host interop field access"
:keys [[:form "`(. target m-or-f)`"]
^:children
[:target "An AST node representing the target object"]
[:m-or-f "Symbol naming the no-arg method or field to access in the target"]
[:assignable? "`true`"]]}
{:op :if
:doc "Node for an if special-form expression"
:keys [[:form "`(if test then else?)`"]
^:children
[:test "An AST node representing the test expression"]
^:children
[:then "An AST node representing the expression's return value if :test evaluated to a truthy value"]
^:children
[:else "An AST node representing the expression's return value if :test evaluated to a falsey value, if not supplied it will default to a :const node representing nil"]]}
{:op :invoke
:doc "Node for an invoke expression"
:keys [[:form "`(f arg*)`"]
^:children
[:fn "An AST node representing the function to invoke"]
^:children
[:args "A vector of AST nodes representing the args to the function"]
^:optional
[:meta "Map of metadata attached to the invoke :form"]]}
{:op :let
:doc "Node for a let* special-form expression"
:keys [[:form "`(let* [binding*] body*)`"]
^:children
[:bindings "A vector of :binding AST nodes with :local :let"]
^:children
[:body "Synthetic :do node (with :body? `true`) representing the body of the let expression"]]}
{:op :letfn
:doc "Node for a letfn* special-form expression"
:keys [[:form "`(letfn* [binding*] body*)`"]
^:children
[:bindings "A vector of :binding AST nodes with :local :letfn"]
^:children
[:body "Synthetic :do node (with :body? `true`) representing the body of the letfn expression"]]}
{:op :local
:doc "Node for a local symbol"
:keys [[:form "The local symbol"]
[:name "The local symbol"]
[:local "One of :arg, :catch, :fn, :let, :letfn or :loop"]
^:optional
[:arg-id "When :local is :arg, the parameter index"]
[:assignable? "`true` if the local is mutable"]
^:optional
[:variadic? "When :local is :arg, a boolean indicating whether this parameter binds to a variable number of arguments"]]}
{:op :loop
:doc "Node a loop* special-form expression"
:keys [[:form "`(loop* [binding*] body*)`"]
^:children
[:bindings "A vector of :binding AST nodes with :local :loop"]
^:children
[:body "Synthetic :do node (with :body? `true`) representing the body of the loop expression"]
[:loop-id "Unique symbol identifying this loop as a target for recursion"]]}
{:op :map
:doc "Node for a map literal"
:keys [[:form "`{[key val]*}`"]
^:children
[:keys "A vector of AST nodes representing the keys of the map"]
^:children
[:vals "A vector of AST nodes representing the vals of the map"]]}
{:op :maybe-class
:doc "Node for a not-namespaced symbol that couldn't be resolved as a var"
:keys [[:form "The not namespaced symbol"]
[:class "The not namespaced symbol that might represent a class"]]}
{:op :maybe-host-form
:doc "Node for namespaced symbol that couldn't be resolved as a var"
:keys [[:form "The namespaced symbol"]
[:class "The namespace part of the symbol, as a symbol"]
[:field "The name part of the symbol, as a symbol"]]}
{:op :new
:doc "Node for a new special-form expression"
:keys [[:form "`(new Class arg*)`"]
^:children
[:class "A :maybe-class AST node :class representing the Class to instantiate"]
^:children
[:args "A vector of AST nodes representing the arguments passed to the Class constructor"]]}
{:op :quote
:doc "Node for a quote special-form expression"
:keys [[:form "`(quote expr)`"]
^:children
[:expr "A :const AST node representing the quoted value"]
[:literal? "`true`"]]}
{:op :recur
:doc "Node for a recur special-form expression"
:keys [[:form "`(recur expr*)`"]
^:children
[:exprs "A vector of AST nodes representing the new bound values for the loop binding on the next loop iteration"]
[:loop-id "Unique symbol identifying the enclosing loop target"]]}
{:op :set
:doc "Node for a set literal"
:keys [[:form "`#{item*}`"]
^:children
[:items "A vector of AST nodes representing the items of the set"]]}
{:op :set!
:doc "Node for a set! special-form expression"
:keys [[:form "`(set! target val)`"]
^:children
[:target "An AST node representing the target of the set! expression, must be :assignable?"]
^:children
[:val "An AST node representing the new value for the target"]]}
{:op :throw
:doc "Node for a throw special-form statement"
:keys [[:form "`(throw exception)`"]
^:children
[:exception "An AST node representing the exception to throw"]]}
{:op :try
:doc "Node for a try special-form expression"
:keys [[:form "`(try body* catch* finally?)`"]
^:children
[:body "Synthetic :do AST node (with :body? `true`) representing the body of this try expression"]
^:children
[:catches "A vector of :catch AST nodes representing the catch clauses of this try expression"]
^:optional ^:children
[:finally "Synthetic :do AST node (with :body? `true`) representing the final clause of this try expression"]]}
{:op :var
:doc "Node for a var symbol"
:keys [[:form "A symbol naming the var"]
[:var "The var object this symbol refers to"]
^:optional
[:assignable? "`true` if the Var is :dynamic"]]}
{:op :vector
:doc "Node for a vector literal with attached metadata and/or non literal elements"
:keys [[:form "`[item*]`"]
^:children
[:items "A vector of AST nodes representing the items of the vector"]]}
{:op :with-meta
:doc "Node for a non quoted collection literal or a fn expression with attached metadata"
:keys [[:form "Non quoted collection literal or fn expression with attached metadata"]
^:children
[:meta "An AST node representing the metadata of expression. The node will be either a :map node or a :const node with :type :map"]
^:children
[:expr "The expression this metadata is attached to, :op is one of :vector, :map, :set or :fn"]]}]}
|