PageRenderTime 95ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/syntax_tools/doc/erl_syntax.html

https://github.com/babo/jungerl
HTML | 2608 lines | 2317 code | 291 blank | 0 comment | 0 complexity | c88080a99e6714ed35d735276bae267c MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, AGPL-1.0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Module erl_syntax</title>
  5. <link rel="stylesheet" type="text/css" href="stylesheet.css">
  6. </head>
  7. <body bgcolor="white">
  8. <h1>Module erl_syntax</h1>
  9. Abstract Erlang syntax trees.<ul><li><a href="#description">Description</a></li><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul><h2><a name="description">Description</a></h2>Abstract Erlang syntax trees.
  10. <p> This module defines an abstract data type for representing Erlang
  11. source code as syntax trees, in a way that is backwards compatible
  12. with the data structures created by the Erlang standard library
  13. parser module <code>erl_parse</code> (often referred to as "parse
  14. trees", which is a bit of a misnomer). This means that all
  15. <code>erl_parse</code> trees are valid abstract syntax trees, but the
  16. reverse is not true: abstract syntax trees can in general not be used
  17. as input to functions expecting an <code>erl_parse</code> tree.
  18. However, as long as an abstract syntax tree represents a correct
  19. Erlang program, the function <a href="#revert-1"><code>revert/1</code></a> should be able to
  20. transform it to the corresponding <code>erl_parse</code>
  21. representation.</p>
  22. <p>A recommended starting point for the first-time user is the
  23. documentation of the <a href="#type-syntaxTree"><code>syntaxTree()</code></a> data type, and
  24. the function <a href="#type-1"><code>type/1</code></a>.</p>
  25. <h3><b>NOTES:</b></h3>
  26. <p>This module deals with the composition and decomposition of
  27. <em>syntactic</em> entities (as opposed to semantic ones); its
  28. purpose is to hide all direct references to the data structures used
  29. to represent these entities. With few exceptions, the functions in
  30. this module perform no semantic interpretation of their inputs, and
  31. in general, the user is assumed to pass type-correct arguments - if
  32. this is not done, the effects are not defined.</p>
  33. <p>With the exception of the <code>erl_parse</code> data structures,
  34. the internal representations of abstract syntax trees are subject to
  35. change without notice, and should not be documented outside this
  36. module. Furthermore, we do not give any guarantees on how an abstract
  37. syntax tree may or may not be represented, <em>with the following
  38. exceptions</em>: no syntax tree is represented by a single atom, such
  39. as <code>none</code>, by a list constructor <code>[X | Y]</code>, or
  40. by the empty list <code>[]</code>. This can be relied on when writing
  41. functions that operate on syntax trees.</p>
  42. <h2><a name="types">Data Types</a></h2>
  43. <h3><a name="type-erl_parse">erl_parse()</a></h3>
  44. <p><tt>erl_parse() = <a href="/usr/local/home/richardc/hipe/otp/lib/stdlib/doc/erl_parse.html#type-parse_tree">erl_parse:parse_tree()</a></tt></p>
  45. <p>The "parse tree"
  46. representation built by the Erlang standard library parser
  47. <code>erl_parse</code>. This is a subset of the
  48. <a href="#type-syntaxTree"><code>syntaxTree</code></a> type.
  49. </p>
  50. <h3><a name="type-syntaxTree">syntaxTree()</a></h3>
  51. <p><b>abstract datatype</b>: <tt>syntaxTree()</tt></p>
  52. <p>An abstract syntax tree. The
  53. <code>erl_parse</code> "parse tree" representation is a subset of the
  54. <code>syntaxTree()</code> representation.
  55. <p>Every abstract syntax tree node has a <em>type</em>, given by the
  56. function <a href="#type-1"><code>type/1</code></a>. Each node also
  57. has associated <em>attributes</em>; see <a href="#get_attrs-1"><code>get_attrs/1</code></a> for details. The
  58. functions <a href="#make_tree-2"><code>make_tree/2</code></a> and <a href="#subtrees-1"><code>subtrees/1</code></a> are generic
  59. constructor/decomposition functions for abstract syntax trees. The
  60. functions <a href="#abstract-1"><code>abstract/1</code></a> and <a href="#concrete-1"><code>concrete/1</code></a> convert between
  61. constant Erlang terms and their syntactic representations. The set of
  62. syntax tree nodes is extensible through the <a href="#tree-2"><code>tree/2</code></a> function.</p>
  63. <p>A syntax tree can be transformed to the <code>erl_parse</code>
  64. representation with the <a href="#revert-1"><code>revert/1</code></a>
  65. function.</p>
  66. </p>
  67. <h3><a name="type-syntaxTreeAttributes">syntaxTreeAttributes()</a></h3>
  68. <p><b>abstract datatype</b>: <tt>syntaxTreeAttributes()</tt></p>
  69. <p>This is an abstract representation of
  70. syntax tree node attributes; see the function <a href="#get_attrs-1"><code>get_attrs/1</code></a>.
  71. </p>
  72. <h2><a name="index">Function Index</a></h2>
  73. <table width="100%" border="1"><tr><td valign="top"><a href="#abstract-1">abstract/1</a></td><td>Returns the syntax tree corresponding to an Erlang term.</td></tr>
  74. <tr><td valign="top"><a href="#add_ann-2">add_ann/2</a></td><td>Appends the term <code>Annotation</code> to the list of user
  75. annotations of <code>Node</code>.</td></tr>
  76. <tr><td valign="top"><a href="#add_postcomments-2">add_postcomments/2</a></td><td>Appends <code>Comments</code> to the post-comments of
  77. <code>Node</code>.</td></tr>
  78. <tr><td valign="top"><a href="#add_precomments-2">add_precomments/2</a></td><td>Appends <code>Comments</code> to the pre-comments of
  79. <code>Node</code>.</td></tr>
  80. <tr><td valign="top"><a href="#application-2">application/2</a></td><td>Creates an abstract function application expression.</td></tr>
  81. <tr><td valign="top"><a href="#application-3">application/3</a></td><td>Creates an abstract function application expression.</td></tr>
  82. <tr><td valign="top"><a href="#application_arguments-1">application_arguments/1</a></td><td>Returns the list of argument subtrees of an
  83. <code>application</code> node.</td></tr>
  84. <tr><td valign="top"><a href="#application_operator-1">application_operator/1</a></td><td>Returns the operator subtree of an <code>application</code>
  85. node.</td></tr>
  86. <tr><td valign="top"><a href="#arity_qualifier-2">arity_qualifier/2</a></td><td>Creates an abstract arity qualifier.</td></tr>
  87. <tr><td valign="top"><a href="#arity_qualifier_argument-1">arity_qualifier_argument/1</a></td><td>Returns the argument (the arity) subtree of an
  88. <code>arity_qualifier</code> node.</td></tr>
  89. <tr><td valign="top"><a href="#arity_qualifier_body-1">arity_qualifier_body/1</a></td><td>Returns the body subtree of an <code>arity_qualifier</code>
  90. node.</td></tr>
  91. <tr><td valign="top"><a href="#atom-1">atom/1</a></td><td>Creates an abstract atom literal.</td></tr>
  92. <tr><td valign="top"><a href="#atom_literal-1">atom_literal/1</a></td><td>Returns the literal string represented by an <code>atom</code>
  93. node.</td></tr>
  94. <tr><td valign="top"><a href="#atom_name-1">atom_name/1</a></td><td>Returns the printname of an <code>atom</code> node.</td></tr>
  95. <tr><td valign="top"><a href="#atom_value-1">atom_value/1</a></td><td>Returns the value represented by an <code>atom</code> node.</td></tr>
  96. <tr><td valign="top"><a href="#attribute-1">attribute/1</a></td><td><p>Equivalent to <a href="#attribute-2"><tt>attribute(Name, none)</tt></a>.</p>
  97. </td></tr>
  98. <tr><td valign="top"><a href="#attribute-2">attribute/2</a></td><td>Creates an abstract program attribute.</td></tr>
  99. <tr><td valign="top"><a href="#attribute_arguments-1">attribute_arguments/1</a></td><td>Returns the list of argument subtrees of an
  100. <code>attribute</code> node, if any.</td></tr>
  101. <tr><td valign="top"><a href="#attribute_name-1">attribute_name/1</a></td><td>Returns the name subtree of an <code>attribute</code> node.</td></tr>
  102. <tr><td valign="top"><a href="#binary-1">binary/1</a></td><td>Creates an abstract binary-object template.</td></tr>
  103. <tr><td valign="top"><a href="#binary_field-1">binary_field/1</a></td><td><p>Equivalent to <a href="#binary_field-2"><tt>binary_field(Body, [])</tt></a>.</p>
  104. </td></tr>
  105. <tr><td valign="top"><a href="#binary_field-2">binary_field/2</a></td><td>Creates an abstract binary template field.</td></tr>
  106. <tr><td valign="top"><a href="#binary_field-3">binary_field/3</a></td><td>Creates an abstract binary template field.</td></tr>
  107. <tr><td valign="top"><a href="#binary_field_body-1">binary_field_body/1</a></td><td>Returns the body subtree of a <code>binary_field</code>.</td></tr>
  108. <tr><td valign="top"><a href="#binary_field_size-1">binary_field_size/1</a></td><td>Returns the size specifier subtree of a
  109. <code>binary_field</code> node, if any.</td></tr>
  110. <tr><td valign="top"><a href="#binary_field_types-1">binary_field_types/1</a></td><td>Returns the list of type-specifier subtrees of a
  111. <code>binary_field</code> node.</td></tr>
  112. <tr><td valign="top"><a href="#binary_fields-1">binary_fields/1</a></td><td>Returns the list of field subtrees of a <code>binary</code>
  113. node.</td></tr>
  114. <tr><td valign="top"><a href="#block_expr-1">block_expr/1</a></td><td>Creates an abstract block expression.</td></tr>
  115. <tr><td valign="top"><a href="#block_expr_body-1">block_expr_body/1</a></td><td>Returns the list of body subtrees of a <code>block_expr</code>
  116. node.</td></tr>
  117. <tr><td valign="top"><a href="#case_expr-2">case_expr/2</a></td><td>Creates an abstract case-expression.</td></tr>
  118. <tr><td valign="top"><a href="#case_expr_argument-1">case_expr_argument/1</a></td><td>Returns the argument subtree of a <code>case_expr</code> node.</td></tr>
  119. <tr><td valign="top"><a href="#case_expr_clauses-1">case_expr_clauses/1</a></td><td>Returns the list of clause subtrees of a <code>case_expr</code>
  120. node.</td></tr>
  121. <tr><td valign="top"><a href="#catch_expr-1">catch_expr/1</a></td><td>Creates an abstract catch-expression.</td></tr>
  122. <tr><td valign="top"><a href="#catch_expr_body-1">catch_expr_body/1</a></td><td>Returns the body subtree of a <code>catch_expr</code> node.</td></tr>
  123. <tr><td valign="top"><a href="#char-1">char/1</a></td><td>Creates an abstract character literal.</td></tr>
  124. <tr><td valign="top"><a href="#char_literal-1">char_literal/1</a></td><td>Returns the literal string represented by a <code>char</code>
  125. node.</td></tr>
  126. <tr><td valign="top"><a href="#char_value-1">char_value/1</a></td><td>Returns the value represented by a <code>char</code> node.</td></tr>
  127. <tr><td valign="top"><a href="#class_qualifier-2">class_qualifier/2</a></td><td>Creates an abstract class qualifier.</td></tr>
  128. <tr><td valign="top"><a href="#class_qualifier_argument-1">class_qualifier_argument/1</a></td><td>Returns the argument (the class) subtree of a
  129. <code>class_qualifier</code> node.</td></tr>
  130. <tr><td valign="top"><a href="#class_qualifier_body-1">class_qualifier_body/1</a></td><td>Returns the body subtree of a <code>class_qualifier</code> node.</td></tr>
  131. <tr><td valign="top"><a href="#clause-2">clause/2</a></td><td><p>Equivalent to <a href="#clause-3"><tt>clause([], Guard, Body)</tt></a>.</p>
  132. </td></tr>
  133. <tr><td valign="top"><a href="#clause-3">clause/3</a></td><td>Creates an abstract clause.</td></tr>
  134. <tr><td valign="top"><a href="#clause_body-1">clause_body/1</a></td><td>Return the list of body subtrees of a <code>clause</code>
  135. node.</td></tr>
  136. <tr><td valign="top"><a href="#clause_guard-1">clause_guard/1</a></td><td>Returns the guard subtree of a <code>clause</code> node, if
  137. any.</td></tr>
  138. <tr><td valign="top"><a href="#clause_patterns-1">clause_patterns/1</a></td><td>Returns the list of pattern subtrees of a <code>clause</code>
  139. node.</td></tr>
  140. <tr><td valign="top"><a href="#comment-1">comment/1</a></td><td><p>Equivalent to <a href="#comment-2"><tt>comment(none, Strings)</tt></a>.</p>
  141. </td></tr>
  142. <tr><td valign="top"><a href="#comment-2">comment/2</a></td><td>Creates an abstract comment with the given padding and text.</td></tr>
  143. <tr><td valign="top"><a href="#comment_padding-1">comment_padding/1</a></td><td>Returns the amount of padding before the comment, or
  144. <code>none</code>.</td></tr>
  145. <tr><td valign="top"><a href="#comment_text-1">comment_text/1</a></td><td>Returns the lines of text of the abstract comment.</td></tr>
  146. <tr><td valign="top"><a href="#compact_list-1">compact_list/1</a></td><td>Yields the most compact form for an abstract list skeleton.</td></tr>
  147. <tr><td valign="top"><a href="#concrete-1">concrete/1</a></td><td>Returns the Erlang term represented by a syntax tree.</td></tr>
  148. <tr><td valign="top"><a href="#cond_expr-1">cond_expr/1</a></td><td>Creates an abstract cond-expression.</td></tr>
  149. <tr><td valign="top"><a href="#cond_expr_clauses-1">cond_expr_clauses/1</a></td><td>Returns the list of clause subtrees of a <code>cond_expr</code>
  150. node.</td></tr>
  151. <tr><td valign="top"><a href="#conjunction-1">conjunction/1</a></td><td>Creates an abstract conjunction.</td></tr>
  152. <tr><td valign="top"><a href="#conjunction_body-1">conjunction_body/1</a></td><td>Returns the list of body subtrees of a
  153. <code>conjunction</code> node.</td></tr>
  154. <tr><td valign="top"><a href="#cons-2">cons/2</a></td><td>"Optimising" list skeleton cons operation.</td></tr>
  155. <tr><td valign="top"><a href="#copy_ann-2">copy_ann/2</a></td><td>Copies the list of user annotations from <code>Source</code> to
  156. <code>Target</code>.</td></tr>
  157. <tr><td valign="top"><a href="#copy_attrs-2">copy_attrs/2</a></td><td>Copies the attributes from <code>Source</code> to
  158. <code>Target</code>.</td></tr>
  159. <tr><td valign="top"><a href="#copy_comments-2">copy_comments/2</a></td><td>Copies the pre- and postcomments from <code>Source</code> to
  160. <code>Target</code>.</td></tr>
  161. <tr><td valign="top"><a href="#copy_pos-2">copy_pos/2</a></td><td>Copies the position information from <code>Source</code> to
  162. <code>Target</code>.</td></tr>
  163. <tr><td valign="top"><a href="#data-1">data/1</a></td><td><em>For special purposes only</em>.</td></tr>
  164. <tr><td valign="top"><a href="#disjunction-1">disjunction/1</a></td><td>Creates an abstract disjunction.</td></tr>
  165. <tr><td valign="top"><a href="#disjunction_body-1">disjunction_body/1</a></td><td>Returns the list of body subtrees of a
  166. <code>disjunction</code> node.</td></tr>
  167. <tr><td valign="top"><a href="#eof_marker-0">eof_marker/0</a></td><td>Creates an abstract end-of-file marker.</td></tr>
  168. <tr><td valign="top"><a href="#error_marker-1">error_marker/1</a></td><td>Creates an abstract error marker.</td></tr>
  169. <tr><td valign="top"><a href="#error_marker_info-1">error_marker_info/1</a></td><td>Returns the ErrorInfo structure of an <code>error_marker</code>
  170. node.</td></tr>
  171. <tr><td valign="top"><a href="#flatten_form_list-1">flatten_form_list/1</a></td><td>Flattens sublists of a <code>form_list</code> node.</td></tr>
  172. <tr><td valign="top"><a href="#float-1">float/1</a></td><td>Creates an abstract floating-point literal.</td></tr>
  173. <tr><td valign="top"><a href="#float_literal-1">float_literal/1</a></td><td>Returns the numeral string represented by a <code>float</code>
  174. node.</td></tr>
  175. <tr><td valign="top"><a href="#float_value-1">float_value/1</a></td><td>Returns the value represented by a <code>float</code> node.</td></tr>
  176. <tr><td valign="top"><a href="#form_list-1">form_list/1</a></td><td>Creates an abstract sequence of "source code forms".</td></tr>
  177. <tr><td valign="top"><a href="#form_list_elements-1">form_list_elements/1</a></td><td>Returns the list of subnodes of a <code>form_list</code> node.</td></tr>
  178. <tr><td valign="top"><a href="#fun_expr-1">fun_expr/1</a></td><td>Creates an abstract fun-expression.</td></tr>
  179. <tr><td valign="top"><a href="#fun_expr_arity-1">fun_expr_arity/1</a></td><td>Returns the arity of a <code>fun_expr</code> node.</td></tr>
  180. <tr><td valign="top"><a href="#fun_expr_clauses-1">fun_expr_clauses/1</a></td><td>Returns the list of clause subtrees of a <code>fun_expr</code>
  181. node.</td></tr>
  182. <tr><td valign="top"><a href="#function-2">function/2</a></td><td>Creates an abstract function definition.</td></tr>
  183. <tr><td valign="top"><a href="#function_arity-1">function_arity/1</a></td><td>Returns the arity of a <code>function</code> node.</td></tr>
  184. <tr><td valign="top"><a href="#function_clauses-1">function_clauses/1</a></td><td>Returns the list of clause subtrees of a <code>function</code>
  185. node.</td></tr>
  186. <tr><td valign="top"><a href="#function_name-1">function_name/1</a></td><td>Returns the name subtree of a <code>function</code> node.</td></tr>
  187. <tr><td valign="top"><a href="#generator-2">generator/2</a></td><td>Creates an abstract generator.</td></tr>
  188. <tr><td valign="top"><a href="#generator_body-1">generator_body/1</a></td><td>Returns the body subtree of a <code>generator</code> node.</td></tr>
  189. <tr><td valign="top"><a href="#generator_pattern-1">generator_pattern/1</a></td><td>Returns the pattern subtree of a <code>generator</code> node.</td></tr>
  190. <tr><td valign="top"><a href="#get_ann-1">get_ann/1</a></td><td>Returns the list of user annotations associated with a syntax
  191. tree node.</td></tr>
  192. <tr><td valign="top"><a href="#get_attrs-1">get_attrs/1</a></td><td>Returns a representation of the attributes associated with a
  193. syntax tree node.</td></tr>
  194. <tr><td valign="top"><a href="#get_pos-1">get_pos/1</a></td><td>Returns the position information associated with
  195. <code>Node</code>.</td></tr>
  196. <tr><td valign="top"><a href="#get_postcomments-1">get_postcomments/1</a></td><td>Returns the associated post-comments of a node.</td></tr>
  197. <tr><td valign="top"><a href="#get_precomments-1">get_precomments/1</a></td><td>Returns the associated pre-comments of a node.</td></tr>
  198. <tr><td valign="top"><a href="#has_comments-1">has_comments/1</a></td><td>Yields <code>false</code> if the node has no associated
  199. comments, and <code>true</code> otherwise.</td></tr>
  200. <tr><td valign="top"><a href="#if_expr-1">if_expr/1</a></td><td>Creates an abstract if-expression.</td></tr>
  201. <tr><td valign="top"><a href="#if_expr_clauses-1">if_expr_clauses/1</a></td><td>Returns the list of clause subtrees of an <code>if_expr</code>
  202. node.</td></tr>
  203. <tr><td valign="top"><a href="#implicit_fun-1">implicit_fun/1</a></td><td>Creates an abstract "implicit fun" expression.</td></tr>
  204. <tr><td valign="top"><a href="#implicit_fun-2">implicit_fun/2</a></td><td>Creates an abstract "implicit fun" expression.</td></tr>
  205. <tr><td valign="top"><a href="#implicit_fun_name-1">implicit_fun_name/1</a></td><td>Returns the name subtree of an <code>implicit_fun</code> node.</td></tr>
  206. <tr><td valign="top"><a href="#infix_expr-3">infix_expr/3</a></td><td>Creates an abstract infix operator expression.</td></tr>
  207. <tr><td valign="top"><a href="#infix_expr_left-1">infix_expr_left/1</a></td><td>Returns the left argument subtree of an
  208. <code>infix_expr</code> node.</td></tr>
  209. <tr><td valign="top"><a href="#infix_expr_operator-1">infix_expr_operator/1</a></td><td>Returns the operator subtree of an <code>infix_expr</code>
  210. node.</td></tr>
  211. <tr><td valign="top"><a href="#infix_expr_right-1">infix_expr_right/1</a></td><td>Returns the right argument subtree of an
  212. <code>infix_expr</code> node.</td></tr>
  213. <tr><td valign="top"><a href="#integer-1">integer/1</a></td><td>Creates an abstract integer literal.</td></tr>
  214. <tr><td valign="top"><a href="#integer_literal-1">integer_literal/1</a></td><td>Returns the numeral string represented by an
  215. <code>integer</code> node.</td></tr>
  216. <tr><td valign="top"><a href="#integer_value-1">integer_value/1</a></td><td>Returns the value represented by an <code>integer</code> node.</td></tr>
  217. <tr><td valign="top"><a href="#is_atom-2">is_atom/2</a></td><td>Returns <code>true</code> if <code>Node</code> has type
  218. <code>atom</code> and represents <code>Value</code>, otherwise
  219. <code>false</code>.</td></tr>
  220. <tr><td valign="top"><a href="#is_char-2">is_char/2</a></td><td>Returns <code>true</code> if <code>Node</code> has type
  221. <code>char</code> and represents <code>Value</code>, otherwise
  222. <code>false</code>.</td></tr>
  223. <tr><td valign="top"><a href="#is_form-1">is_form/1</a></td><td>Returns <code>true</code> if <code>Node</code> is a syntax tree
  224. representing a so-called "source code form", otherwise
  225. <code>false</code>.</td></tr>
  226. <tr><td valign="top"><a href="#is_integer-2">is_integer/2</a></td><td>Returns <code>true</code> if <code>Node</code> has type
  227. <code>integer</code> and represents <code>Value</code>, otherwise
  228. <code>false</code>.</td></tr>
  229. <tr><td valign="top"><a href="#is_leaf-1">is_leaf/1</a></td><td>Returns <code>true</code> if <code>Node</code> is a leaf node,
  230. otherwise <code>false</code>.</td></tr>
  231. <tr><td valign="top"><a href="#is_list_skeleton-1">is_list_skeleton/1</a></td><td>Returns <code>true</code> if <code>Node</code> has type
  232. <code>list</code> or <code>nil</code>, otherwise <code>false</code>.</td></tr>
  233. <tr><td valign="top"><a href="#is_literal-1">is_literal/1</a></td><td>Returns <code>true</code> if <code>Node</code> represents a
  234. literal term, otherwise <code>false</code>.</td></tr>
  235. <tr><td valign="top"><a href="#is_proper_list-1">is_proper_list/1</a></td><td>Returns <code>true</code> if <code>Node</code> represents a
  236. proper list, and <code>false</code> otherwise.</td></tr>
  237. <tr><td valign="top"><a href="#is_string-2">is_string/2</a></td><td>Returns <code>true</code> if <code>Node</code> has type
  238. <code>string</code> and represents <code>Value</code>, otherwise
  239. <code>false</code>.</td></tr>
  240. <tr><td valign="top"><a href="#is_tree-1">is_tree/1</a></td><td><em>For special purposes only</em>.</td></tr>
  241. <tr><td valign="top"><a href="#join_comments-2">join_comments/2</a></td><td>Appends the comments of <code>Source</code> to the current
  242. comments of <code>Target</code>.</td></tr>
  243. <tr><td valign="top"><a href="#list-1">list/1</a></td><td><p>Equivalent to <a href="#list-2"><tt>list(List, none)</tt></a>.</p>
  244. </td></tr>
  245. <tr><td valign="top"><a href="#list-2">list/2</a></td><td>Constructs an abstract list skeleton.</td></tr>
  246. <tr><td valign="top"><a href="#list_comp-2">list_comp/2</a></td><td>Creates an abstract list comprehension.</td></tr>
  247. <tr><td valign="top"><a href="#list_comp_body-1">list_comp_body/1</a></td><td>Returns the list of body subtrees of a <code>list_comp</code>
  248. node.</td></tr>
  249. <tr><td valign="top"><a href="#list_comp_template-1">list_comp_template/1</a></td><td>Returns the template subtree of a <code>list_comp</code> node.</td></tr>
  250. <tr><td valign="top"><a href="#list_elements-1">list_elements/1</a></td><td>Returns the list of element subtrees of a list skeleton.</td></tr>
  251. <tr><td valign="top"><a href="#list_head-1">list_head/1</a></td><td>Returns the head element subtree of a <code>list</code> node.</td></tr>
  252. <tr><td valign="top"><a href="#list_length-1">list_length/1</a></td><td>Returns the number of element subtrees of a list skeleton.</td></tr>
  253. <tr><td valign="top"><a href="#list_prefix-1">list_prefix/1</a></td><td>Returns the prefix element subtrees of a <code>list</code> node.</td></tr>
  254. <tr><td valign="top"><a href="#list_suffix-1">list_suffix/1</a></td><td>Returns the suffix subtree of a <code>list</code> node, if one
  255. exists.</td></tr>
  256. <tr><td valign="top"><a href="#list_tail-1">list_tail/1</a></td><td>Returns the tail of a <code>list</code> node.</td></tr>
  257. <tr><td valign="top"><a href="#macro-1">macro/1</a></td><td><p>Equivalent to <a href="#macro-2"><tt>macro(Name, none)</tt></a>.</p>
  258. </td></tr>
  259. <tr><td valign="top"><a href="#macro-2">macro/2</a></td><td>Creates an abstract macro application.</td></tr>
  260. <tr><td valign="top"><a href="#macro_arguments-1">macro_arguments/1</a></td><td>Returns the list of argument subtrees of a <code>macro</code>
  261. node, if any.</td></tr>
  262. <tr><td valign="top"><a href="#macro_name-1">macro_name/1</a></td><td>Returns the name subtree of a <code>macro</code> node.</td></tr>
  263. <tr><td valign="top"><a href="#make_tree-2">make_tree/2</a></td><td>Creates a syntax tree with the given type and subtrees.</td></tr>
  264. <tr><td valign="top"><a href="#match_expr-2">match_expr/2</a></td><td>Creates an abstract match-expression.</td></tr>
  265. <tr><td valign="top"><a href="#match_expr_body-1">match_expr_body/1</a></td><td>Returns the body subtree of a <code>match_expr</code> node.</td></tr>
  266. <tr><td valign="top"><a href="#match_expr_pattern-1">match_expr_pattern/1</a></td><td>Returns the pattern subtree of a <code>match_expr</code> node.</td></tr>
  267. <tr><td valign="top"><a href="#meta-1">meta/1</a></td><td>Creates a meta-representation of a syntax tree.</td></tr>
  268. <tr><td valign="top"><a href="#module_qualifier-2">module_qualifier/2</a></td><td>Creates an abstract module qualifier.</td></tr>
  269. <tr><td valign="top"><a href="#module_qualifier_argument-1">module_qualifier_argument/1</a></td><td>Returns the argument (the module) subtree of a
  270. <code>module_qualifier</code> node.</td></tr>
  271. <tr><td valign="top"><a href="#module_qualifier_body-1">module_qualifier_body/1</a></td><td>Returns the body subtree of a <code>module_qualifier</code>
  272. node.</td></tr>
  273. <tr><td valign="top"><a href="#nil-0">nil/0</a></td><td>Creates an abstract empty list.</td></tr>
  274. <tr><td valign="top"><a href="#normalize_list-1">normalize_list/1</a></td><td>Expands an abstract list skeleton to its most explicit form.</td></tr>
  275. <tr><td valign="top"><a href="#operator-1">operator/1</a></td><td>Creates an abstract operator.</td></tr>
  276. <tr><td valign="top"><a href="#operator_literal-1">operator_literal/1</a></td><td>Returns the literal string represented by an
  277. <code>operator</code> node.</td></tr>
  278. <tr><td valign="top"><a href="#operator_name-1">operator_name/1</a></td><td>Returns the name of an <code>operator</code> node.</td></tr>
  279. <tr><td valign="top"><a href="#parentheses-1">parentheses/1</a></td><td>Creates an abstract parenthesised expression.</td></tr>
  280. <tr><td valign="top"><a href="#parentheses_body-1">parentheses_body/1</a></td><td>Returns the body subtree of a <code>parentheses</code> node.</td></tr>
  281. <tr><td valign="top"><a href="#prefix_expr-2">prefix_expr/2</a></td><td>Creates an abstract prefix operator expression.</td></tr>
  282. <tr><td valign="top"><a href="#prefix_expr_argument-1">prefix_expr_argument/1</a></td><td>Returns the argument subtree of a <code>prefix_expr</code>
  283. node.</td></tr>
  284. <tr><td valign="top"><a href="#prefix_expr_operator-1">prefix_expr_operator/1</a></td><td>Returns the operator subtree of a <code>prefix_expr</code>
  285. node.</td></tr>
  286. <tr><td valign="top"><a href="#qualified_name-1">qualified_name/1</a></td><td>Creates an abstract qualified name.</td></tr>
  287. <tr><td valign="top"><a href="#qualified_name_segments-1">qualified_name_segments/1</a></td><td>Returns the list of name segments of a
  288. <code>qualified_name</code> node.</td></tr>
  289. <tr><td valign="top"><a href="#query_expr-1">query_expr/1</a></td><td>Creates an abstract Mnemosyne query expression.</td></tr>
  290. <tr><td valign="top"><a href="#query_expr_body-1">query_expr_body/1</a></td><td>Returns the body subtree of a <code>query_expr</code> node.</td></tr>
  291. <tr><td valign="top"><a href="#receive_expr-1">receive_expr/1</a></td><td><p>Equivalent to <a href="#receive_expr-3"><tt>receive_expr(Clauses, none, [])</tt></a>.</p>
  292. </td></tr>
  293. <tr><td valign="top"><a href="#receive_expr-3">receive_expr/3</a></td><td>Creates an abstract receive-expression.</td></tr>
  294. <tr><td valign="top"><a href="#receive_expr_action-1">receive_expr_action/1</a></td><td>Returns the list of action body subtrees of a
  295. <code>receive_expr</code> node.</td></tr>
  296. <tr><td valign="top"><a href="#receive_expr_clauses-1">receive_expr_clauses/1</a></td><td>Returns the list of clause subtrees of a
  297. <code>receive_expr</code> node.</td></tr>
  298. <tr><td valign="top"><a href="#receive_expr_timeout-1">receive_expr_timeout/1</a></td><td>Returns the timeout subtree of a <code>receive_expr</code> node,
  299. if any.</td></tr>
  300. <tr><td valign="top"><a href="#record_access-2">record_access/2</a></td><td><p>Equivalent to <a href="#record_access-3"><tt>record_access(Argument, none, Field)</tt></a>.</p>
  301. </td></tr>
  302. <tr><td valign="top"><a href="#record_access-3">record_access/3</a></td><td>Creates an abstract record field access expression.</td></tr>
  303. <tr><td valign="top"><a href="#record_access_argument-1">record_access_argument/1</a></td><td>Returns the argument subtree of a <code>record_access</code>
  304. node.</td></tr>
  305. <tr><td valign="top"><a href="#record_access_field-1">record_access_field/1</a></td><td>Returns the field subtree of a <code>record_access</code>
  306. node.</td></tr>
  307. <tr><td valign="top"><a href="#record_access_type-1">record_access_type/1</a></td><td>Returns the type subtree of a <code>record_access</code> node,
  308. if any.</td></tr>
  309. <tr><td valign="top"><a href="#record_expr-2">record_expr/2</a></td><td><p>Equivalent to <a href="#record_expr-3"><tt>record_expr(none, Type, Fields)</tt></a>.</p>
  310. </td></tr>
  311. <tr><td valign="top"><a href="#record_expr-3">record_expr/3</a></td><td>Creates an abstract record expression.</td></tr>
  312. <tr><td valign="top"><a href="#record_expr_argument-1">record_expr_argument/1</a></td><td>Returns the argument subtree of a <code>record_expr</code> node,
  313. if any.</td></tr>
  314. <tr><td valign="top"><a href="#record_expr_fields-1">record_expr_fields/1</a></td><td>Returns the list of field subtrees of a
  315. <code>record_expr</code> node.</td></tr>
  316. <tr><td valign="top"><a href="#record_expr_type-1">record_expr_type/1</a></td><td>Returns the type subtree of a <code>record_expr</code> node.</td></tr>
  317. <tr><td valign="top"><a href="#record_field-1">record_field/1</a></td><td><p>Equivalent to <a href="#record_field-2"><tt>record_field(Name, none)</tt></a>.</p>
  318. </td></tr>
  319. <tr><td valign="top"><a href="#record_field-2">record_field/2</a></td><td>Creates an abstract record field specification.</td></tr>
  320. <tr><td valign="top"><a href="#record_field_name-1">record_field_name/1</a></td><td>Returns the name subtree of a <code>record_field</code> node.</td></tr>
  321. <tr><td valign="top"><a href="#record_field_value-1">record_field_value/1</a></td><td>Returns the value subtree of a <code>record_field</code> node,
  322. if any.</td></tr>
  323. <tr><td valign="top"><a href="#record_index_expr-2">record_index_expr/2</a></td><td>Creates an abstract record field index expression.</td></tr>
  324. <tr><td valign="top"><a href="#record_index_expr_field-1">record_index_expr_field/1</a></td><td>Returns the field subtree of a <code>record_index_expr</code>
  325. node.</td></tr>
  326. <tr><td valign="top"><a href="#record_index_expr_type-1">record_index_expr_type/1</a></td><td>Returns the type subtree of a <code>record_index_expr</code>
  327. node.</td></tr>
  328. <tr><td valign="top"><a href="#remove_comments-1">remove_comments/1</a></td><td>Clears the associated comments of <code>Node</code>.</td></tr>
  329. <tr><td valign="top"><a href="#revert-1">revert/1</a></td><td>Returns an <code>erl_parse</code>-compatible representation of a
  330. syntax tree, if possible.</td></tr>
  331. <tr><td valign="top"><a href="#revert_forms-1">revert_forms/1</a></td><td>Reverts a sequence of Erlang source code forms.</td></tr>
  332. <tr><td valign="top"><a href="#rule-2">rule/2</a></td><td>Creates an abstract Mnemosyne rule.</td></tr>
  333. <tr><td valign="top"><a href="#rule_arity-1">rule_arity/1</a></td><td>Returns the arity of a <code>rule</code> node.</td></tr>
  334. <tr><td valign="top"><a href="#rule_clauses-1">rule_clauses/1</a></td><td>Returns the list of clause subtrees of a <code>rule</code> node.</td></tr>
  335. <tr><td valign="top"><a href="#rule_name-1">rule_name/1</a></td><td>Returns the name subtree of a <code>rule</code> node.</td></tr>
  336. <tr><td valign="top"><a href="#set_ann-2">set_ann/2</a></td><td>Sets the list of user annotations of <code>Node</code> to
  337. <code>Annotations</code>.</td></tr>
  338. <tr><td valign="top"><a href="#set_attrs-2">set_attrs/2</a></td><td>Sets the attributes of <code>Node</code> to
  339. <code>Attributes</code>.</td></tr>
  340. <tr><td valign="top"><a href="#set_pos-2">set_pos/2</a></td><td>Sets the position information of <code>Node</code> to
  341. <code>Pos</code>.</td></tr>
  342. <tr><td valign="top"><a href="#set_postcomments-2">set_postcomments/2</a></td><td>Sets the post-comments of <code>Node</code> to
  343. <code>Comments</code>.</td></tr>
  344. <tr><td valign="top"><a href="#set_precomments-2">set_precomments/2</a></td><td>Sets the pre-comments of <code>Node</code> to
  345. <code>Comments</code>.</td></tr>
  346. <tr><td valign="top"><a href="#size_qualifier-2">size_qualifier/2</a></td><td>Creates an abstract size qualifier.</td></tr>
  347. <tr><td valign="top"><a href="#size_qualifier_argument-1">size_qualifier_argument/1</a></td><td>Returns the argument subtree (the size) of a
  348. <code>size_qualifier</code> node.</td></tr>
  349. <tr><td valign="top"><a href="#size_qualifier_body-1">size_qualifier_body/1</a></td><td>Returns the body subtree of a <code>size_qualifier</code>
  350. node.</td></tr>
  351. <tr><td valign="top"><a href="#string-1">string/1</a></td><td>Creates an abstract string literal.</td></tr>
  352. <tr><td valign="top"><a href="#string_literal-1">string_literal/1</a></td><td>Returns the literal string represented by a <code>string</code>
  353. node.</td></tr>
  354. <tr><td valign="top"><a href="#string_value-1">string_value/1</a></td><td>Returns the value represented by a <code>string</code> node.</td></tr>
  355. <tr><td valign="top"><a href="#subtrees-1">subtrees/1</a></td><td>Returns the grouped list of all subtrees of a syntax tree.</td></tr>
  356. <tr><td valign="top"><a href="#text-1">text/1</a></td><td>Creates an abstract piece of source code text.</td></tr>
  357. <tr><td valign="top"><a href="#text_string-1">text_string/1</a></td><td>Returns the character sequence represented by a
  358. <code>text</code> node.</td></tr>
  359. <tr><td valign="top"><a href="#tree-1">tree/1</a></td><td><p>Equivalent to <a href="#tree-2"><tt>tree(Type, [])</tt></a>.</p>
  360. </td></tr>
  361. <tr><td valign="top"><a href="#tree-2">tree/2</a></td><td><em>For special purposes only</em>.</td></tr>
  362. <tr><td valign="top"><a href="#try_after_expr-2">try_after_expr/2</a></td><td><p>Equivalent to <a href="#try_expr-4"><tt>try_expr(Body, [], [], After)</tt></a>.</p>
  363. </td></tr>
  364. <tr><td valign="top"><a href="#try_expr-2">try_expr/2</a></td><td><p>Equivalent to <a href="#try_expr-3"><tt>try_expr(Body, [], Handlers)</tt></a>.</p>
  365. </td></tr>
  366. <tr><td valign="top"><a href="#try_expr-3">try_expr/3</a></td><td><p>Equivalent to <a href="#try_expr-4"><tt>try_expr(Body, Clauses, Handlers, [])</tt></a>.</p>
  367. </td></tr>
  368. <tr><td valign="top"><a href="#try_expr-4">try_expr/4</a></td><td>Creates an abstract try-expression.</td></tr>
  369. <tr><td valign="top"><a href="#try_expr_after-1">try_expr_after/1</a></td><td>Returns the list of "after" subtrees of a <code>try_expr</code>
  370. node.</td></tr>
  371. <tr><td valign="top"><a href="#try_expr_body-1">try_expr_body/1</a></td><td>Returns the list of body subtrees of a <code>try_expr</code>
  372. node.</td></tr>
  373. <tr><td valign="top"><a href="#try_expr_clauses-1">try_expr_clauses/1</a></td><td>Returns the list of case-clause subtrees of a
  374. <code>try_expr</code> node.</td></tr>
  375. <tr><td valign="top"><a href="#try_expr_handlers-1">try_expr_handlers/1</a></td><td>Returns the list of handler-clause subtrees of a
  376. <code>try_expr</code> node.</td></tr>
  377. <tr><td valign="top"><a href="#tuple-1">tuple/1</a></td><td>Creates an abstract tuple.</td></tr>
  378. <tr><td valign="top"><a href="#tuple_elements-1">tuple_elements/1</a></td><td>Returns the list of element subtrees of a <code>tuple</code>
  379. node.</td></tr>
  380. <tr><td valign="top"><a href="#tuple_size-1">tuple_size/1</a></td><td>Returns the number of elements of a <code>tuple</code> node.</td></tr>
  381. <tr><td valign="top"><a href="#type-1">type/1</a></td><td>Returns the type tag of <code>Node</code>.</td></tr>
  382. <tr><td valign="top"><a href="#underscore-0">underscore/0</a></td><td>Creates an abstract universal pattern ("<code>_</code>").</td></tr>
  383. <tr><td valign="top"><a href="#update_tree-2">update_tree/2</a></td><td>Creates a syntax tree with the same type and attributes as the
  384. given tree.</td></tr>
  385. <tr><td valign="top"><a href="#variable-1">variable/1</a></td><td>Creates an abstract variable with the given name.</td></tr>
  386. <tr><td valign="top"><a href="#variable_literal-1">variable_literal/1</a></td><td>Returns the name of a <code>variable</code> node as a string.</td></tr>
  387. <tr><td valign="top"><a href="#variable_name-1">variable_name/1</a></td><td>Returns the name of a <code>variable</code> node as an atom.</td></tr>
  388. <tr><td valign="top"><a href="#warning_marker-1">warning_marker/1</a></td><td>Creates an abstract warning marker.</td></tr>
  389. <tr><td valign="top"><a href="#warning_marker_info-1">warning_marker_info/1</a></td><td>Returns the ErrorInfo structure of a <code>warning_marker</code>
  390. node.</td></tr>
  391. </table>
  392. <h2><a name="functions">Function Details</a></h2>
  393. <h3><a name="abstract-1">abstract/1</a></h3>
  394. <p><tt>abstract(Term::term()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  395. <p>Returns the syntax tree corresponding to an Erlang term.
  396. <code>Term</code> must be a literal term, i.e., one that can be
  397. represented as a source code literal. Thus, it may not contain a
  398. process identifier, port, reference, binary or function value as a
  399. subterm. The function recognises printable strings, in order to get a
  400. compact and readable representation. Evaluation fails with reason
  401. <code>badarg</code> if <code>Term</code> is not a literal term.
  402. </p>
  403. <p><b>See also:</b> <a href="#concrete-1">concrete/1</a>, <a href="#is_literal-1">is_literal/1</a>.</p>
  404. <h3><a name="add_ann-2">add_ann/2</a></h3>
  405. <p><tt>add_ann(Annotation::term(), Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  406. <p>Appends the term <code>Annotation</code> to the list of user
  407. annotations of <code>Node</code>.
  408. <p>Note: this is equivalent to <code>set_ann(Node, [Annotation |
  409. get_ann(Node)])</code>, but potentially more efficient.</p>
  410. </p>
  411. <p><b>See also:</b> <a href="#get_ann-1">get_ann/1</a>, <a href="#set_ann-2">set_ann/2</a>.</p>
  412. <h3><a name="add_postcomments-2">add_postcomments/2</a></h3>
  413. <p><tt>add_postcomments(Comments::[<a href="#type-syntaxTree">syntaxTree()</a>], Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  414. <p>Appends <code>Comments</code> to the post-comments of
  415. <code>Node</code>.
  416. <p>Note: This is equivalent to <code>set_postcomments(Node,
  417. get_postcomments(Node) ++ Comments)</code>, but potentially more
  418. efficient.</p>
  419. </p>
  420. <p><b>See also:</b> <a href="#add_precomments-2">add_precomments/2</a>, <a href="#comment-2">comment/2</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#join_comments-2">join_comments/2</a>, <a href="#set_postcomments-2">set_postcomments/2</a>.</p>
  421. <h3><a name="add_precomments-2">add_precomments/2</a></h3>
  422. <p><tt>add_precomments(Comments::[<a href="#type-syntaxTree">syntaxTree()</a>], Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  423. <p>Appends <code>Comments</code> to the pre-comments of
  424. <code>Node</code>.
  425. <p>Note: This is equivalent to <code>set_precomments(Node,
  426. get_precomments(Node) ++ Comments)</code>, but potentially more
  427. efficient.</p>
  428. </p>
  429. <p><b>See also:</b> <a href="#add_postcomments-2">add_postcomments/2</a>, <a href="#comment-2">comment/2</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#join_comments-2">join_comments/2</a>, <a href="#set_precomments-2">set_precomments/2</a>.</p>
  430. <h3><a name="application-2">application/2</a></h3>
  431. <p><tt>application(Operator::<a href="#type-syntaxTree">syntaxTree()</a>, Arguments::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  432. <p>Creates an abstract function application expression. If
  433. <code>Arguments</code> is <code>[A1, ..., An]</code>, the result
  434. represents "<code><em>Operator</em>(<em>A1</em>, ...,
  435. <em>An</em>)</code>".
  436. </p>
  437. <p><b>See also:</b> <a href="#application-3">application/3</a>, <a href="#application_arguments-1">application_arguments/1</a>, <a href="#application_operator-1">application_operator/1</a>.</p>
  438. <h3><a name="application-3">application/3</a></h3>
  439. <p><tt>application(Module, Function::<a href="#type-syntaxTree">syntaxTree()</a>, Arguments::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  440. <ul><li><tt>Module = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  441. <p>Creates an abstract function application expression. (Utility
  442. function.) If <code>Module</code> is <code>none</code>, this is
  443. call is equivalent to <code>application(Function,
  444. Arguments)</code>, otherwise it is equivalent to
  445. <code>application(module_qualifier(Module, Function),
  446. Arguments)</code>.
  447. </p>
  448. <p><b>See also:</b> <a href="#application-2">application/2</a>, <a href="#module_qualifier-2">module_qualifier/2</a>.</p>
  449. <h3><a name="application_arguments-1">application_arguments/1</a></h3>
  450. <p><tt>application_arguments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  451. <p>Returns the list of argument subtrees of an
  452. <code>application</code> node.
  453. </p>
  454. <p><b>See also:</b> <a href="#application-2">application/2</a>.</p>
  455. <h3><a name="application_operator-1">application_operator/1</a></h3>
  456. <p><tt>application_operator(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  457. <p>Returns the operator subtree of an <code>application</code>
  458. node.
  459. <p>Note: if <code>Node</code> represents
  460. "<code><em>M</em>:<em>F</em>(...)</code>", then the result is the
  461. subtree representing "<code><em>M</em>:<em>F</em></code>".</p>
  462. </p>
  463. <p><b>See also:</b> <a href="#application-2">application/2</a>, <a href="#module_qualifier-2">module_qualifier/2</a>.</p>
  464. <h3><a name="arity_qualifier-2">arity_qualifier/2</a></h3>
  465. <p><tt>arity_qualifier(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Arity::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  466. <p>Creates an abstract arity qualifier. The result represents
  467. "<code><em>Body</em>/<em>Arity</em></code>".
  468. </p>
  469. <p><b>See also:</b> <a href="#arity_qualifier_argument-1">arity_qualifier_argument/1</a>, <a href="#arity_qualifier_body-1">arity_qualifier_body/1</a>.</p>
  470. <h3><a name="arity_qualifier_argument-1">arity_qualifier_argument/1</a></h3>
  471. <p><tt>arity_qualifier_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  472. <p>Returns the argument (the arity) subtree of an
  473. <code>arity_qualifier</code> node.
  474. </p>
  475. <p><b>See also:</b> <a href="#arity_qualifier-1">arity_qualifier/1</a>.</p>
  476. <h3><a name="arity_qualifier_body-1">arity_qualifier_body/1</a></h3>
  477. <p><tt>arity_qualifier_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  478. <p>Returns the body subtree of an <code>arity_qualifier</code>
  479. node.
  480. </p>
  481. <p><b>See also:</b> <a href="#arity_qualifier-1">arity_qualifier/1</a>.</p>
  482. <h3><a name="atom-1">atom/1</a></h3>
  483. <p><tt>atom(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  484. <ul><li><tt>Name = atom() | string()</tt></li></ul></p>
  485. <p>Creates an abstract atom literal. The print name of the atom is
  486. the character sequence represented by <code>Name</code>.
  487. </p>
  488. <p><b>See also:</b> <a href="#atom_literal-1">atom_literal/1</a>, <a href="#atom_name-1">atom_name/1</a>, <a href="#atom_value-1">atom_value/1</a>, <a href="#is_atom-2">is_atom/2</a>.</p>
  489. <h3><a name="atom_literal-1">atom_literal/1</a></h3>
  490. <p><tt>atom_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  491. <p>Returns the literal string represented by an <code>atom</code>
  492. node. This includes surrounding single-quote characters if necessary.
  493. <p>Note that e.g. the result of <code>atom("x\ny")</code> represents
  494. any and all of <code>'x\ny'</code>, <code>'x\12y'</code>,
  495. <code>'x\012y'</code> and <code>'x\^Jy\'</code>; cf.
  496. <code>string/1</code>.</p>
  497. </p>
  498. <p><b>See also:</b> <a href="#atom-1">atom/1</a>, <a href="#string-1">string/1</a>.</p>
  499. <h3><a name="atom_name-1">atom_name/1</a></h3>
  500. <p><tt>atom_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  501. <p>Returns the printname of an <code>atom</code> node.
  502. </p>
  503. <p><b>See also:</b> <a href="#atom-1">atom/1</a>.</p>
  504. <h3><a name="atom_value-1">atom_value/1</a></h3>
  505. <p><tt>atom_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; atom()</tt></p>
  506. <p>Returns the value represented by an <code>atom</code> node.
  507. </p>
  508. <p><b>See also:</b> <a href="#atom-1">atom/1</a>.</p>
  509. <h3><a name="attribute-1">attribute/1</a></h3>
  510. <p><tt>attribute(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  511. <p>Equivalent to <a href="#attribute-2"><tt>attribute(Name, none)</tt></a>.</p>
  512. <h3><a name="attribute-2">attribute/2</a></h3>
  513. <p><tt>attribute(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Args::Arguments) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  514. <ul><li><tt>Arguments = none | [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></li></ul></p>
  515. <p>Creates an abstract program attribute. If
  516. <code>Arguments</code> is <code>[A1, ..., An]</code>, the result
  517. represents "<code>-<em>Name</em>(<em>A1</em>, ...,
  518. <em>An</em>).</code>". Otherwise, if <code>Arguments</code> is
  519. <code>none</code>, the result represents
  520. "<code>-<em>Name</em>.</code>". The latter form makes it possible
  521. to represent preprocessor directives such as
  522. "<code>-endif.</code>". Attributes are source code forms.
  523. <p>Note: The preprocessor macro definition directive
  524. "<code>-define(<em>Name</em>, <em>Body</em>).</code>" has relatively
  525. few requirements on the syntactical form of <code>Body</code> (viewed
  526. as a sequence of tokens). The <code>text</code> node type can be used
  527. for a <code>Body</code> that is not a normal Erlang construct.</p>
  528. </p>
  529. <p><b>See also:</b> <a href="#attribute-1">attribute/1</a>, <a href="#attribute_arguments-1">attribute_arguments/1</a>, <a href="#attribute_name-1">attribute_name/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#text-1">text/1</a>.</p>
  530. <h3><a name="attribute_arguments-1">attribute_arguments/1</a></h3>
  531. <p><tt>attribute_arguments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  532. <p>Returns the list of argument subtrees of an
  533. <code>attribute</code> node, if any. If <code>Node</code>
  534. represents "<code>-<em>Name</em>.</code>", the result is
  535. <code>none</code>. Otherwise, if <code>Node</code> represents
  536. "<code>-<em>Name</em>(<em>E1</em>, ..., <em>En</em>).</code>",
  537. <code>[E1, ..., E1]</code> is returned.
  538. </p>
  539. <p><b>See also:</b> <a href="#attribute-1">attribute/1</a>.</p>
  540. <h3><a name="attribute_name-1">attribute_name/1</a></h3>
  541. <p><tt>attribute_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  542. <p>Returns the name subtree of an <code>attribute</code> node.
  543. </p>
  544. <p><b>See also:</b> <a href="#attribute-1">attribute/1</a>.</p>
  545. <h3><a name="binary-1">binary/1</a></h3>
  546. <p><tt>binary(Fields::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  547. <p>Creates an abstract binary-object template. If
  548. <code>Fields</code> is <code>[F1, ..., Fn]</code>, the result
  549. represents "<code>&lt;&lt;<em>F1</em>, ...,
  550. <em>Fn</em>&gt;&gt;</code>".
  551. </p>
  552. <p><b>See also:</b> <a href="#binary_field-2">binary_field/2</a>, <a href="#binary_fields-1">binary_fields/1</a>.</p>
  553. <h3><a name="binary_field-1">binary_field/1</a></h3>
  554. <p><tt>binary_field(Body) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  555. <p>Equivalent to <a href="#binary_field-2"><tt>binary_field(Body, [])</tt></a>.</p>
  556. <h3><a name="binary_field-2">binary_field/2</a></h3>
  557. <p><tt>binary_field(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Types::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  558. <p>Creates an abstract binary template field. If
  559. <code>Types</code> is the empty list, the result simply represents
  560. "<code><em>Body</em></code>", otherwise, if <code>Types</code> is
  561. <code>[T1, ..., Tn]</code>, the result represents
  562. "<code><em>Body</em>/<em>T1</em>-...-<em>Tn</em></code>".
  563. </p>
  564. <p><b>See also:</b> <a href="#binary-1">binary/1</a>, <a href="#binary_field-1">binary_field/1</a>, <a href="#binary_field-3">binary_field/3</a>, <a href="#binary_field_body-1">binary_field_body/1</a>, <a href="#binary_field_size-1">binary_field_size/1</a>, <a href="#binary_field_types-1">binary_field_types/1</a>.</p>
  565. <h3><a name="binary_field-3">binary_field/3</a></h3>
  566. <p><tt>binary_field(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Size, Types::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  567. <ul><li><tt>Size = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  568. <p>Creates an abstract binary template field. (Utility function.)
  569. If <code>Size</code> is <code>none</code>, this is equivalent to
  570. "<code>binary_field(Body, Types)</code>", otherwise it is
  571. equivalent to "<code>binary_field(size_qualifier(Body, Size),
  572. Types)</code>".
  573. </p>
  574. <p><b>See also:</b> <a href="#binary-1">binary/1</a>, <a href="#binary_field-2">binary_field/2</a>, <a href="#size_qualifier-2">size_qualifier/2</a>.</p>
  575. <h3><a name="binary_field_body-1">binary_field_body/1</a></h3>
  576. <p><tt>binary_field_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  577. <p>Returns the body subtree of a <code>binary_field</code>.
  578. </p>
  579. <p><b>See also:</b> <a href="#binary_field-2">binary_field/2</a>.</p>
  580. <h3><a name="binary_field_size-1">binary_field_size/1</a></h3>
  581. <p><tt>binary_field_size(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  582. <p>Returns the size specifier subtree of a
  583. <code>binary_field</code> node, if any. (Utility function.) If
  584. <code>Node</code> represents
  585. "<code><em>Body</em>:<em>Size</em></code>" or
  586. "<code><em>Body</em>:<em>Size</em>/<em>T1</em>, ...,
  587. <em>Tn</em></code>", the result is <code>Size</code>, otherwise
  588. <code>none</code> is returned.
  589. </p>
  590. <p><b>See also:</b> <a href="#binary_field-2">binary_field/2</a>, <a href="#binary_field-3">binary_field/3</a>.</p>
  591. <h3><a name="binary_field_types-1">binary_field_types/1</a></h3>
  592. <p><tt>binary_field_types(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  593. <p>Returns the list of type-specifier subtrees of a
  594. <code>binary_field</code> node. If <code>Node</code> represents
  595. "<code>.../<em>T1</em>, ..., <em>Tn</em></code>", the result is
  596. <code>[T1, ..., Tn]</code>, otherwise the result is the empty list.
  597. </p>
  598. <p><b>See also:</b> <a href="#binary_field-2">binary_field/2</a>.</p>
  599. <h3><a name="binary_fields-1">binary_fields/1</a></h3>
  600. <p><tt>binary_fields(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  601. <p>Returns the list of field subtrees of a <code>binary</code>
  602. node.
  603. </p>
  604. <p><b>See also:</b> <a href="#binary-1">binary/1</a>, <a href="#binary_field-2">binary_field/2</a>.</p>
  605. <h3><a name="block_expr-1">block_expr/1</a></h3>
  606. <p><tt>block_expr(Body::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  607. <p>Creates an abstract block expression. If <code>Body</code> is
  608. <code>[B1, ..., Bn]</code>, the result represents "<code>begin
  609. <em>B1</em>, ..., <em>Bn</em> end</code>".
  610. </p>
  611. <p><b>See also:</b> <a href="#block_expr_body-1">block_expr_body/1</a>.</p>
  612. <h3><a name="block_expr_body-1">block_expr_body/1</a></h3>
  613. <p><tt>block_expr_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  614. <p>Returns the list of body subtrees of a <code>block_expr</code>
  615. node.
  616. </p>
  617. <p><b>See also:</b> <a href="#block_expr-1">block_expr/1</a>.</p>
  618. <h3><a name="case_expr-2">case_expr/2</a></h3>
  619. <p><tt>case_expr(Argument::<a href="#type-syntaxTree">syntaxTree()</a>, Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  620. <p>Creates an abstract case-expression. If <code>Clauses</code> is
  621. <code>[C1, ..., Cn]</code>, the result represents "<code>case
  622. <em>Argument</em> of <em>C1</em>; ...; <em>Cn</em> end</code>". More
  623. exactly, if each <code>Ci</code> represents "<code>(<em>Pi</em>)
  624. <em>Gi</em> -&gt; <em>Bi</em></code>", then the result represents
  625. "<code>case <em>Argument</em> of <em>P1</em> <em>G1</em> -&gt;
  626. <em>B1</em>; ...; <em>Pn</em> <em>Gn</em> -&gt; <em>Bn</em> end</code>".
  627. </p>
  628. <p><b>See also:</b> <a href="#case_expr_argument-1">case_expr_argument/1</a>, <a href="#case_expr_clauses-1">case_expr_clauses/1</a>, <a href="#clause-3">clause/3</a>, <a href="#cond_expr-1">cond_expr/1</a>, <a href="#if_expr-1">if_expr/1</a>.</p>
  629. <h3><a name="case_expr_argument-1">case_expr_argument/1</a></h3>
  630. <p><tt>case_expr_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  631. <p>Returns the argument subtree of a <code>case_expr</code> node.
  632. </p>
  633. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>.</p>
  634. <h3><a name="case_expr_clauses-1">case_expr_clauses/1</a></h3>
  635. <p><tt>case_expr_clauses(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  636. <p>Returns the list of clause subtrees of a <code>case_expr</code>
  637. node.
  638. </p>
  639. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>.</p>
  640. <h3><a name="catch_expr-1">catch_expr/1</a></h3>
  641. <p><tt>catch_expr(Expr::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  642. <p>Creates an abstract catch-expression. The result represents
  643. "<code>catch <em>Expr</em></code>".
  644. </p>
  645. <p><b>See also:</b> <a href="#catch_expr_body-1">catch_expr_body/1</a>.</p>
  646. <h3><a name="catch_expr_body-1">catch_expr_body/1</a></h3>
  647. <p><tt>catch_expr_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  648. <p>Returns the body subtree of a <code>catch_expr</code> node.
  649. </p>
  650. <p><b>See also:</b> <a href="#catch_expr-1">catch_expr/1</a>.</p>
  651. <h3><a name="char-1">char/1</a></h3>
  652. <p><tt>char(Value::char()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  653. <p>Creates an abstract character literal. The result represents
  654. "<code>$<em>Name</em></code>", where <code>Name</code> corresponds to
  655. <code>Value</code>.
  656. <p>Note: the literal corresponding to a particular character value is
  657. not uniquely defined. E.g., the character "<code>a</code>" can be
  658. written both as "<code>$a</code>" and "<code>$\141</code>", and a Tab
  659. character can be written as "<code>$\11</code>", "<code>$\011</code>"
  660. or "<code>$\t</code>".</p>
  661. </p>
  662. <p><b>See also:</b> <a href="#char_literal-1">char_literal/1</a>, <a href="#char_value-1">char_value/1</a>, <a href="#is_char-2">is_char/2</a>.</p>
  663. <h3><a name="char_literal-1">char_literal/1</a></h3>
  664. <p><tt>char_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  665. <p>Returns the literal string represented by a <code>char</code>
  666. node. This includes the leading "<code>$</code>" character.
  667. </p>
  668. <p><b>See also:</b> <a href="#char-1">char/1</a>.</p>
  669. <h3><a name="char_value-1">char_value/1</a></h3>
  670. <p><tt>char_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; char()</tt></p>
  671. <p>Returns the value represented by a <code>char</code> node.
  672. </p>
  673. <p><b>See also:</b> <a href="#char-1">char/1</a>.</p>
  674. <h3><a name="class_qualifier-2">class_qualifier/2</a></h3>
  675. <p><tt>class_qualifier(Class::<a href="#type-syntaxTree">syntaxTree()</a>, Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  676. <p>Creates an abstract class qualifier. The result represents
  677. "<code><em>Class</em>:<em>Body</em></code>".
  678. </p>
  679. <p><b>See also:</b> <a href="#class_qualifier_argument-1">class_qualifier_argument/1</a>, <a href="#class_qualifier_body-1">class_qualifier_body/1</a>, <a href="#try_expr-4">try_expr/4</a>.</p>
  680. <h3><a name="class_qualifier_argument-1">class_qualifier_argument/1</a></h3>
  681. <p><tt>class_qualifier_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  682. <p>Returns the argument (the class) subtree of a
  683. <code>class_qualifier</code> node.
  684. </p>
  685. <p><b>See also:</b> <a href="#class_qualifier-1">class_qualifier/1</a>.</p>
  686. <h3><a name="class_qualifier_body-1">class_qualifier_body/1</a></h3>
  687. <p><tt>class_qualifier_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  688. <p>Returns the body subtree of a <code>class_qualifier</code> node.
  689. </p>
  690. <p><b>See also:</b> <a href="#class_qualifier-1">class_qualifier/1</a>.</p>
  691. <h3><a name="clause-2">clause/2</a></h3>
  692. <p><tt>clause(Guard, Body) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  693. <p>Equivalent to <a href="#clause-3"><tt>clause([], Guard, Body)</tt></a>.</p>
  694. <h3><a name="clause-3">clause/3</a></h3>
  695. <p><tt>clause(Patterns::[<a href="#type-syntaxTree">syntaxTree()</a>], Guard, Body::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  696. <ul><li><tt>Guard = none | <a href="#type-syntaxTree">syntaxTree()</a> | [<a href="#type-syntaxTree">syntaxTree()</a>] | [[<a href="#type-syntaxTree">syntaxTree()</a>]]</tt></li></ul></p>
  697. <p>Creates an abstract clause. If <code>Patterns</code> is
  698. <code>[P1, ..., Pn]</code> and <code>Body</code> is <code>[B1, ...,
  699. Bm]</code>, then if <code>Guard</code> is <code>none</code>, the
  700. result represents "<code>(<em>P1</em>, ..., <em>Pn</em>) -&gt;
  701. <em>B1</em>, ..., <em>Bm</em></code>", otherwise, unless
  702. <code>Guard</code> is a list, the result represents
  703. "<code>(<em>P1</em>, ..., <em>Pn</em>) when <em>Guard</em> -&gt;
  704. <em>B1</em>, ..., <em>Bm</em></code>".
  705. <p>For simplicity, the <code>Guard</code> argument may also be any
  706. of the following:
  707. <ul>
  708. <li>An empty list <code>[]</code>. This is equivalent to passing
  709. <code>none</code>.</li>
  710. <li>A nonempty list <code>[E1, ..., Ej]</code> of syntax trees.
  711. This is equivalent to passing <code>conjunction([E1, ...,
  712. Ej])</code>.</li>
  713. <li>A nonempty list of lists of syntax trees <code>[[E1_1, ...,
  714. E1_k1], ..., [Ej_1, ..., Ej_kj]]</code>, which is equivalent
  715. to passing <code>disjunction([conjunction([E1_1, ...,
  716. E1_k1]), ..., conjunction([Ej_1, ..., Ej_kj])])</code>.</li>
  717. </ul>
  718. </p>
  719. </p>
  720. <p><b>See also:</b> <a href="#clause-2">clause/2</a>, <a href="#clause_body-1">clause_body/1</a>, <a href="#clause_guard-1">clause_guard/1</a>, <a href="#clause_patterns-1">clause_patterns/1</a>.</p>
  721. <h3><a name="clause_body-1">clause_body/1</a></h3>
  722. <p><tt>clause_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  723. <p>Return the list of body subtrees of a <code>clause</code>
  724. node.
  725. </p>
  726. <p><b>See also:</b> <a href="#clause-3">clause/3</a>.</p>
  727. <h3><a name="clause_guard-1">clause_guard/1</a></h3>
  728. <p><tt>clause_guard(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  729. <p>Returns the guard subtree of a <code>clause</code> node, if
  730. any. If <code>Node</code> represents "<code>(<em>P1</em>, ...,
  731. <em>Pn</em>) when <em>Guard</em> -&gt; <em>B1</em>, ...,
  732. <em>Bm</em></code>", <code>Guard</code> is returned. Otherwise, the
  733. result is <code>none</code>.
  734. </p>
  735. <p><b>See also:</b> <a href="#clause-3">clause/3</a>.</p>
  736. <h3><a name="clause_patterns-1">clause_patterns/1</a></h3>
  737. <p><tt>clause_patterns(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  738. <p>Returns the list of pattern subtrees of a <code>clause</code>
  739. node.
  740. </p>
  741. <p><b>See also:</b> <a href="#clause-3">clause/3</a>.</p>
  742. <h3><a name="comment-1">comment/1</a></h3>
  743. <p><tt>comment(Strings) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  744. <p>Equivalent to <a href="#comment-2"><tt>comment(none, Strings)</tt></a>.</p>
  745. <h3><a name="comment-2">comment/2</a></h3>
  746. <p><tt>comment(Pad::Padding, Strings::[string()]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  747. <ul><li><tt>Padding = none | integer()</tt></li></ul></p>
  748. <p>Creates an abstract comment with the given padding and text. If
  749. <code>Strings</code> is a (possibly empty) list
  750. <code>["<em>Txt1</em>", ..., "<em>TxtN</em>"]</code>, the result
  751. represents the source code text
  752. <pre>
  753. %<em>Txt1</em>
  754. ...
  755. %<em>TxtN</em></pre>
  756. <code>Padding</code> states the number of empty character positions
  757. to the left of the comment separating it horizontally from
  758. source code on the same line (if any). If <code>Padding</code> is
  759. <code>none</code>, a default positive number is used. If
  760. <code>Padding</code> is an integer less than 1, there should be no
  761. separating space. Comments are in themselves regarded as source
  762. program forms.
  763. </p>
  764. <p><b>See also:</b> <a href="#comment-1">comment/1</a>, <a href="#is_form-1">is_form/1</a>.</p>
  765. <h3><a name="comment_padding-1">comment_padding/1</a></h3>
  766. <p><tt>comment_padding(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | integer()</tt></p>
  767. <p>Returns the amount of padding before the comment, or
  768. <code>none</code>. The latter means that a default padding may be
  769. used.
  770. </p>
  771. <p><b>See also:</b> <a href="#comment-2">comment/2</a>.</p>
  772. <h3><a name="comment_text-1">comment_text/1</a></h3>
  773. <p><tt>comment_text(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [string()]</tt></p>
  774. <p>Returns the lines of text of the abstract comment.
  775. </p>
  776. <p><b>See also:</b> <a href="#comment-2">comment/2</a>.</p>
  777. <h3><a name="compact_list-1">compact_list/1</a></h3>
  778. <p><tt>compact_list(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  779. <p>Yields the most compact form for an abstract list skeleton. The
  780. result either represents "<code>[<em>E1</em>, ..., <em>En</em> |
  781. <em>Tail</em>]</code>", where <code>Tail</code> is not a list
  782. skeleton, or otherwise simply "<code>[<em>E1</em>, ...,
  783. <em>En</em>]</code>". Annotations on subtrees of <code>Node</code>
  784. that represent list skeletons may be lost, but comments will be
  785. propagated to the result. Returns <code>Node</code> itself if
  786. <code>Node</code> does not represent a list skeleton.
  787. </p>
  788. <p><b>See also:</b> <a href="#list-2">list/2</a>, <a href="#normalize_list-1">normalize_list/1</a>.</p>
  789. <h3><a name="concrete-1">concrete/1</a></h3>
  790. <p><tt>concrete(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; term()</tt></p>
  791. <p>Returns the Erlang term represented by a syntax tree. Evaluation
  792. fails with reason <code>badarg</code> if <code>Node</code> does not
  793. represent a literal term.
  794. <p>Note: Currently, the set of syntax trees which have a concrete
  795. representation is larger than the set of trees which can be built
  796. using the function <code>abstract/1</code>. An abstract character
  797. will be concretised as an integer, while <code>abstract/1</code> does
  798. not at present yield an abstract character for any input. (Use the
  799. <code>char/1</code> function to explicitly create an abstract
  800. character.)</p>
  801. </p>
  802. <p><b>See also:</b> <a href="#abstract-1">abstract/1</a>, <a href="#char-1">char/1</a>, <a href="#is_literal-1">is_literal/1</a>.</p>
  803. <h3><a name="cond_expr-1">cond_expr/1</a></h3>
  804. <p><tt>cond_expr(Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  805. <p>Creates an abstract cond-expression. If <code>Clauses</code> is
  806. <code>[C1, ..., Cn]</code>, the result represents "<code>cond
  807. <em>C1</em>; ...; <em>Cn</em> end</code>". More exactly, if each
  808. <code>Ci</code> represents "<code>() <em>Ei</em> -&gt;
  809. <em>Bi</em></code>", then the result represents "<code>cond
  810. <em>E1</em> -&gt; <em>B1</em>; ...; <em>En</em> -&gt; <em>Bn</em>
  811. end</code>".
  812. </p>
  813. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>, <a href="#clause-3">clause/3</a>, <a href="#cond_expr_clauses-1">cond_expr_clauses/1</a>.</p>
  814. <h3><a name="cond_expr_clauses-1">cond_expr_clauses/1</a></h3>
  815. <tt>cond_expr_clauses(Node) -&gt; term()
  816. </tt><p>Returns the list of clause subtrees of a <code>cond_expr</code>
  817. node.
  818. </p>
  819. <p><b>See also:</b> <a href="#cond_expr-1">cond_expr/1</a>.</p>
  820. <h3><a name="conjunction-1">conjunction/1</a></h3>
  821. <p><tt>conjunction(List::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  822. <p>Creates an abstract conjunction. If <code>List</code> is
  823. <code>[E1, ..., En]</code>, the result represents
  824. "<code><em>E1</em>, ..., <em>En</em></code>".
  825. </p>
  826. <p><b>See also:</b> <a href="#conjunction_body-1">conjunction_body/1</a>, <a href="#disjunction-1">disjunction/1</a>.</p>
  827. <h3><a name="conjunction_body-1">conjunction_body/1</a></h3>
  828. <p><tt>conjunction_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  829. <p>Returns the list of body subtrees of a
  830. <code>conjunction</code> node.
  831. </p>
  832. <p><b>See also:</b> <a href="#conjunction-1">conjunction/1</a>.</p>
  833. <h3><a name="cons-2">cons/2</a></h3>
  834. <p><tt>cons(Head::<a href="#type-syntaxTree">syntaxTree()</a>, Tail::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  835. <p>"Optimising" list skeleton cons operation. Creates an abstract
  836. list skeleton whose first element is <code>Head</code> and whose tail
  837. corresponds to <code>Tail</code>. This is similar to
  838. <code>list([Head], Tail)</code>, except that <code>Tail</code> may
  839. not be <code>none</code>, and that the result does not necessarily
  840. represent exactly "<code>[<em>Head</em> | <em>Tail</em>]</code>", but
  841. may depend on the <code>Tail</code> subtree. E.g., if
  842. <code>Tail</code> represents <code>[X, Y]</code>, the result may
  843. represent "<code>[<em>Head</em>, X, Y]</code>", rather than
  844. "<code>[<em>Head</em> | [X, Y]]</code>". Annotations on
  845. <code>Tail</code> itself may be lost if <code>Tail</code> represents
  846. a list skeleton, but comments on <code>Tail</code> are propagated to
  847. the result.
  848. </p>
  849. <p><b>See also:</b> <a href="#list-2">list/2</a>, <a href="#list_head-1">list_head/1</a>, <a href="#list_tail-1">list_tail/1</a>.</p>
  850. <h3><a name="copy_ann-2">copy_ann/2</a></h3>
  851. <p><tt>copy_ann(Source::<a href="#type-syntaxTree">syntaxTree()</a>, Target::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  852. <p>Copies the list of user annotations from <code>Source</code> to
  853. <code>Target</code>.
  854. <p>Note: this is equivalent to <code>set_ann(Target,
  855. get_ann(Source))</code>, but potentially more efficient.</p>
  856. </p>
  857. <p><b>See also:</b> <a href="#get_ann-1">get_ann/1</a>, <a href="#set_ann-2">set_ann/2</a>.</p>
  858. <h3><a name="copy_attrs-2">copy_attrs/2</a></h3>
  859. <p><tt>copy_attrs(Source::<a href="#type-syntaxTree">syntaxTree()</a>, Target::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  860. <p>Copies the attributes from <code>Source</code> to
  861. <code>Target</code>.
  862. <p>Note: this is equivalent to <code>set_attrs(Target,
  863. get_attrs(Source))</code>, but potentially more efficient.</p>
  864. </p>
  865. <p><b>See also:</b> <a href="#get_attrs-1">get_attrs/1</a>, <a href="#set_attrs-2">set_attrs/2</a>.</p>
  866. <h3><a name="copy_comments-2">copy_comments/2</a></h3>
  867. <p><tt>copy_comments(Source::<a href="#type-syntaxTree">syntaxTree()</a>, Target::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  868. <p>Copies the pre- and postcomments from <code>Source</code> to
  869. <code>Target</code>.
  870. <p>Note: This is equivalent to
  871. <code>set_postcomments(set_precomments(Target,
  872. get_precomments(Source)), get_postcomments(Source))</code>, but
  873. potentially more efficient.</p>
  874. </p>
  875. <p><b>See also:</b> <a href="#comment-2">comment/2</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#set_postcomments-2">set_postcomments/2</a>, <a href="#set_precomments-2">set_precomments/2</a>.</p>
  876. <h3><a name="copy_pos-2">copy_pos/2</a></h3>
  877. <p><tt>copy_pos(Source::<a href="#type-syntaxTree">syntaxTree()</a>, Target::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  878. <p>Copies the position information from <code>Source</code> to
  879. <code>Target</code>.
  880. <p>This is equivalent to <code>set_pos(Target,
  881. get_pos(Source))</code>, but potentially more efficient.</p>
  882. </p>
  883. <p><b>See also:</b> <a href="#get_pos-1">get_pos/1</a>, <a href="#set_pos-2">set_pos/2</a>.</p>
  884. <h3><a name="data-1">data/1</a></h3>
  885. <p><tt>data(Tree::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; term()</tt></p>
  886. <p><em>For special purposes only</em>. Returns the associated data
  887. of a syntax tree node. Evaluation fails with reason
  888. <code>badarg</code> if <code>is_tree(Node)</code> does not yield
  889. <code>true</code>.
  890. </p>
  891. <p><b>See also:</b> <a href="#tree-2">tree/2</a>.</p>
  892. <h3><a name="disjunction-1">disjunction/1</a></h3>
  893. <p><tt>disjunction(List::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  894. <p>Creates an abstract disjunction. If <code>List</code> is
  895. <code>[E1, ..., En]</code>, the result represents
  896. "<code><em>E1</em>; ...; <em>En</em></code>".
  897. </p>
  898. <p><b>See also:</b> <a href="#conjunction-1">conjunction/1</a>, <a href="#disjunction_body-1">disjunction_body/1</a>.</p>
  899. <h3><a name="disjunction_body-1">disjunction_body/1</a></h3>
  900. <p><tt>disjunction_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  901. <p>Returns the list of body subtrees of a
  902. <code>disjunction</code> node.
  903. </p>
  904. <p><b>See also:</b> <a href="#disjunction-1">disjunction/1</a>.</p>
  905. <h3><a name="eof_marker-0">eof_marker/0</a></h3>
  906. <p><tt>eof_marker() -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  907. <p>Creates an abstract end-of-file marker. This represents the
  908. end of input when reading a sequence of source code forms. An
  909. end-of-file marker is itself regarded as a source code form
  910. (namely, the last in any sequence in which it occurs). It has no
  911. defined lexical form.
  912. <p>Note: this is retained only for backwards compatibility with
  913. existing parsers and tools.</p>
  914. </p>
  915. <p><b>See also:</b> <a href="#error_marker-1">error_marker/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#warning_marker-1">warning_marker/1</a>.</p>
  916. <h3><a name="error_marker-1">error_marker/1</a></h3>
  917. <p><tt>error_marker(Error::term()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  918. <p>Creates an abstract error marker. The result represents an
  919. occurrence of an error in the source code, with an associated Erlang
  920. I/O ErrorInfo structure given by <code>Error</code> (see module
  921. <code>io</code> for details). Error markers are regarded as source
  922. code forms, but have no defined lexical form.
  923. <p>Note: this is supported only for backwards compatibility with
  924. existing parsers and tools.</p>
  925. </p>
  926. <p><b>See also:</b> <a href="/usr/local/home/richardc/hipe/otp/lib/stdlib/doc/io.html">io</a>, <a href="#eof_marker-0">eof_marker/0</a>, <a href="#error_marker_info-1">error_marker_info/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#warning_marker-1">warning_marker/1</a>.</p>
  927. <h3><a name="error_marker_info-1">error_marker_info/1</a></h3>
  928. <p><tt>error_marker_info(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; term()</tt></p>
  929. <p>Returns the ErrorInfo structure of an <code>error_marker</code>
  930. node.
  931. </p>
  932. <p><b>See also:</b> <a href="#error_marker-1">error_marker/1</a>.</p>
  933. <h3><a name="flatten_form_list-1">flatten_form_list/1</a></h3>
  934. <p><tt>flatten_form_list(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  935. <p>Flattens sublists of a <code>form_list</code> node. Returns
  936. <code>Node</code> with all subtrees of type <code>form_list</code>
  937. recursively expanded, yielding a single "flat" abstract form
  938. sequence.
  939. </p>
  940. <p><b>See also:</b> <a href="#form_list-1">form_list/1</a>.</p>
  941. <h3><a name="float-1">float/1</a></h3>
  942. <p><tt>float(Value::float()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  943. <p>Creates an abstract floating-point literal. The lexical
  944. representation is the decimal floating-point numeral of
  945. <code>Value</code>.
  946. </p>
  947. <p><b>See also:</b> <a href="#float_literal-1">float_literal/1</a>, <a href="#float_value-1">float_value/1</a>.</p>
  948. <h3><a name="float_literal-1">float_literal/1</a></h3>
  949. <p><tt>float_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  950. <p>Returns the numeral string represented by a <code>float</code>
  951. node.
  952. </p>
  953. <p><b>See also:</b> <a href="#float-1">float/1</a>.</p>
  954. <h3><a name="float_value-1">float_value/1</a></h3>
  955. <p><tt>float_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; float()</tt></p>
  956. <p>Returns the value represented by a <code>float</code> node. Note
  957. that floating-point values should usually not be compared for
  958. equality.
  959. </p>
  960. <p><b>See also:</b> <a href="#float-1">float/1</a>.</p>
  961. <h3><a name="form_list-1">form_list/1</a></h3>
  962. <p><tt>form_list(Forms::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  963. <p>Creates an abstract sequence of "source code forms". If
  964. <code>Forms</code> is <code>[F1, ..., Fn]</code>, where each
  965. <code>Fi</code> is a form (cf. <code>is_form/1</code>, the result
  966. represents
  967. <pre>
  968. <em>F1</em>
  969. ...
  970. <em>Fn</em></pre>
  971. where the <code>Fi</code> are separated by one or more line breaks. A
  972. node of type <code>form_list</code> is itself regarded as a source
  973. code form; cf. <code>flatten_form_list/1</code>.
  974. <p>Note: this is simply a way of grouping source code forms as a
  975. single syntax tree, usually in order to form an Erlang module
  976. definition.</p>
  977. </p>
  978. <p><b>See also:</b> <a href="#flatten_form_list-1">flatten_form_list/1</a>, <a href="#form_list_elements-1">form_list_elements/1</a>, <a href="#is_form-1">is_form/1</a>.</p>
  979. <h3><a name="form_list_elements-1">form_list_elements/1</a></h3>
  980. <p><tt>form_list_elements(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  981. <p>Returns the list of subnodes of a <code>form_list</code> node.
  982. </p>
  983. <p><b>See also:</b> <a href="#form_list-1">form_list/1</a>.</p>
  984. <h3><a name="fun_expr-1">fun_expr/1</a></h3>
  985. <p><tt>fun_expr(Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  986. <p>Creates an abstract fun-expression. If <code>Clauses</code> is
  987. <code>[C1, ..., Cn]</code>, the result represents "<code>fun
  988. <em>C1</em>; ...; <em>Cn</em> end</code>". More exactly, if each
  989. <code>Ci</code> represents "<code>(<em>Pi1</em>, ..., <em>Pim</em>)
  990. <em>Gi</em> -&gt; <em>Bi</em></code>", then the result represents
  991. "<code>fun (<em>P11</em>, ..., <em>P1m</em>) <em>G1</em> -&gt;
  992. <em>B1</em>; ...; (<em>Pn1</em>, ..., <em>Pnm</em>) <em>Gn</em> -&gt;
  993. <em>Bn</em> end</code>".
  994. </p>
  995. <p><b>See also:</b> <a href="#fun_expr_arity-1">fun_expr_arity/1</a>, <a href="#fun_expr_clauses-1">fun_expr_clauses/1</a>.</p>
  996. <h3><a name="fun_expr_arity-1">fun_expr_arity/1</a></h3>
  997. <p><tt>fun_expr_arity(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; integer()</tt></p>
  998. <p>Returns the arity of a <code>fun_expr</code> node. The result is
  999. the number of parameter patterns in the first clause of the
  1000. fun-expression; subsequent clauses are ignored.
  1001. <p>An exception is thrown if <code>fun_expr_clauses(Node)</code>
  1002. returns an empty list, or if the first element of that list is not a
  1003. syntax tree <code>C</code> of type <code>clause</code> such that
  1004. <code>clause_patterns(C)</code> is a nonempty list.</p>
  1005. </p>
  1006. <p><b>See also:</b> <a href="#clause-3">clause/3</a>, <a href="#clause_patterns-1">clause_patterns/1</a>, <a href="#fun_expr-1">fun_expr/1</a>, <a href="#fun_expr_clauses-1">fun_expr_clauses/1</a>.</p>
  1007. <h3><a name="fun_expr_clauses-1">fun_expr_clauses/1</a></h3>
  1008. <p><tt>fun_expr_clauses(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1009. <p>Returns the list of clause subtrees of a <code>fun_expr</code>
  1010. node.
  1011. </p>
  1012. <p><b>See also:</b> <a href="#fun_expr-1">fun_expr/1</a>.</p>
  1013. <h3><a name="function-2">function/2</a></h3>
  1014. <p><tt>function(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1015. <p>Creates an abstract function definition. If <code>Clauses</code>
  1016. is <code>[C1, ..., Cn]</code>, the result represents
  1017. "<code><em>Name</em> <em>C1</em>; ...; <em>Name</em>
  1018. <em>Cn</em>.</code>". More exactly, if each <code>Ci</code>
  1019. represents "<code>(<em>Pi1</em>, ..., <em>Pim</em>) <em>Gi</em> -&gt;
  1020. <em>Bi</em></code>", then the result represents
  1021. "<code><em>Name</em>(<em>P11</em>, ..., <em>P1m</em>) <em>G1</em> -&gt;
  1022. <em>B1</em>; ...; <em>Name</em>(<em>Pn1</em>, ..., <em>Pnm</em>)
  1023. <em>Gn</em> -&gt; <em>Bn</em>.</code>". Function definitions are source
  1024. code forms.
  1025. </p>
  1026. <p><b>See also:</b> <a href="#function_arity-1">function_arity/1</a>, <a href="#function_clauses-1">function_clauses/1</a>, <a href="#function_name-1">function_name/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#rule-2">rule/2</a>.</p>
  1027. <h3><a name="function_arity-1">function_arity/1</a></h3>
  1028. <p><tt>function_arity(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; integer()</tt></p>
  1029. <p>Returns the arity of a <code>function</code> node. The result
  1030. is the number of parameter patterns in the first clause of the
  1031. function; subsequent clauses are ignored.
  1032. <p>An exception is thrown if <code>function_clauses(Node)</code>
  1033. returns an empty list, or if the first element of that list is not
  1034. a syntax tree <code>C</code> of type <code>clause</code> such that
  1035. <code>clause_patterns(C)</code> is a nonempty list.</p>
  1036. </p>
  1037. <p><b>See also:</b> <a href="#clause-3">clause/3</a>, <a href="#clause_patterns-1">clause_patterns/1</a>, <a href="#function-2">function/2</a>, <a href="#function_clauses-1">function_clauses/1</a>.</p>
  1038. <h3><a name="function_clauses-1">function_clauses/1</a></h3>
  1039. <tt>function_clauses(Node) -&gt; term()
  1040. </tt><p>Returns the list of clause subtrees of a <code>function</code>
  1041. node.
  1042. </p>
  1043. <p><b>See also:</b> <a href="#function-2">function/2</a>.</p>
  1044. <h3><a name="function_name-1">function_name/1</a></h3>
  1045. <tt>function_name(Node) -&gt; term()
  1046. </tt><p>Returns the name subtree of a <code>function</code> node.
  1047. </p>
  1048. <p><b>See also:</b> <a href="#function-2">function/2</a>.</p>
  1049. <h3><a name="generator-2">generator/2</a></h3>
  1050. <p><tt>generator(Pattern::<a href="#type-syntaxTree">syntaxTree()</a>, Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1051. <p>Creates an abstract generator. The result represents
  1052. "<code><em>Pattern</em> &lt;- <em>Body</em></code>".
  1053. </p>
  1054. <p><b>See also:</b> <a href="#generator_body-1">generator_body/1</a>, <a href="#generator_pattern-1">generator_pattern/1</a>, <a href="#list_comp-2">list_comp/2</a>.</p>
  1055. <h3><a name="generator_body-1">generator_body/1</a></h3>
  1056. <p><tt>generator_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1057. <p>Returns the body subtree of a <code>generator</code> node.
  1058. </p>
  1059. <p><b>See also:</b> <a href="#generator-2">generator/2</a>.</p>
  1060. <h3><a name="generator_pattern-1">generator_pattern/1</a></h3>
  1061. <p><tt>generator_pattern(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1062. <p>Returns the pattern subtree of a <code>generator</code> node.
  1063. </p>
  1064. <p><b>See also:</b> <a href="#generator-2">generator/2</a>.</p>
  1065. <h3><a name="get_ann-1">get_ann/1</a></h3>
  1066. <p><tt>get_ann(X1::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [term()]</tt></p>
  1067. <p>Returns the list of user annotations associated with a syntax
  1068. tree node. For a newly created node, this is the empty list. The
  1069. annotations may be any terms.
  1070. </p>
  1071. <p><b>See also:</b> <a href="#get_attrs-1">get_attrs/1</a>, <a href="#set_ann-2">set_ann/2</a>.</p>
  1072. <h3><a name="get_attrs-1">get_attrs/1</a></h3>
  1073. <p><tt>get_attrs(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTreeAttributes">syntaxTreeAttributes()</a></tt></p>
  1074. <p>Returns a representation of the attributes associated with a
  1075. syntax tree node. The attributes are all the extra information that
  1076. can be attached to a node. Currently, this includes position
  1077. information, source code comments, and user annotations. The result
  1078. of this function cannot be inspected directly; only attached to
  1079. another node (cf. <code>set_attrs/2</code>).
  1080. <p>For accessing individual attributes, see <code>get_pos/1</code>,
  1081. <code>get_ann/1</code>, <code>get_precomments/1</code> and
  1082. <code>get_postcomments/1</code>.</p>
  1083. </p>
  1084. <p><b>See also:</b> <a href="#get_ann-1">get_ann/1</a>, <a href="#get_pos-1">get_pos/1</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#set_attrs-2">set_attrs/2</a>.</p>
  1085. <h3><a name="get_pos-1">get_pos/1</a></h3>
  1086. <p><tt>get_pos(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; term()</tt></p>
  1087. <p>Returns the position information associated with
  1088. <code>Node</code>. This is usually a nonnegative integer (indicating
  1089. the source code line number), but may be any term. By default, all
  1090. new tree nodes have their associated position information set to the
  1091. integer zero.
  1092. </p>
  1093. <p><b>See also:</b> <a href="#get_attrs-1">get_attrs/1</a>, <a href="#set_pos-2">set_pos/2</a>.</p>
  1094. <h3><a name="get_postcomments-1">get_postcomments/1</a></h3>
  1095. <p><tt>get_postcomments(X1::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1096. <p>Returns the associated post-comments of a node. This is a
  1097. possibly empty list of abstract comments, in top-down textual order.
  1098. When the code is formatted, post-comments are typically displayed to
  1099. the right of and/or below the node. For example:
  1100. <pre>
  1101. {foo, X, Y} % Post-comment of tuple</pre>
  1102. <p>If possible, the comment should be moved past any following
  1103. separator characters on the same line, rather than placing the
  1104. separators on the following line. E.g.:
  1105. <pre>
  1106. foo([X | Xs], Y) -&gt;
  1107. foo(Xs, bar(X)); % Post-comment of 'bar(X)' node
  1108. ...</pre>
  1109. (where the comment is moved past the rightmost "<code>)</code>" and
  1110. the "<code>;</code>").</p>
  1111. </p>
  1112. <p><b>See also:</b> <a href="#comment-2">comment/2</a>, <a href="#get_attrs-1">get_attrs/1</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#set_postcomments-2">set_postcomments/2</a>.</p>
  1113. <h3><a name="get_precomments-1">get_precomments/1</a></h3>
  1114. <p><tt>get_precomments(X1::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1115. <p>Returns the associated pre-comments of a node. This is a
  1116. possibly empty list of abstract comments, in top-down textual order.
  1117. When the code is formatted, pre-comments are typically displayed
  1118. directly above the node. For example:
  1119. <pre>
  1120. % Pre-comment of function
  1121. foo(X) -&gt; {bar, X}.</pre>
  1122. <p>If possible, the comment should be moved before any preceding
  1123. separator characters on the same line. E.g.:
  1124. <pre>
  1125. foo([X | Xs]) -&gt;
  1126. % Pre-comment of 'bar(X)' node
  1127. [bar(X) | foo(Xs)];
  1128. ...</pre>
  1129. (where the comment is moved before the "<code>[</code>").</p>
  1130. </p>
  1131. <p><b>See also:</b> <a href="#comment-2">comment/2</a>, <a href="#get_attrs-1">get_attrs/1</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#set_precomments-2">set_precomments/2</a>.</p>
  1132. <h3><a name="has_comments-1">has_comments/1</a></h3>
  1133. <p><tt>has_comments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1134. <p>Yields <code>false</code> if the node has no associated
  1135. comments, and <code>true</code> otherwise.
  1136. <p>Note: This is equivalent to <code>(get_precomments(Node) == [])
  1137. and (get_postcomments(Node) == [])</code>, but potentially more
  1138. efficient.</p>
  1139. </p>
  1140. <p><b>See also:</b> <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#remove_comments-1">remove_comments/1</a>.</p>
  1141. <h3><a name="if_expr-1">if_expr/1</a></h3>
  1142. <p><tt>if_expr(Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1143. <p>Creates an abstract if-expression. If <code>Clauses</code> is
  1144. <code>[C1, ..., Cn]</code>, the result represents "<code>if
  1145. <em>C1</em>; ...; <em>Cn</em> end</code>". More exactly, if each
  1146. <code>Ci</code> represents "<code>() <em>Gi</em> -&gt;
  1147. <em>Bi</em></code>", then the result represents "<code>if
  1148. <em>G1</em> -&gt; <em>B1</em>; ...; <em>Gn</em> -&gt; <em>Bn</em>
  1149. end</code>".
  1150. </p>
  1151. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>, <a href="#clause-3">clause/3</a>, <a href="#if_expr_clauses-1">if_expr_clauses/1</a>.</p>
  1152. <h3><a name="if_expr_clauses-1">if_expr_clauses/1</a></h3>
  1153. <tt>if_expr_clauses(Node) -&gt; term()
  1154. </tt><p>Returns the list of clause subtrees of an <code>if_expr</code>
  1155. node.
  1156. </p>
  1157. <p><b>See also:</b> <a href="#if_expr-1">if_expr/1</a>.</p>
  1158. <h3><a name="implicit_fun-1">implicit_fun/1</a></h3>
  1159. <p><tt>implicit_fun(Name::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1160. <p>Creates an abstract "implicit fun" expression. The result
  1161. represents "<code>fun <em>Name</em></code>".
  1162. </p>
  1163. <p><b>See also:</b> <a href="#implicit_fun-2">implicit_fun/2</a>, <a href="#implicit_fun_name-1">implicit_fun_name/1</a>.</p>
  1164. <h3><a name="implicit_fun-2">implicit_fun/2</a></h3>
  1165. <p><tt>implicit_fun(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Arity::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1166. <p>Creates an abstract "implicit fun" expression. (Utility
  1167. function.) If <code>Arity</code> is <code>none</code>, this is
  1168. equivalent to <code>implicit_fun(Name)</code>, otherwise it is
  1169. equivalent to <code>implicit_fun(arity_qualifier(Name,
  1170. Arity))</code>.
  1171. </p>
  1172. <p><b>See also:</b> <a href="#implicit_fun-1">implicit_fun/1</a>.</p>
  1173. <h3><a name="implicit_fun_name-1">implicit_fun_name/1</a></h3>
  1174. <p><tt>implicit_fun_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1175. <p>Returns the name subtree of an <code>implicit_fun</code> node.
  1176. <p>Note: if <code>Node</code> represents "<code>fun
  1177. <em>N</em>/<em>A</em></code>", then the result is the subtree
  1178. representing "<code><em>N</em>/<em>A</em></code>".</p>
  1179. </p>
  1180. <p><b>See also:</b> <a href="#implicit_fun-1">implicit_fun/1</a>.</p>
  1181. <h3><a name="infix_expr-3">infix_expr/3</a></h3>
  1182. <p><tt>infix_expr(Left::<a href="#type-syntaxTree">syntaxTree()</a>, Operator::<a href="#type-syntaxTree">syntaxTree()</a>, Right::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1183. <p>Creates an abstract infix operator expression. The result
  1184. represents "<code><em>Left</em> <em>Operator</em>
  1185. <em>Right</em></code>".
  1186. </p>
  1187. <p><b>See also:</b> <a href="#infix_expr_left-1">infix_expr_left/1</a>, <a href="#infix_expr_operator-1">infix_expr_operator/1</a>, <a href="#infix_expr_right-1">infix_expr_right/1</a>, <a href="#prefix_expr-2">prefix_expr/2</a>.</p>
  1188. <h3><a name="infix_expr_left-1">infix_expr_left/1</a></h3>
  1189. <p><tt>infix_expr_left(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1190. <p>Returns the left argument subtree of an
  1191. <code>infix_expr</code> node.
  1192. </p>
  1193. <p><b>See also:</b> <a href="#infix_expr-3">infix_expr/3</a>.</p>
  1194. <h3><a name="infix_expr_operator-1">infix_expr_operator/1</a></h3>
  1195. <p><tt>infix_expr_operator(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1196. <p>Returns the operator subtree of an <code>infix_expr</code>
  1197. node.
  1198. </p>
  1199. <p><b>See also:</b> <a href="#infix_expr-3">infix_expr/3</a>.</p>
  1200. <h3><a name="infix_expr_right-1">infix_expr_right/1</a></h3>
  1201. <p><tt>infix_expr_right(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1202. <p>Returns the right argument subtree of an
  1203. <code>infix_expr</code> node.
  1204. </p>
  1205. <p><b>See also:</b> <a href="#infix_expr-3">infix_expr/3</a>.</p>
  1206. <h3><a name="integer-1">integer/1</a></h3>
  1207. <p><tt>integer(Value::integer()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1208. <p>Creates an abstract integer literal. The lexical representation
  1209. is the canonical decimal numeral of <code>Value</code>.
  1210. </p>
  1211. <p><b>See also:</b> <a href="#integer_literal-1">integer_literal/1</a>, <a href="#integer_value-1">integer_value/1</a>, <a href="#is_integer-2">is_integer/2</a>.</p>
  1212. <h3><a name="integer_literal-1">integer_literal/1</a></h3>
  1213. <p><tt>integer_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  1214. <p>Returns the numeral string represented by an
  1215. <code>integer</code> node.
  1216. </p>
  1217. <p><b>See also:</b> <a href="#integer-1">integer/1</a>.</p>
  1218. <h3><a name="integer_value-1">integer_value/1</a></h3>
  1219. <p><tt>integer_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; integer()</tt></p>
  1220. <p>Returns the value represented by an <code>integer</code> node.
  1221. </p>
  1222. <p><b>See also:</b> <a href="#integer-1">integer/1</a>.</p>
  1223. <h3><a name="is_atom-2">is_atom/2</a></h3>
  1224. <p><tt>is_atom(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Value::atom()) -&gt; bool()</tt></p>
  1225. <p>Returns <code>true</code> if <code>Node</code> has type
  1226. <code>atom</code> and represents <code>Value</code>, otherwise
  1227. <code>false</code>.
  1228. </p>
  1229. <p><b>See also:</b> <a href="#atom-1">atom/1</a>.</p>
  1230. <h3><a name="is_char-2">is_char/2</a></h3>
  1231. <p><tt>is_char(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Value::char()) -&gt; bool()</tt></p>
  1232. <p>Returns <code>true</code> if <code>Node</code> has type
  1233. <code>char</code> and represents <code>Value</code>, otherwise
  1234. <code>false</code>.
  1235. </p>
  1236. <p><b>See also:</b> <a href="#char-1">char/1</a>.</p>
  1237. <h3><a name="is_form-1">is_form/1</a></h3>
  1238. <p><tt>is_form(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1239. <p>Returns <code>true</code> if <code>Node</code> is a syntax tree
  1240. representing a so-called "source code form", otherwise
  1241. <code>false</code>. Forms are the Erlang source code units which,
  1242. placed in sequence, constitute an Erlang program. Current form types
  1243. are:
  1244. <p><center><table border="1">
  1245. <tr>
  1246. <td><code>attribute</code></td>
  1247. <td><code>comment</code></td>
  1248. <td><code>error_marker</code></td>
  1249. <td><code>eof_marker</code></td>
  1250. </tr><tr>
  1251. <td><code>form_list</code></td>
  1252. <td><code>function</code></td>
  1253. <td><code>rule</code></td>
  1254. <td><code>warning_marker</code></td>
  1255. </tr>
  1256. </table></center></p></p>
  1257. <p><b>See also:</b> <a href="#attribute-2">attribute/2</a>, <a href="#comment-2">comment/2</a>, <a href="#eof_marker-1">eof_marker/1</a>, <a href="#error_marker-1">error_marker/1</a>, <a href="#form_list-1">form_list/1</a>, <a href="#function-2">function/2</a>, <a href="#rule-2">rule/2</a>, <a href="#type-1">type/1</a>, <a href="#warning_marker-1">warning_marker/1</a>.</p>
  1258. <h3><a name="is_integer-2">is_integer/2</a></h3>
  1259. <p><tt>is_integer(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Value::integer()) -&gt; bool()</tt></p>
  1260. <p>Returns <code>true</code> if <code>Node</code> has type
  1261. <code>integer</code> and represents <code>Value</code>, otherwise
  1262. <code>false</code>.
  1263. </p>
  1264. <p><b>See also:</b> <a href="#integer-1">integer/1</a>.</p>
  1265. <h3><a name="is_leaf-1">is_leaf/1</a></h3>
  1266. <p><tt>is_leaf(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1267. <p>Returns <code>true</code> if <code>Node</code> is a leaf node,
  1268. otherwise <code>false</code>. The currently recognised leaf node
  1269. types are:
  1270. <p><center><table border="1">
  1271. <tr>
  1272. <td><code>atom</code></td>
  1273. <td><code>char</code></td>
  1274. <td><code>comment</code></td>
  1275. <td><code>eof_marker</code></td>
  1276. <td><code>error_marker</code></td>
  1277. </tr><tr>
  1278. <td><code>float</code></td>
  1279. <td><code>integer</code></td>
  1280. <td><code>nil</code></td>
  1281. <td><code>operator</code></td>
  1282. <td><code>string</code></td>
  1283. </tr><tr>
  1284. <td><code>text</code></td>
  1285. <td><code>underscore</code></td>
  1286. <td><code>variable</code></td>
  1287. <td><code>warning_marker</code></td>
  1288. </tr>
  1289. </table></center></p>
  1290. <p>A node of type <code>tuple</code> is a leaf node if and only if
  1291. its arity is zero.</p>
  1292. <p>Note: not all literals are leaf nodes, and vice versa. E.g.,
  1293. tuples with nonzero arity and nonempty lists may be literals, but are
  1294. not leaf nodes. Variables, on the other hand, are leaf nodes but not
  1295. literals.</p>
  1296. </p>
  1297. <p><b>See also:</b> <a href="#is_literal-1">is_literal/1</a>, <a href="#type-1">type/1</a>.</p>
  1298. <h3><a name="is_list_skeleton-1">is_list_skeleton/1</a></h3>
  1299. <p><tt>is_list_skeleton(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1300. <p>Returns <code>true</code> if <code>Node</code> has type
  1301. <code>list</code> or <code>nil</code>, otherwise <code>false</code>.
  1302. </p>
  1303. <p><b>See also:</b> <a href="#list-2">list/2</a>, <a href="#nil-0">nil/0</a>.</p>
  1304. <h3><a name="is_literal-1">is_literal/1</a></h3>
  1305. <p><tt>is_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1306. <p>Returns <code>true</code> if <code>Node</code> represents a
  1307. literal term, otherwise <code>false</code>. This function returns
  1308. <code>true</code> if and only if the value of
  1309. <code>concrete(Node)</code> is defined.
  1310. </p>
  1311. <p><b>See also:</b> <a href="#abstract-1">abstract/1</a>, <a href="#concrete-1">concrete/1</a>.</p>
  1312. <h3><a name="is_proper_list-1">is_proper_list/1</a></h3>
  1313. <p><tt>is_proper_list(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1314. <p>Returns <code>true</code> if <code>Node</code> represents a
  1315. proper list, and <code>false</code> otherwise. A proper list is a
  1316. list skeleton either on the form "<code>[]</code>" or
  1317. "<code>[<em>E1</em>, ..., <em>En</em>]</code>", or "<code>[... |
  1318. <em>Tail</em>]</code>" where recursively <code>Tail</code> also
  1319. represents a proper list.
  1320. <p>Note: Since <code>Node</code> is a syntax tree, the actual
  1321. run-time values corresponding to its subtrees may often be partially
  1322. or completely unknown. Thus, if <code>Node</code> represents e.g.
  1323. "<code>[... | Ns]</code>" (where <code>Ns</code> is a variable), then
  1324. the function will return <code>false</code>, because it is not known
  1325. whether <code>Ns</code> will be bound to a list at run-time. If
  1326. <code>Node</code> instead represents e.g. "<code>[1, 2, 3]</code>" or
  1327. "<code>[A | []]</code>", then the function will return
  1328. <code>true</code>.</p>
  1329. </p>
  1330. <p><b>See also:</b> <a href="#list-2">list/2</a>.</p>
  1331. <h3><a name="is_string-2">is_string/2</a></h3>
  1332. <p><tt>is_string(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Value::string()) -&gt; bool()</tt></p>
  1333. <p>Returns <code>true</code> if <code>Node</code> has type
  1334. <code>string</code> and represents <code>Value</code>, otherwise
  1335. <code>false</code>.
  1336. </p>
  1337. <p><b>See also:</b> <a href="#string-1">string/1</a>.</p>
  1338. <h3><a name="is_tree-1">is_tree/1</a></h3>
  1339. <p><tt>is_tree(Tree::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; bool()</tt></p>
  1340. <p><em>For special purposes only</em>. Returns <code>true</code> if
  1341. <code>Tree</code> is an abstract syntax tree and <code>false</code>
  1342. otherwise.
  1343. <p><em>Note</em>: this function yields <code>false</code> for all
  1344. "old-style" <code>erl_parse</code>-compatible "parse trees".</p>
  1345. </p>
  1346. <p><b>See also:</b> <a href="#tree-2">tree/2</a>.</p>
  1347. <h3><a name="join_comments-2">join_comments/2</a></h3>
  1348. <p><tt>join_comments(Source::<a href="#type-syntaxTree">syntaxTree()</a>, Target::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1349. <p>Appends the comments of <code>Source</code> to the current
  1350. comments of <code>Target</code>.
  1351. <p>Note: This is equivalent to
  1352. <code>add_postcomments(get_postcomments(Source),
  1353. add_precomments(get_precomments(Source), Target))</code>, but
  1354. potentially more efficient.</p>
  1355. </p>
  1356. <p><b>See also:</b> <a href="#add_postcomments-2">add_postcomments/2</a>, <a href="#add_precomments-2">add_precomments/2</a>, <a href="#comment-2">comment/2</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#get_precomments-1">get_precomments/1</a>.</p>
  1357. <h3><a name="list-1">list/1</a></h3>
  1358. <p><tt>list(List) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1359. <p>Equivalent to <a href="#list-2"><tt>list(List, none)</tt></a>.</p>
  1360. <h3><a name="list-2">list/2</a></h3>
  1361. <p><tt>list(Elements::List, Tail) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1362. <ul><li><tt>List = [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></li><li><tt>Tail = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1363. <p>Constructs an abstract list skeleton. The result has type
  1364. <code>list</code> or <code>nil</code>. If <code>List</code> is a
  1365. nonempty list <code>[E1, ..., En]</code>, the result has type
  1366. <code>list</code> and represents either "<code>[<em>E1</em>, ...,
  1367. <em>En</em>]</code>", if <code>Tail</code> is <code>none</code>, or
  1368. otherwise "<code>[<em>E1</em>, ..., <em>En</em> |
  1369. <em>Tail</em>]</code>". If <code>List</code> is the empty list,
  1370. <code>Tail</code> <em>must</em> be <code>none</code>, and in that
  1371. case the result has type <code>nil</code> and represents
  1372. "<code>[]</code>" (cf. <code>nil/0</code>).
  1373. <p>The difference between lists as semantic objects (built up of
  1374. individual "cons" and "nil" terms) and the various syntactic forms
  1375. for denoting lists may be bewildering at first. This module provides
  1376. functions both for exact control of the syntactic representation as
  1377. well as for the simple composition and deconstruction in terms of
  1378. cons and head/tail operations.</p>
  1379. <p>Note: in <code>list(Elements, none)</code>, the "nil" list
  1380. terminator is implicit and has no associated information (cf.
  1381. <code>get_attrs/1</code>), while in the seemingly equivalent
  1382. <code>list(Elements, Tail)</code> when <code>Tail</code> has type
  1383. <code>nil</code>, the list terminator subtree <code>Tail</code> may
  1384. have attached attributes such as position, comments, and annotations,
  1385. which will be preserved in the result.</p>
  1386. </p>
  1387. <p><b>See also:</b> <a href="#compact_list-1">compact_list/1</a>, <a href="#cons-2">cons/2</a>, <a href="#get_attrs-1">get_attrs/1</a>, <a href="#is_list_skeleton-1">is_list_skeleton/1</a>, <a href="#is_proper_list-1">is_proper_list/1</a>, <a href="#list-1">list/1</a>, <a href="#list_elements-1">list_elements/1</a>, <a href="#list_head-1">list_head/1</a>, <a href="#list_length-1">list_length/1</a>, <a href="#list_prefix-1">list_prefix/1</a>, <a href="#list_suffix-1">list_suffix/1</a>, <a href="#list_tail-1">list_tail/1</a>, <a href="#nil-0">nil/0</a>, <a href="#normalize_list-1">normalize_list/1</a>.</p>
  1388. <h3><a name="list_comp-2">list_comp/2</a></h3>
  1389. <p><tt>list_comp(Template::<a href="#type-syntaxTree">syntaxTree()</a>, Body::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1390. <p>Creates an abstract list comprehension. If <code>Body</code> is
  1391. <code>[E1, ..., En]</code>, the result represents
  1392. "<code>[<em>Template</em> || <em>E1</em>, ..., <em>En</em>]</code>".
  1393. </p>
  1394. <p><b>See also:</b> <a href="#generator-2">generator/2</a>, <a href="#list_comp_body-1">list_comp_body/1</a>, <a href="#list_comp_template-1">list_comp_template/1</a>.</p>
  1395. <h3><a name="list_comp_body-1">list_comp_body/1</a></h3>
  1396. <p><tt>list_comp_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1397. <p>Returns the list of body subtrees of a <code>list_comp</code>
  1398. node.
  1399. </p>
  1400. <p><b>See also:</b> <a href="#list_comp-2">list_comp/2</a>.</p>
  1401. <h3><a name="list_comp_template-1">list_comp_template/1</a></h3>
  1402. <p><tt>list_comp_template(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1403. <p>Returns the template subtree of a <code>list_comp</code> node.
  1404. </p>
  1405. <p><b>See also:</b> <a href="#list_comp-2">list_comp/2</a>.</p>
  1406. <h3><a name="list_elements-1">list_elements/1</a></h3>
  1407. <p><tt>list_elements(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1408. <p>Returns the list of element subtrees of a list skeleton.
  1409. <code>Node</code> must represent a proper list. E.g., if
  1410. <code>Node</code> represents "<code>[<em>X1</em>, <em>X2</em> |
  1411. [<em>X3</em>, <em>X4</em> | []]</code>", then
  1412. <code>list_elements(Node)</code> yields the list <code>[X1, X2, X3,
  1413. X4]</code>.
  1414. </p>
  1415. <p><b>See also:</b> <a href="#is_proper_list-1">is_proper_list/1</a>, <a href="#list-2">list/2</a>.</p>
  1416. <h3><a name="list_head-1">list_head/1</a></h3>
  1417. <p><tt>list_head(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1418. <p>Returns the head element subtree of a <code>list</code> node. If
  1419. <code>Node</code> represents "<code>[<em>Head</em> ...]</code>", the
  1420. result will represent "<code><em>Head</em></code>".
  1421. </p>
  1422. <p><b>See also:</b> <a href="#cons-2">cons/2</a>, <a href="#list-2">list/2</a>, <a href="#list_tail-1">list_tail/1</a>.</p>
  1423. <h3><a name="list_length-1">list_length/1</a></h3>
  1424. <tt>list_length(Node) -&gt; term()
  1425. </tt><p>Returns the number of element subtrees of a list skeleton.
  1426. <code>Node</code> must represent a proper list. E.g., if
  1427. <code>Node</code> represents "<code>[X1 | [X2, X3 | [X4, X5,
  1428. X6]]]</code>", then <code>list_length(Node)</code> returns the
  1429. integer 6.
  1430. <p>Note: this is equivalent to
  1431. <code>length(list_elements(Node))</code>, but potentially more
  1432. efficient.</p>
  1433. </p>
  1434. <p><b>See also:</b> <a href="#is_proper_list-1">is_proper_list/1</a>, <a href="#list-2">list/2</a>, <a href="#list_elements-1">list_elements/1</a>.</p>
  1435. <h3><a name="list_prefix-1">list_prefix/1</a></h3>
  1436. <p><tt>list_prefix(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1437. <p>Returns the prefix element subtrees of a <code>list</code> node.
  1438. If <code>Node</code> represents "<code>[<em>E1</em>, ...,
  1439. <em>En</em>]</code>" or "<code>[<em>E1</em>, ..., <em>En</em> |
  1440. <em>Tail</em>]</code>", the returned value is <code>[E1, ...,
  1441. En]</code>.
  1442. </p>
  1443. <p><b>See also:</b> <a href="#list-2">list/2</a>.</p>
  1444. <h3><a name="list_suffix-1">list_suffix/1</a></h3>
  1445. <p><tt>list_suffix(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1446. <p>Returns the suffix subtree of a <code>list</code> node, if one
  1447. exists. If <code>Node</code> represents "<code>[<em>E1</em>, ...,
  1448. <em>En</em> | <em>Tail</em>]</code>", the returned value is
  1449. <code>Tail</code>, otherwise, i.e., if <code>Node</code> represents
  1450. "<code>[<em>E1</em>, ..., <em>En</em>]</code>", <code>none</code> is
  1451. returned.
  1452. <p>Note that even if this function returns some <code>Tail</code>
  1453. that is not <code>none</code>, the type of <code>Tail</code> can be
  1454. <code>nil</code>, if the tail has been given explicitly, and the list
  1455. skeleton has not been compacted (cf.
  1456. <code>compact_list/1</code>).</p>
  1457. </p>
  1458. <p><b>See also:</b> <a href="#compact_list-1">compact_list/1</a>, <a href="#list-2">list/2</a>, <a href="#nil-0">nil/0</a>.</p>
  1459. <h3><a name="list_tail-1">list_tail/1</a></h3>
  1460. <tt>list_tail(Node) -&gt; term()
  1461. </tt><p>Returns the tail of a <code>list</code> node. If
  1462. <code>Node</code> represents a single-element list
  1463. "<code>[<em>E</em>]</code>", then the result has type
  1464. <code>nil</code>, representing "<code>[]</code>". If
  1465. <code>Node</code> represents "<code>[<em>E1</em>, <em>E2</em>
  1466. ...]</code>", the result will represent "<code>[<em>E2</em>
  1467. ...]</code>", and if <code>Node</code> represents
  1468. "<code>[<em>Head</em> | <em>Tail</em>]</code>", the result will
  1469. represent "<code><em>Tail</em></code>".
  1470. </p>
  1471. <p><b>See also:</b> <a href="#cons-2">cons/2</a>, <a href="#list-2">list/2</a>, <a href="#list_head-1">list_head/1</a>.</p>
  1472. <h3><a name="macro-1">macro/1</a></h3>
  1473. <p><tt>macro(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1474. <p>Equivalent to <a href="#macro-2"><tt>macro(Name, none)</tt></a>.</p>
  1475. <h3><a name="macro-2">macro/2</a></h3>
  1476. <p><tt>macro(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Arguments) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1477. <ul><li><tt>Arguments = none | [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></li></ul></p>
  1478. <p>Creates an abstract macro application. If <code>Arguments</code>
  1479. is <code>none</code>, the result represents
  1480. "<code>?<em>Name</em></code>", otherwise, if <code>Arguments</code>
  1481. is <code>[A1, ..., An]</code>, the result represents
  1482. "<code>?<em>Name</em>(<em>A1</em>, ..., <em>An</em>)</code>".
  1483. <p>Notes: if <code>Arguments</code> is the empty list, the result
  1484. will thus represent "<code>?<em>Name</em>()</code>", including a pair
  1485. of matching parentheses.</p>
  1486. <p>The only syntactical limitation imposed by the preprocessor on the
  1487. arguments to a macro application (viewed as sequences of tokens) is
  1488. that they must be balanced with respect to parentheses, brackets,
  1489. <code>begin ... end</code>, <code>case ... end</code>, etc. The
  1490. <code>text</code> node type can be used to represent arguments which
  1491. are not regular Erlang constructs.</p>
  1492. </p>
  1493. <p><b>See also:</b> <a href="#macro-1">macro/1</a>, <a href="#macro_arguments-1">macro_arguments/1</a>, <a href="#macro_name-1">macro_name/1</a>, <a href="#text-1">text/1</a>.</p>
  1494. <h3><a name="macro_arguments-1">macro_arguments/1</a></h3>
  1495. <p><tt>macro_arguments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1496. <p>Returns the list of argument subtrees of a <code>macro</code>
  1497. node, if any. If <code>Node</code> represents
  1498. "<code>?<em>Name</em></code>", <code>none</code> is returned.
  1499. Otherwise, if <code>Node</code> represents
  1500. "<code>?<em>Name</em>(<em>A1</em>, ..., <em>An</em>)</code>",
  1501. <code>[A1, ..., An]</code> is returned.
  1502. </p>
  1503. <p><b>See also:</b> <a href="#macro-2">macro/2</a>.</p>
  1504. <h3><a name="macro_name-1">macro_name/1</a></h3>
  1505. <p><tt>macro_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1506. <p>Returns the name subtree of a <code>macro</code> node.
  1507. </p>
  1508. <p><b>See also:</b> <a href="#macro-2">macro/2</a>.</p>
  1509. <h3><a name="make_tree-2">make_tree/2</a></h3>
  1510. <p><tt>make_tree(Type::atom(), Groups::[[<a href="#type-syntaxTree">syntaxTree()</a>]]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1511. <p>Creates a syntax tree with the given type and subtrees.
  1512. <code>Type</code> must be a node type name (cf. <code>type/1</code>)
  1513. that does not denote a leaf node type (cf. <code>is_leaf/1</code>).
  1514. <code>Groups</code> must be a <em>nonempty</em> list of groups of
  1515. syntax trees, representing the subtrees of a node of the given type,
  1516. in left-to-right order as they would occur in the printed program
  1517. text, grouped by category as done by <code>subtrees/1</code>.
  1518. <p>The result of <code>copy_attrs(Node, make_tree(type(Node),
  1519. subtrees(Node)))</code> (cf. <code>update_tree/2</code>) represents
  1520. the same source code text as the original <code>Node</code>, assuming
  1521. that <code>subtrees(Node)</code> yields a nonempty list. However, it
  1522. does not necessarily have the same data representation as
  1523. <code>Node</code>.</p>
  1524. </p>
  1525. <p><b>See also:</b> <a href="#copy_attrs-2">copy_attrs/2</a>, <a href="#is_leaf-1">is_leaf/1</a>, <a href="#subtrees-1">subtrees/1</a>, <a href="#type-1">type/1</a>, <a href="#update_tree-1">update_tree/1</a>.</p>
  1526. <h3><a name="match_expr-2">match_expr/2</a></h3>
  1527. <p><tt>match_expr(Pattern::<a href="#type-syntaxTree">syntaxTree()</a>, Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1528. <p>Creates an abstract match-expression. The result represents
  1529. "<code><em>Pattern</em> = <em>Body</em></code>".
  1530. </p>
  1531. <p><b>See also:</b> <a href="#match_expr_body-1">match_expr_body/1</a>, <a href="#match_expr_pattern-1">match_expr_pattern/1</a>.</p>
  1532. <h3><a name="match_expr_body-1">match_expr_body/1</a></h3>
  1533. <p><tt>match_expr_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1534. <p>Returns the body subtree of a <code>match_expr</code> node.
  1535. </p>
  1536. <p><b>See also:</b> <a href="#match_expr-2">match_expr/2</a>.</p>
  1537. <h3><a name="match_expr_pattern-1">match_expr_pattern/1</a></h3>
  1538. <p><tt>match_expr_pattern(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1539. <p>Returns the pattern subtree of a <code>match_expr</code> node.
  1540. </p>
  1541. <p><b>See also:</b> <a href="#match_expr-2">match_expr/2</a>.</p>
  1542. <h3><a name="meta-1">meta/1</a></h3>
  1543. <p><tt>meta(Tree::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1544. <p>Creates a meta-representation of a syntax tree. The result
  1545. represents an Erlang expression "<code><em>MetaTree</em></code>"
  1546. which, if evaluated, will yield a new syntax tree representing the
  1547. same source code text as <code>Tree</code> (although the actual data
  1548. representation may be different). The expression represented by
  1549. <code>MetaTree</code> is <em>implementation independent</em> with
  1550. regard to the data structures used by the abstract syntax tree
  1551. implementation. Comments attached to nodes of <code>Tree</code> will
  1552. be preserved, but other attributes are lost.
  1553. <p>Any node in <code>Tree</code> whose node type is
  1554. <code>variable</code> (cf. <code>type/1</code>), and whose list of
  1555. annotations (cf. <code>get_ann/1</code>) contains the atom
  1556. <code>meta_var</code>, will remain unchanged in the resulting tree,
  1557. except that exactly one occurrence of <code>meta_var</code> is
  1558. removed from its annotation list.</p>
  1559. <p>The main use of the function <code>meta/1</code> is to transform a
  1560. data structure <code>Tree</code>, which represents a piece of program
  1561. code, into a form that is <em>representation independent when
  1562. printed</em>. E.g., suppose <code>Tree</code> represents a variable
  1563. named "V". Then (assuming a function <code>print/1</code> for
  1564. printing syntax trees), evaluating <code>print(abstract(Tree))</code>
  1565. - simply using <code>abstract/1</code> to map the actual data
  1566. structure onto a syntax tree representation - would output a string
  1567. that might look something like "<code>{tree, variable, ..., "V",
  1568. ...}</code>", which is obviously dependent on the implementation of
  1569. the abstract syntax trees. This could e.g. be useful for caching a
  1570. syntax tree in a file. However, in some situations like in a program
  1571. generator generator (with two "generator"), it may be unacceptable.
  1572. Using <code>print(meta(Tree))</code> instead would output a
  1573. <em>representation independent</em> syntax tree generating
  1574. expression; in the above case, something like
  1575. "<code>erl_syntax:variable("V")</code>".</p>
  1576. </p>
  1577. <p><b>See also:</b> <a href="#abstract-1">abstract/1</a>, <a href="#get_ann-1">get_ann/1</a>, <a href="#type-1">type/1</a>.</p>
  1578. <h3><a name="module_qualifier-2">module_qualifier/2</a></h3>
  1579. <p><tt>module_qualifier(Module::<a href="#type-syntaxTree">syntaxTree()</a>, Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1580. <p>Creates an abstract module qualifier. The result represents
  1581. "<code><em>Module</em>:<em>Body</em></code>".
  1582. </p>
  1583. <p><b>See also:</b> <a href="#module_qualifier_argument-1">module_qualifier_argument/1</a>, <a href="#module_qualifier_body-1">module_qualifier_body/1</a>.</p>
  1584. <h3><a name="module_qualifier_argument-1">module_qualifier_argument/1</a></h3>
  1585. <p><tt>module_qualifier_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1586. <p>Returns the argument (the module) subtree of a
  1587. <code>module_qualifier</code> node.
  1588. </p>
  1589. <p><b>See also:</b> <a href="#module_qualifier-2">module_qualifier/2</a>.</p>
  1590. <h3><a name="module_qualifier_body-1">module_qualifier_body/1</a></h3>
  1591. <p><tt>module_qualifier_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1592. <p>Returns the body subtree of a <code>module_qualifier</code>
  1593. node.
  1594. </p>
  1595. <p><b>See also:</b> <a href="#module_qualifier-2">module_qualifier/2</a>.</p>
  1596. <h3><a name="nil-0">nil/0</a></h3>
  1597. <p><tt>nil() -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1598. <p>Creates an abstract empty list. The result represents
  1599. "<code>[]</code>". The empty list is traditionally called "nil".
  1600. </p>
  1601. <p><b>See also:</b> <a href="#is_list_skeleton-1">is_list_skeleton/1</a>, <a href="#list-2">list/2</a>.</p>
  1602. <h3><a name="normalize_list-1">normalize_list/1</a></h3>
  1603. <p><tt>normalize_list(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1604. <p>Expands an abstract list skeleton to its most explicit form. If
  1605. <code>Node</code> represents "<code>[<em>E1</em>, ..., <em>En</em> |
  1606. <em>Tail</em>]</code>", the result represents "<code>[<em>E1</em> |
  1607. ... [<em>En</em> | <em>Tail1</em>] ... ]</code>", where
  1608. <code>Tail1</code> is the result of
  1609. <code>normalize_list(Tail)</code>. If <code>Node</code> represents
  1610. "<code>[<em>E1</em>, ..., <em>En</em>]</code>", the result simply
  1611. represents "<code>[<em>E1</em> | ... [<em>En</em> | []] ...
  1612. ]</code>". If <code>Node</code> does not represent a list skeleton,
  1613. <code>Node</code> itself is returned.
  1614. </p>
  1615. <p><b>See also:</b> <a href="#compact_list-1">compact_list/1</a>, <a href="#list-2">list/2</a>.</p>
  1616. <h3><a name="operator-1">operator/1</a></h3>
  1617. <p><tt>operator(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1618. <ul><li><tt>Name = atom() | string()</tt></li></ul></p>
  1619. <p>Creates an abstract operator. The name of the operator is the
  1620. character sequence represented by <code>Name</code>. This is
  1621. analogous to the print name of an atom, but an operator is never
  1622. written within single-quotes; e.g., the result of
  1623. <code>operator('++')</code> represents "<code>++</code>" rather
  1624. than "<code>'++'</code>".
  1625. </p>
  1626. <p><b>See also:</b> <a href="#atom-1">atom/1</a>, <a href="#operator_literal-1">operator_literal/1</a>, <a href="#operator_name-1">operator_name/1</a>.</p>
  1627. <h3><a name="operator_literal-1">operator_literal/1</a></h3>
  1628. <p><tt>operator_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  1629. <p>Returns the literal string represented by an
  1630. <code>operator</code> node. This is simply the operator name as a
  1631. string.
  1632. </p>
  1633. <p><b>See also:</b> <a href="#operator-1">operator/1</a>.</p>
  1634. <h3><a name="operator_name-1">operator_name/1</a></h3>
  1635. <p><tt>operator_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; atom()</tt></p>
  1636. <p>Returns the name of an <code>operator</code> node. Note that
  1637. the name is returned as an atom.
  1638. </p>
  1639. <p><b>See also:</b> <a href="#operator-1">operator/1</a>.</p>
  1640. <h3><a name="parentheses-1">parentheses/1</a></h3>
  1641. <p><tt>parentheses(Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1642. <p>Creates an abstract parenthesised expression. The result
  1643. represents "<code>(<em>Body</em>)</code>", independently of the
  1644. context.
  1645. </p>
  1646. <p><b>See also:</b> <a href="#parentheses_body-1">parentheses_body/1</a>.</p>
  1647. <h3><a name="parentheses_body-1">parentheses_body/1</a></h3>
  1648. <p><tt>parentheses_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1649. <p>Returns the body subtree of a <code>parentheses</code> node.
  1650. </p>
  1651. <p><b>See also:</b> <a href="#parentheses-1">parentheses/1</a>.</p>
  1652. <h3><a name="prefix_expr-2">prefix_expr/2</a></h3>
  1653. <p><tt>prefix_expr(Operator::<a href="#type-syntaxTree">syntaxTree()</a>, Argument::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1654. <p>Creates an abstract prefix operator expression. The result
  1655. represents "<code><em>Operator</em> <em>Argument</em></code>".
  1656. </p>
  1657. <p><b>See also:</b> <a href="#infix_expr-3">infix_expr/3</a>, <a href="#prefix_expr_argument-1">prefix_expr_argument/1</a>, <a href="#prefix_expr_operator-1">prefix_expr_operator/1</a>.</p>
  1658. <h3><a name="prefix_expr_argument-1">prefix_expr_argument/1</a></h3>
  1659. <p><tt>prefix_expr_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1660. <p>Returns the argument subtree of a <code>prefix_expr</code>
  1661. node.
  1662. </p>
  1663. <p><b>See also:</b> <a href="#prefix_expr-2">prefix_expr/2</a>.</p>
  1664. <h3><a name="prefix_expr_operator-1">prefix_expr_operator/1</a></h3>
  1665. <p><tt>prefix_expr_operator(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1666. <p>Returns the operator subtree of a <code>prefix_expr</code>
  1667. node.
  1668. </p>
  1669. <p><b>See also:</b> <a href="#prefix_expr-2">prefix_expr/2</a>.</p>
  1670. <h3><a name="qualified_name-1">qualified_name/1</a></h3>
  1671. <p><tt>qualified_name(Segments::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1672. <p>Creates an abstract qualified name. The result represents
  1673. "<code><em>S1</em>.<em>S2</em>. ... .<em>Sn</em></code>", if
  1674. <code>Segments</code> is <code>[S1, S2, ..., Sn]</code>.
  1675. </p>
  1676. <p><b>See also:</b> <a href="#qualified_name_segments-1">qualified_name_segments/1</a>.</p>
  1677. <h3><a name="qualified_name_segments-1">qualified_name_segments/1</a></h3>
  1678. <p><tt>qualified_name_segments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1679. <p>Returns the list of name segments of a
  1680. <code>qualified_name</code> node.
  1681. </p>
  1682. <p><b>See also:</b> <a href="#qualified_name-1">qualified_name/1</a>.</p>
  1683. <h3><a name="query_expr-1">query_expr/1</a></h3>
  1684. <p><tt>query_expr(Body::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1685. <p>Creates an abstract Mnemosyne query expression. The result
  1686. represents "<code>query <em>Body</em> end</code>".
  1687. </p>
  1688. <p><b>See also:</b> <a href="#query_expr_body-1">query_expr_body/1</a>, <a href="#record_access-2">record_access/2</a>, <a href="#rule-2">rule/2</a>.</p>
  1689. <h3><a name="query_expr_body-1">query_expr_body/1</a></h3>
  1690. <p><tt>query_expr_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1691. <p>Returns the body subtree of a <code>query_expr</code> node.
  1692. </p>
  1693. <p><b>See also:</b> <a href="#query_expr-1">query_expr/1</a>.</p>
  1694. <h3><a name="receive_expr-1">receive_expr/1</a></h3>
  1695. <p><tt>receive_expr(Clauses) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1696. <p>Equivalent to <a href="#receive_expr-3"><tt>receive_expr(Clauses, none, [])</tt></a>.</p>
  1697. <h3><a name="receive_expr-3">receive_expr/3</a></h3>
  1698. <p><tt>receive_expr(Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>], Timeout, Action::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1699. <ul><li><tt>Timeout = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1700. <p>Creates an abstract receive-expression. If <code>Timeout</code>
  1701. is <code>none</code>, the result represents "<code>receive
  1702. <em>C1</em>; ...; <em>Cn</em> end</code>" (the <code>Action</code>
  1703. argument is ignored). Otherwise, if <code>Clauses</code> is
  1704. <code>[C1, ..., Cn]</code> and <code>Action</code> is <code>[A1, ...,
  1705. Am]</code>, the result represents "<code>receive <em>C1</em>; ...;
  1706. <em>Cn</em> after <em>Timeout</em> -&gt; <em>A1</em>, ..., <em>Am</em>
  1707. end</code>". More exactly, if each <code>Ci</code> represents
  1708. "<code>(<em>Pi</em>) <em>Gi</em> -&gt; <em>Bi</em></code>", then the
  1709. result represents "<code>receive <em>P1</em> <em>G1</em> -&gt;
  1710. <em>B1</em>; ...; <em>Pn</em> <em>Gn</em> -&gt; <em>Bn</em> ...
  1711. end</code>".
  1712. <p>Note that in Erlang, a receive-expression must have at least one
  1713. clause if no timeout part is specified.</p>
  1714. </p>
  1715. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>, <a href="#clause-3">clause/3</a>, <a href="#receive_expr-1">receive_expr/1</a>, <a href="#receive_expr_action-1">receive_expr_action/1</a>, <a href="#receive_expr_clauses-1">receive_expr_clauses/1</a>, <a href="#receive_expr_timeout-1">receive_expr_timeout/1</a>.</p>
  1716. <h3><a name="receive_expr_action-1">receive_expr_action/1</a></h3>
  1717. <p><tt>receive_expr_action(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1718. <p>Returns the list of action body subtrees of a
  1719. <code>receive_expr</code> node. If <code>Node</code> represents
  1720. "<code>receive <em>C1</em>; ...; <em>Cn</em> end</code>", this is the
  1721. empty list.
  1722. </p>
  1723. <p><b>See also:</b> <a href="#receive_expr-3">receive_expr/3</a>.</p>
  1724. <h3><a name="receive_expr_clauses-1">receive_expr_clauses/1</a></h3>
  1725. <p><tt>receive_expr_clauses(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt>
  1726. <ul><li><tt><a name="type-type">type(Node)</a> = receive_expr</tt></li></ul></p>
  1727. <p>Returns the list of clause subtrees of a
  1728. <code>receive_expr</code> node.
  1729. </p>
  1730. <p><b>See also:</b> <a href="#receive_expr-3">receive_expr/3</a>.</p>
  1731. <h3><a name="receive_expr_timeout-1">receive_expr_timeout/1</a></h3>
  1732. <p><tt>receive_expr_timeout(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; Timeout</tt>
  1733. <ul><li><tt>Timeout = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1734. <p>Returns the timeout subtree of a <code>receive_expr</code> node,
  1735. if any. If <code>Node</code> represents "<code>receive <em>C1</em>;
  1736. ...; <em>Cn</em> end</code>", <code>none</code> is returned.
  1737. Otherwise, if <code>Node</code> represents "<code>receive
  1738. <em>C1</em>; ...; <em>Cn</em> after <em>Timeout</em> -&gt; <em>A1</em>,
  1739. ..., <em>Am</em> end</code>", <code>[A1, ..., Am]</code> is returned.
  1740. </p>
  1741. <p><b>See also:</b> <a href="#receive_expr-3">receive_expr/3</a>.</p>
  1742. <h3><a name="record_access-2">record_access/2</a></h3>
  1743. <p><tt>record_access(Argument, Field) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1744. <p>Equivalent to <a href="#record_access-3"><tt>record_access(Argument, none, Field)</tt></a>.</p>
  1745. <h3><a name="record_access-3">record_access/3</a></h3>
  1746. <p><tt>record_access(Argument::<a href="#type-syntaxTree">syntaxTree()</a>, Type, Field::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1747. <ul><li><tt>Type = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1748. <p>Creates an abstract record field access expression. If
  1749. <code>Type</code> is not <code>none</code>, the result represents
  1750. "<code><em>Argument</em>#<em>Type</em>.<em>Field</em></code>".
  1751. <p>If <code>Type</code> is <code>none</code>, the result represents
  1752. "<code><em>Argument</em>.<em>Field</em></code>". This is a special
  1753. form only allowed within Mnemosyne queries.</p>
  1754. </p>
  1755. <p><b>See also:</b> <a href="#query_expr-1">query_expr/1</a>, <a href="#record_access-2">record_access/2</a>, <a href="#record_access_argument-1">record_access_argument/1</a>, <a href="#record_access_field-1">record_access_field/1</a>, <a href="#record_access_type-1">record_access_type/1</a>, <a href="#record_expr-3">record_expr/3</a>.</p>
  1756. <h3><a name="record_access_argument-1">record_access_argument/1</a></h3>
  1757. <p><tt>record_access_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1758. <p>Returns the argument subtree of a <code>record_access</code>
  1759. node.
  1760. </p>
  1761. <p><b>See also:</b> <a href="#record_access-3">record_access/3</a>.</p>
  1762. <h3><a name="record_access_field-1">record_access_field/1</a></h3>
  1763. <p><tt>record_access_field(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1764. <p>Returns the field subtree of a <code>record_access</code>
  1765. node.
  1766. </p>
  1767. <p><b>See also:</b> <a href="#record_access-3">record_access/3</a>.</p>
  1768. <h3><a name="record_access_type-1">record_access_type/1</a></h3>
  1769. <p><tt>record_access_type(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1770. <p>Returns the type subtree of a <code>record_access</code> node,
  1771. if any. If <code>Node</code> represents
  1772. "<code><em>Argument</em>.<em>Field</em></code>", <code>none</code>
  1773. is returned, otherwise if <code>Node</code> represents
  1774. "<code><em>Argument</em>#<em>Type</em>.<em>Field</em></code>",
  1775. <code>Type</code> is returned.
  1776. </p>
  1777. <p><b>See also:</b> <a href="#record_access-3">record_access/3</a>.</p>
  1778. <h3><a name="record_expr-2">record_expr/2</a></h3>
  1779. <p><tt>record_expr(Type, Fields) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1780. <p>Equivalent to <a href="#record_expr-3"><tt>record_expr(none, Type, Fields)</tt></a>.</p>
  1781. <h3><a name="record_expr-3">record_expr/3</a></h3>
  1782. <p><tt>record_expr(Argument, Type::<a href="#type-syntaxTree">syntaxTree()</a>, Fields::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1783. <ul><li><tt>Argument = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1784. <p>Creates an abstract record expression. If <code>Fields</code> is
  1785. <code>[F1, ..., Fn]</code>, then if <code>Argument</code> is
  1786. <code>none</code>, the result represents
  1787. "<code>#<em>Type</em>{<em>F1</em>, ..., <em>Fn</em>}</code>",
  1788. otherwise it represents
  1789. "<code><em>Argument</em>#<em>Type</em>{<em>F1</em>, ...,
  1790. <em>Fn</em>}</code>".
  1791. </p>
  1792. <p><b>See also:</b> <a href="#record_access-3">record_access/3</a>, <a href="#record_expr-2">record_expr/2</a>, <a href="#record_expr_argument-1">record_expr_argument/1</a>, <a href="#record_expr_fields-1">record_expr_fields/1</a>, <a href="#record_expr_type-1">record_expr_type/1</a>, <a href="#record_field-2">record_field/2</a>, <a href="#record_index_expr-2">record_index_expr/2</a>.</p>
  1793. <h3><a name="record_expr_argument-1">record_expr_argument/1</a></h3>
  1794. <p><tt>record_expr_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1795. <p>Returns the argument subtree of a <code>record_expr</code> node,
  1796. if any. If <code>Node</code> represents
  1797. "<code>#<em>Type</em>{...}</code>", <code>none</code> is returned.
  1798. Otherwise, if <code>Node</code> represents
  1799. "<code><em>Argument</em>#<em>Type</em>{...}</code>",
  1800. <code>Argument</code> is returned.
  1801. </p>
  1802. <p><b>See also:</b> <a href="#record_expr-3">record_expr/3</a>.</p>
  1803. <h3><a name="record_expr_fields-1">record_expr_fields/1</a></h3>
  1804. <tt>record_expr_fields(Node) -&gt; term()
  1805. </tt><p>Returns the list of field subtrees of a
  1806. <code>record_expr</code> node.
  1807. </p>
  1808. <p><b>See also:</b> <a href="#record_expr-3">record_expr/3</a>.</p>
  1809. <h3><a name="record_expr_type-1">record_expr_type/1</a></h3>
  1810. <tt>record_expr_type(Node) -&gt; term()
  1811. </tt><p>Returns the type subtree of a <code>record_expr</code> node.
  1812. </p>
  1813. <p><b>See also:</b> <a href="#record_expr-3">record_expr/3</a>.</p>
  1814. <h3><a name="record_field-1">record_field/1</a></h3>
  1815. <p><tt>record_field(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1816. <p>Equivalent to <a href="#record_field-2"><tt>record_field(Name, none)</tt></a>.</p>
  1817. <h3><a name="record_field-2">record_field/2</a></h3>
  1818. <p><tt>record_field(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Value) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  1819. <ul><li><tt>Value = none | <a href="#type-syntaxTree">syntaxTree()</a></tt></li></ul></p>
  1820. <p>Creates an abstract record field specification. If
  1821. <code>Value</code> is <code>none</code>, the result represents
  1822. simply "<code><em>Name</em></code>", otherwise it represents
  1823. "<code><em>Name</em> = <em>Value</em></code>".
  1824. </p>
  1825. <p><b>See also:</b> <a href="#record_expr-3">record_expr/3</a>, <a href="#record_field_name-1">record_field_name/1</a>, <a href="#record_field_value-1">record_field_value/1</a>.</p>
  1826. <h3><a name="record_field_name-1">record_field_name/1</a></h3>
  1827. <p><tt>record_field_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1828. <p>Returns the name subtree of a <code>record_field</code> node.
  1829. </p>
  1830. <p><b>See also:</b> <a href="#record_field-2">record_field/2</a>.</p>
  1831. <h3><a name="record_field_value-1">record_field_value/1</a></h3>
  1832. <p><tt>record_field_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; none | <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1833. <p>Returns the value subtree of a <code>record_field</code> node,
  1834. if any. If <code>Node</code> represents
  1835. "<code><em>Name</em></code>", <code>none</code> is
  1836. returned. Otherwise, if <code>Node</code> represents
  1837. "<code><em>Name</em> = <em>Value</em></code>", <code>Value</code>
  1838. is returned.
  1839. </p>
  1840. <p><b>See also:</b> <a href="#record_field-2">record_field/2</a>.</p>
  1841. <h3><a name="record_index_expr-2">record_index_expr/2</a></h3>
  1842. <p><tt>record_index_expr(Type::<a href="#type-syntaxTree">syntaxTree()</a>, Field::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1843. <p>Creates an abstract record field index expression. The result
  1844. represents "<code>#<em>Type</em>.<em>Field</em></code>".
  1845. <p>(Note: the function name <code>record_index/2</code> is reserved
  1846. by the Erlang compiler, which is why that name could not be used
  1847. for this constructor.)</p>
  1848. </p>
  1849. <p><b>See also:</b> <a href="#record_expr-3">record_expr/3</a>, <a href="#record_index_expr_field-1">record_index_expr_field/1</a>, <a href="#record_index_expr_type-1">record_index_expr_type/1</a>.</p>
  1850. <h3><a name="record_index_expr_field-1">record_index_expr_field/1</a></h3>
  1851. <p><tt>record_index_expr_field(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1852. <p>Returns the field subtree of a <code>record_index_expr</code>
  1853. node.
  1854. </p>
  1855. <p><b>See also:</b> <a href="#record_index_expr-2">record_index_expr/2</a>.</p>
  1856. <h3><a name="record_index_expr_type-1">record_index_expr_type/1</a></h3>
  1857. <p><tt>record_index_expr_type(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1858. <p>Returns the type subtree of a <code>record_index_expr</code>
  1859. node.
  1860. </p>
  1861. <p><b>See also:</b> <a href="#record_index_expr-2">record_index_expr/2</a>.</p>
  1862. <h3><a name="remove_comments-1">remove_comments/1</a></h3>
  1863. <p><tt>remove_comments(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1864. <p>Clears the associated comments of <code>Node</code>.
  1865. <p>Note: This is equivalent to
  1866. <code>set_precomments(set_postcomments(Node, []), [])</code>, but
  1867. potentially more efficient.</p>
  1868. </p>
  1869. <p><b>See also:</b> <a href="#set_postcomments-2">set_postcomments/2</a>, <a href="#set_precomments-2">set_precomments/2</a>.</p>
  1870. <h3><a name="revert-1">revert/1</a></h3>
  1871. <p><tt>revert(Tree::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1872. <p>Returns an <code>erl_parse</code>-compatible representation of a
  1873. syntax tree, if possible. If <code>Tree</code> represents a
  1874. well-formed Erlang program or expression, the conversion should work
  1875. without problems. Typically, <code>is_tree/1</code> yields
  1876. <code>true</code> if conversion failed (i.e., the result is still an
  1877. abstract syntax tree), and <code>false</code> otherwise.
  1878. <p>The <code>is_tree/1</code> test is not completely foolproof. For a
  1879. few special node types (e.g. <code>arity_qualifier</code>), if such a
  1880. node occurs in a context where it is not expected, it will be left
  1881. unchanged as a non-reverted subtree of the result. This can only
  1882. happen if <code>Tree</code> does not actually represent legal Erlang
  1883. code.</p>
  1884. </p>
  1885. <p><b>See also:</b> <a href="/usr/local/home/richardc/hipe/otp/lib/stdlib/doc/erl_parse.html">erl_parse</a>, <a href="#revert_forms-1">revert_forms/1</a>.</p>
  1886. <h3><a name="revert_forms-1">revert_forms/1</a></h3>
  1887. <p><tt>revert_forms(L::Forms) -&gt; [<a href="#type-erl_parse">erl_parse()</a>]</tt>
  1888. <ul><li><tt>Forms = <a href="#type-syntaxTree">syntaxTree()</a> | [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></li></ul></p>
  1889. <p>Reverts a sequence of Erlang source code forms. The sequence can
  1890. be given either as a <code>form_list</code> syntax tree (possibly
  1891. nested), or as a list of "program form" syntax trees. If successful,
  1892. the corresponding flat list of <code>erl_parse</code>-compatible
  1893. syntax trees is returned (cf. <code>revert/1</code>). If some program
  1894. form could not be reverted, <code>{error, Form}</code> is thrown.
  1895. Standalone comments in the form sequence are discarded.
  1896. </p>
  1897. <p><b>See also:</b> <a href="#form_list-1">form_list/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#revert-1">revert/1</a>.</p>
  1898. <h3><a name="rule-2">rule/2</a></h3>
  1899. <p><tt>rule(Name::<a href="#type-syntaxTree">syntaxTree()</a>, Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1900. <p>Creates an abstract Mnemosyne rule. If <code>Clauses</code> is
  1901. <code>[C1, ..., Cn]</code>, the results represents
  1902. "<code><em>Name</em> <em>C1</em>; ...; <em>Name</em>
  1903. <em>Cn</em>.</code>". More exactly, if each <code>Ci</code>
  1904. represents "<code>(<em>Pi1</em>, ..., <em>Pim</em>) <em>Gi</em> -&gt;
  1905. <em>Bi</em></code>", then the result represents
  1906. "<code><em>Name</em>(<em>P11</em>, ..., <em>P1m</em>) <em>G1</em> :-
  1907. <em>B1</em>; ...; <em>Name</em>(<em>Pn1</em>, ..., <em>Pnm</em>)
  1908. <em>Gn</em> :- <em>Bn</em>.</code>". Rules are source code forms.
  1909. </p>
  1910. <p><b>See also:</b> <a href="#function-2">function/2</a>, <a href="#is_form-1">is_form/1</a>, <a href="#rule_arity-1">rule_arity/1</a>, <a href="#rule_clauses-1">rule_clauses/1</a>, <a href="#rule_name-1">rule_name/1</a>.</p>
  1911. <h3><a name="rule_arity-1">rule_arity/1</a></h3>
  1912. <p><tt>rule_arity(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; integer()</tt></p>
  1913. <p>Returns the arity of a <code>rule</code> node. The result is the
  1914. number of parameter patterns in the first clause of the rule;
  1915. subsequent clauses are ignored.
  1916. <p>An exception is thrown if <code>rule_clauses(Node)</code> returns
  1917. an empty list, or if the first element of that list is not a syntax
  1918. tree <code>C</code> of type <code>clause</code> such that
  1919. <code>clause_patterns(C)</code> is a nonempty list.</p>
  1920. </p>
  1921. <p><b>See also:</b> <a href="#clause-3">clause/3</a>, <a href="#clause_patterns-1">clause_patterns/1</a>, <a href="#rule-2">rule/2</a>, <a href="#rule_clauses-1">rule_clauses/1</a>.</p>
  1922. <h3><a name="rule_clauses-1">rule_clauses/1</a></h3>
  1923. <p><tt>rule_clauses(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  1924. <p>Returns the list of clause subtrees of a <code>rule</code> node.
  1925. </p>
  1926. <p><b>See also:</b> <a href="#rule-2">rule/2</a>.</p>
  1927. <h3><a name="rule_name-1">rule_name/1</a></h3>
  1928. <p><tt>rule_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1929. <p>Returns the name subtree of a <code>rule</code> node.
  1930. </p>
  1931. <p><b>See also:</b> <a href="#rule-2">rule/2</a>.</p>
  1932. <h3><a name="set_ann-2">set_ann/2</a></h3>
  1933. <p><tt>set_ann(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Annotations::[term()]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1934. <p>Sets the list of user annotations of <code>Node</code> to
  1935. <code>Annotations</code>.
  1936. </p>
  1937. <p><b>See also:</b> <a href="#add_ann-2">add_ann/2</a>, <a href="#copy_ann-2">copy_ann/2</a>, <a href="#get_ann-1">get_ann/1</a>.</p>
  1938. <h3><a name="set_attrs-2">set_attrs/2</a></h3>
  1939. <p><tt>set_attrs(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Attributes::<a href="#type-syntaxTreeAttributes">syntaxTreeAttributes()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1940. <p>Sets the attributes of <code>Node</code> to
  1941. <code>Attributes</code>.
  1942. </p>
  1943. <p><b>See also:</b> <a href="#copy_attrs-2">copy_attrs/2</a>, <a href="#get_attrs-1">get_attrs/1</a>.</p>
  1944. <h3><a name="set_pos-2">set_pos/2</a></h3>
  1945. <p><tt>set_pos(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Pos::term()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1946. <p>Sets the position information of <code>Node</code> to
  1947. <code>Pos</code>.
  1948. </p>
  1949. <p><b>See also:</b> <a href="#copy_pos-2">copy_pos/2</a>, <a href="#get_pos-1">get_pos/1</a>.</p>
  1950. <h3><a name="set_postcomments-2">set_postcomments/2</a></h3>
  1951. <p><tt>set_postcomments(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Comments::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1952. <p>Sets the post-comments of <code>Node</code> to
  1953. <code>Comments</code>. <code>Comments</code> should be a possibly
  1954. empty list of abstract comments, in top-down textual order
  1955. </p>
  1956. <p><b>See also:</b> <a href="#add_postcomments-2">add_postcomments/2</a>, <a href="#comment-2">comment/2</a>, <a href="#copy_comments-2">copy_comments/2</a>, <a href="#get_postcomments-1">get_postcomments/1</a>, <a href="#join_comments-2">join_comments/2</a>, <a href="#remove_comments-1">remove_comments/1</a>, <a href="#set_precomments-2">set_precomments/2</a>.</p>
  1957. <h3><a name="set_precomments-2">set_precomments/2</a></h3>
  1958. <p><tt>set_precomments(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Comments::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1959. <p>Sets the pre-comments of <code>Node</code> to
  1960. <code>Comments</code>. <code>Comments</code> should be a possibly
  1961. empty list of abstract comments, in top-down textual order.
  1962. </p>
  1963. <p><b>See also:</b> <a href="#add_precomments-2">add_precomments/2</a>, <a href="#comment-2">comment/2</a>, <a href="#copy_comments-2">copy_comments/2</a>, <a href="#get_precomments-1">get_precomments/1</a>, <a href="#join_comments-2">join_comments/2</a>, <a href="#remove_comments-1">remove_comments/1</a>, <a href="#set_postcomments-2">set_postcomments/2</a>.</p>
  1964. <h3><a name="size_qualifier-2">size_qualifier/2</a></h3>
  1965. <p><tt>size_qualifier(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Size::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1966. <p>Creates an abstract size qualifier. The result represents
  1967. "<code><em>Body</em>:<em>Size</em></code>".
  1968. </p>
  1969. <p><b>See also:</b> <a href="#size_qualifier_argument-1">size_qualifier_argument/1</a>, <a href="#size_qualifier_body-1">size_qualifier_body/1</a>.</p>
  1970. <h3><a name="size_qualifier_argument-1">size_qualifier_argument/1</a></h3>
  1971. <p><tt>size_qualifier_argument(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1972. <p>Returns the argument subtree (the size) of a
  1973. <code>size_qualifier</code> node.
  1974. </p>
  1975. <p><b>See also:</b> <a href="#size_qualifier-2">size_qualifier/2</a>.</p>
  1976. <h3><a name="size_qualifier_body-1">size_qualifier_body/1</a></h3>
  1977. <p><tt>size_qualifier_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1978. <p>Returns the body subtree of a <code>size_qualifier</code>
  1979. node.
  1980. </p>
  1981. <p><b>See also:</b> <a href="#size_qualifier-2">size_qualifier/2</a>.</p>
  1982. <h3><a name="string-1">string/1</a></h3>
  1983. <p><tt>string(Value::string()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  1984. <p>Creates an abstract string literal. The result represents
  1985. <code>"<em>Text</em>"</code> (including the surrounding
  1986. double-quotes), where <code>Text</code> corresponds to the sequence
  1987. of characters in <code>Value</code>, but not representing a
  1988. <em>specific</em> string literal. E.g., the result of
  1989. <code>string("x\ny")</code> represents any and all of
  1990. <code>"x\ny"</code>, <code>"x\12y"</code>, <code>"x\012y"</code> and
  1991. <code>"x\^Jy"</code>; cf. <code>char/1</code>.
  1992. </p>
  1993. <p><b>See also:</b> <a href="#char-1">char/1</a>, <a href="#is_string-2">is_string/2</a>, <a href="#string_literal-1">string_literal/1</a>, <a href="#string_value-1">string_value/1</a>.</p>
  1994. <h3><a name="string_literal-1">string_literal/1</a></h3>
  1995. <p><tt>string_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  1996. <p>Returns the literal string represented by a <code>string</code>
  1997. node. This includes surrounding double-quote characters.
  1998. </p>
  1999. <p><b>See also:</b> <a href="#string-1">string/1</a>.</p>
  2000. <h3><a name="string_value-1">string_value/1</a></h3>
  2001. <p><tt>string_value(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  2002. <p>Returns the value represented by a <code>string</code> node.
  2003. </p>
  2004. <p><b>See also:</b> <a href="#string-1">string/1</a>.</p>
  2005. <h3><a name="subtrees-1">subtrees/1</a></h3>
  2006. <p><tt>subtrees(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [[<a href="#type-syntaxTree">syntaxTree()</a>]]</tt></p>
  2007. <p>Returns the grouped list of all subtrees of a syntax tree. If
  2008. <code>Node</code> is a leaf node (cf. <code>is_leaf/1</code>), this
  2009. is the empty list, otherwise the result is always a nonempty list,
  2010. containing the lists of subtrees of <code>Node</code>, in
  2011. left-to-right order as they occur in the printed program text, and
  2012. grouped by category. Often, each group contains only a single
  2013. subtree.
  2014. <p>Depending on the type of <code>Node</code>, the size of some
  2015. groups may be variable (e.g., the group consisting of all the
  2016. elements of a tuple), while others always contain the same number of
  2017. elements - usually exactly one (e.g., the group containing the
  2018. argument expression of a case-expression). Note, however, that the
  2019. exact structure of the returned list (for a given node type) should
  2020. in general not be depended upon, since it might be subject to change
  2021. without notice.</p>
  2022. <p>The function <code>subtrees/1</code> and the constructor functions
  2023. <code>make_tree/2</code> and <code>update_tree/2</code> can be a
  2024. great help if one wants to traverse a syntax tree, visiting all its
  2025. subtrees, but treat nodes of the tree in a uniform way in most or all
  2026. cases. Using these functions makes this simple, and also assures that
  2027. your code is not overly sensitive to extensions of the syntax tree
  2028. data type, because any node types not explicitly handled by your code
  2029. can be left to a default case.</p>
  2030. <p>For example:
  2031. <pre>
  2032. postorder(F, Tree) -&gt;
  2033. F(case subtrees(Tree) of
  2034. [] -&gt; Tree;
  2035. List -&gt; update_tree(Tree,
  2036. [[postorder(F, Subtree)
  2037. || Subtree &lt;- Group]
  2038. || Group &lt;- List])
  2039. end).
  2040. </pre>
  2041. maps the function <code>F</code> on <code>Tree</code> and all its
  2042. subtrees, doing a post-order traversal of the syntax tree. (Note the
  2043. use of <code>update_tree/2</code> to preserve node attributes.) For a
  2044. simple function like:
  2045. <pre>
  2046. f(Node) -&gt;
  2047. case type(Node) of
  2048. atom -&gt; atom("a_" ++ atom_name(Node));
  2049. _ -&gt; Node
  2050. end.
  2051. </pre>
  2052. the call <code>postorder(fun f/1, Tree)</code> will yield a new
  2053. representation of <code>Tree</code> in which all atom names have been
  2054. extended with the prefix "a_", but nothing else (including comments,
  2055. annotations and line numbers) has been changed.</p>
  2056. </p>
  2057. <p><b>See also:</b> <a href="#copy_attrs-2">copy_attrs/2</a>, <a href="#is_leaf-1">is_leaf/1</a>, <a href="#make_tree-2">make_tree/2</a>, <a href="#type-1">type/1</a>.</p>
  2058. <h3><a name="text-1">text/1</a></h3>
  2059. <p><tt>text(String::string()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2060. <p>Creates an abstract piece of source code text. The result
  2061. represents exactly the sequence of characters in <code>String</code>.
  2062. This is useful in cases when one wants full control of the resulting
  2063. output, e.g., for the appearance of floating-point numbers or macro
  2064. definitions.
  2065. </p>
  2066. <p><b>See also:</b> <a href="#text_string-1">text_string/1</a>.</p>
  2067. <h3><a name="text_string-1">text_string/1</a></h3>
  2068. <p><tt>text_string(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  2069. <p>Returns the character sequence represented by a
  2070. <code>text</code> node.
  2071. </p>
  2072. <p><b>See also:</b> <a href="#text-1">text/1</a>.</p>
  2073. <h3><a name="tree-1">tree/1</a></h3>
  2074. <p><tt>tree(Type) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2075. <p>Equivalent to <a href="#tree-2"><tt>tree(Type, [])</tt></a>.</p>
  2076. <h3><a name="tree-2">tree/2</a></h3>
  2077. <p><tt>tree(Type::atom(), Data::term()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2078. <p><em>For special purposes only</em>. Creates an abstract syntax
  2079. tree node with type tag <code>Type</code> and associated data
  2080. <code>Data</code>.
  2081. <p>This function and the related <code>is_tree/1</code> and
  2082. <code>data/1</code> provide a uniform way to extend the set of
  2083. <code>erl_parse</code> node types. The associated data is any term,
  2084. whose format may depend on the type tag.</p>
  2085. <h4>Notes:</h4>
  2086. <ul>
  2087. <li>Any nodes created outside of this module must have type tags
  2088. distinct from those currently defined by this module; see
  2089. <code>type/1</code> for a complete list.</li>
  2090. <li>The type tag of a syntax tree node may also be used
  2091. as a primary tag by the <code>erl_parse</code> representation;
  2092. in that case, the selector functions for that node type
  2093. <em>must</em> handle both the abstract syntax tree and the
  2094. <code>erl_parse</code> form. The function <code>type(T)</code>
  2095. should return the correct type tag regardless of the
  2096. representation of <code>T</code>, so that the user sees no
  2097. difference between <code>erl_syntax</code> and
  2098. <code>erl_parse</code> nodes.</li>
  2099. </ul></p>
  2100. <p><b>See also:</b> <a href="#data-1">data/1</a>, <a href="#is_tree-1">is_tree/1</a>, <a href="#type-1">type/1</a>.</p>
  2101. <h3><a name="try_after_expr-2">try_after_expr/2</a></h3>
  2102. <p><tt>try_after_expr(Body::<a href="#type-syntaxTree">syntaxTree()</a>, After::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2103. <p>Equivalent to <a href="#try_expr-4"><tt>try_expr(Body, [], [], After)</tt></a>.</p>
  2104. <h3><a name="try_expr-2">try_expr/2</a></h3>
  2105. <p><tt>try_expr(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Handlers::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2106. <p>Equivalent to <a href="#try_expr-3"><tt>try_expr(Body, [], Handlers)</tt></a>.</p>
  2107. <h3><a name="try_expr-3">try_expr/3</a></h3>
  2108. <p><tt>try_expr(Body::<a href="#type-syntaxTree">syntaxTree()</a>, Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>], Handlers::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2109. <p>Equivalent to <a href="#try_expr-4"><tt>try_expr(Body, Clauses, Handlers, [])</tt></a>.</p>
  2110. <h3><a name="try_expr-4">try_expr/4</a></h3>
  2111. <p><tt>try_expr(Body::[<a href="#type-syntaxTree">syntaxTree()</a>], Clauses::[<a href="#type-syntaxTree">syntaxTree()</a>], Handlers::[<a href="#type-syntaxTree">syntaxTree()</a>], After::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2112. <p>Creates an abstract try-expression. If <code>Body</code> is
  2113. <code>[B1, ..., Bn]</code>, <code>Clauses</code> is <code>[C1, ...,
  2114. Cj]</code>, <code>Handlers</code> is <code>[H1, ..., Hk]</code>, and
  2115. <code>After</code> is <code>[A1, ..., Am]</code>, the result
  2116. represents "<code>try <em>B1</em>, ..., <em>Bn</em> of <em>C1</em>;
  2117. ...; <em>Cj</em> catch <em>H1</em>; ...; <em>Hk</em> after
  2118. <em>A1</em>, ..., <em>Am</em> end</code>". More exactly, if each
  2119. <code>Ci</code> represents "<code>(<em>CPi</em>) <em>CGi</em> -&gt;
  2120. <em>CBi</em></code>", and each <code>Hi</code> represents
  2121. "<code>(<em>HPi</em>) <em>HGi</em> -&gt; <em>HBi</em></code>", then the
  2122. result represents "<code>try <em>B1</em>, ..., <em>Bn</em> of
  2123. <em>CP1</em> <em>CG1</em> -&gt; <em>CB1</em>; ...; <em>CPj</em>
  2124. <em>CGj</em> -&gt; <em>CBj</em> catch <em>HP1</em> <em>HG1</em> -&gt;
  2125. <em>HB1</em>; ...; <em>HPk</em> <em>HGk</em> -&gt; <em>HBk</em> after
  2126. <em>A1</em>, ..., <em>Am</em> end</code>"; cf.
  2127. <code>case_expr/2</code>. If <code>Clauses</code> is the empty list,
  2128. the <code>of ...</code> section is left out. If <code>After</code> is
  2129. the empty list, the <code>after ...</code> section is left out. If
  2130. <code>Handlers</code> is the empty list, and <code>After</code> is
  2131. nonempty, the <code>catch ...</code> section is left out.
  2132. </p>
  2133. <p><b>See also:</b> <a href="#case_expr-2">case_expr/2</a>, <a href="#class_qualifier-2">class_qualifier/2</a>, <a href="#clause-3">clause/3</a>, <a href="#try_after_expr-2">try_after_expr/2</a>, <a href="#try_expr-2">try_expr/2</a>, <a href="#try_expr-3">try_expr/3</a>, <a href="#try_expr_after-1">try_expr_after/1</a>, <a href="#try_expr_body-1">try_expr_body/1</a>, <a href="#try_expr_clauses-1">try_expr_clauses/1</a>, <a href="#try_expr_handlers-1">try_expr_handlers/1</a>.</p>
  2134. <h3><a name="try_expr_after-1">try_expr_after/1</a></h3>
  2135. <p><tt>try_expr_after(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  2136. <p>Returns the list of "after" subtrees of a <code>try_expr</code>
  2137. node.
  2138. </p>
  2139. <p><b>See also:</b> <a href="#try_expr-4">try_expr/4</a>.</p>
  2140. <h3><a name="try_expr_body-1">try_expr_body/1</a></h3>
  2141. <p><tt>try_expr_body(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  2142. <p>Returns the list of body subtrees of a <code>try_expr</code>
  2143. node.
  2144. </p>
  2145. <p><b>See also:</b> <a href="#try_expr-4">try_expr/4</a>.</p>
  2146. <h3><a name="try_expr_clauses-1">try_expr_clauses/1</a></h3>
  2147. <p><tt>try_expr_clauses(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  2148. <p>Returns the list of case-clause subtrees of a
  2149. <code>try_expr</code> node. If <code>Node</code> represents
  2150. "<code>try <em>Body</em> catch <em>H1</em>; ...; <em>Hn</em>
  2151. end</code>", the result is the empty list.
  2152. </p>
  2153. <p><b>See also:</b> <a href="#try_expr-4">try_expr/4</a>.</p>
  2154. <h3><a name="try_expr_handlers-1">try_expr_handlers/1</a></h3>
  2155. <p><tt>try_expr_handlers(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  2156. <p>Returns the list of handler-clause subtrees of a
  2157. <code>try_expr</code> node.
  2158. </p>
  2159. <p><b>See also:</b> <a href="#try_expr-4">try_expr/4</a>.</p>
  2160. <h3><a name="tuple-1">tuple/1</a></h3>
  2161. <p><tt>tuple(Elements::[<a href="#type-syntaxTree">syntaxTree()</a>]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2162. <p>Creates an abstract tuple. If <code>Elements</code> is
  2163. <code>[X1, ..., Xn]</code>, the result represents
  2164. "<code>{<em>X1</em>, ..., <em>Xn</em>}</code>".
  2165. <p>Note: The Erlang language has distinct 1-tuples, i.e.,
  2166. <code>{X}</code> is always distinct from <code>X</code> itself.</p>
  2167. </p>
  2168. <p><b>See also:</b> <a href="#tuple_elements-1">tuple_elements/1</a>, <a href="#tuple_size-1">tuple_size/1</a>.</p>
  2169. <h3><a name="tuple_elements-1">tuple_elements/1</a></h3>
  2170. <p><tt>tuple_elements(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; [<a href="#type-syntaxTree">syntaxTree()</a>]</tt></p>
  2171. <p>Returns the list of element subtrees of a <code>tuple</code>
  2172. node.
  2173. </p>
  2174. <p><b>See also:</b> <a href="#tuple-1">tuple/1</a>.</p>
  2175. <h3><a name="tuple_size-1">tuple_size/1</a></h3>
  2176. <p><tt>tuple_size(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; integer()</tt></p>
  2177. <p>Returns the number of elements of a <code>tuple</code> node.
  2178. <p>Note: this is equivalent to
  2179. <code>length(tuple_elements(Node))</code>, but potentially more
  2180. efficient.</p>
  2181. </p>
  2182. <p><b>See also:</b> <a href="#tuple-1">tuple/1</a>, <a href="#tuple_elements-1">tuple_elements/1</a>.</p>
  2183. <h3><a name="type-1">type/1</a></h3>
  2184. <p><tt>type(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; atom()</tt></p>
  2185. <p>Returns the type tag of <code>Node</code>. If <code>Node</code>
  2186. does not represent a syntax tree, evaluation fails with reason
  2187. <code>badarg</code>. Node types currently defined by this module are:
  2188. <p><center><table border="1">
  2189. <tr>
  2190. <td>application</td>
  2191. <td>arity_qualifier</td>
  2192. <td>atom</td>
  2193. <td>attribute</td>
  2194. </tr><tr>
  2195. <td>binary</td>
  2196. <td>binary_field</td>
  2197. <td>block_expr</td>
  2198. <td>case_expr</td>
  2199. </tr><tr>
  2200. <td>catch_expr</td>
  2201. <td>char</td>
  2202. <td>class_qualifier</td>
  2203. <td>clause</td>
  2204. </tr><tr>
  2205. <td>comment</td>
  2206. <td>cond_expr</td>
  2207. <td>conjunction</td>
  2208. <td>disjunction</td>
  2209. </tr><tr>
  2210. <td>eof_marker</td>
  2211. <td>error_marker</td>
  2212. <td>float</td>
  2213. <td>form_list</td>
  2214. </tr><tr>
  2215. <td>fun_expr</td>
  2216. <td>function</td>
  2217. <td>generator</td>
  2218. <td>if_expr</td>
  2219. </tr><tr>
  2220. <td>implicit_fun</td>
  2221. <td>infix_expr</td>
  2222. <td>integer</td>
  2223. <td>list</td>
  2224. </tr><tr>
  2225. <td>list_comp</td>
  2226. <td>macro</td>
  2227. <td>match_expr</td>
  2228. <td>module_qualifier</td>
  2229. </tr><tr>
  2230. <td>nil</td>
  2231. <td>operator</td>
  2232. <td>parentheses</td>
  2233. <td>prefix_expr</td>
  2234. </tr><tr>
  2235. <td>qualified_name</td>
  2236. <td>query_expr</td>
  2237. <td>receive_expr</td>
  2238. <td>record_access</td>
  2239. </tr><tr>
  2240. <td>record_expr</td>
  2241. <td>record_field</td>
  2242. <td>record_index_expr</td>
  2243. <td>rule</td>
  2244. </tr><tr>
  2245. <td>size_qualifier</td>
  2246. <td>string</td>
  2247. <td>text</td>
  2248. <td>try_expr</td>
  2249. </tr><tr>
  2250. <td>tuple</td>
  2251. <td>underscore</td>
  2252. <td>variable</td>
  2253. <td>warning_marker</td>
  2254. </tr>
  2255. </table></center></p>
  2256. <p>The user may (for special purposes) create additional nodes
  2257. with other type tags, using the <code>tree/2</code> function.</p>
  2258. <p>Note: The primary constructor functions for a node type should
  2259. always have the same name as the node type itself.</p>
  2260. </p>
  2261. <p><b>See also:</b> <a href="#application-3">application/3</a>, <a href="#arity_qualifier-2">arity_qualifier/2</a>, <a href="#atom-1">atom/1</a>, <a href="#attribute-2">attribute/2</a>, <a href="#binary-1">binary/1</a>, <a href="#binary_field-2">binary_field/2</a>, <a href="#block_expr-1">block_expr/1</a>, <a href="#case_expr-2">case_expr/2</a>, <a href="#catch_expr-1">catch_expr/1</a>, <a href="#char-1">char/1</a>, <a href="#class_qualifier-2">class_qualifier/2</a>, <a href="#clause-3">clause/3</a>, <a href="#comment-2">comment/2</a>, <a href="#cond_expr-1">cond_expr/1</a>, <a href="#conjunction-1">conjunction/1</a>, <a href="#disjunction-1">disjunction/1</a>, <a href="#eof_marker-0">eof_marker/0</a>, <a href="#error_marker-1">error_marker/1</a>, <a href="#float-1">float/1</a>, <a href="#form_list-1">form_list/1</a>, <a href="#fun_expr-1">fun_expr/1</a>, <a href="#function-2">function/2</a>, <a href="#generator-2">generator/2</a>, <a href="#if_expr-1">if_expr/1</a>, <a href="#implicit_fun-2">implicit_fun/2</a>, <a href="#infix_expr-3">infix_expr/3</a>, <a href="#integer-1">integer/1</a>, <a href="#list-2">list/2</a>, <a href="#list_comp-2">list_comp/2</a>, <a href="#macro-2">macro/2</a>, <a href="#match_expr-2">match_expr/2</a>, <a href="#module_qualifier-2">module_qualifier/2</a>, <a href="#nil-0">nil/0</a>, <a href="#operator-1">operator/1</a>, <a href="#parentheses-1">parentheses/1</a>, <a href="#prefix_expr-2">prefix_expr/2</a>, <a href="#qualified_name-1">qualified_name/1</a>, <a href="#query_expr-1">query_expr/1</a>, <a href="#receive_expr-3">receive_expr/3</a>, <a href="#record_access-3">record_access/3</a>, <a href="#record_expr-2">record_expr/2</a>, <a href="#record_field-2">record_field/2</a>, <a href="#record_index_expr-2">record_index_expr/2</a>, <a href="#rule-2">rule/2</a>, <a href="#size_qualifier-2">size_qualifier/2</a>, <a href="#string-1">string/1</a>, <a href="#text-1">text/1</a>, <a href="#tree-2">tree/2</a>, <a href="#try_expr-3">try_expr/3</a>, <a href="#tuple-1">tuple/1</a>, <a href="#underscore-0">underscore/0</a>, <a href="#variable-1">variable/1</a>, <a href="#warning_marker-1">warning_marker/1</a>.</p>
  2262. <h3><a name="underscore-0">underscore/0</a></h3>
  2263. <p><tt>underscore() -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2264. <p>Creates an abstract universal pattern ("<code>_</code>"). The
  2265. lexical representation is a single underscore character. Note that
  2266. this is <em>not</em> a variable, lexically speaking.
  2267. </p>
  2268. <p><b>See also:</b> <a href="#variable-1">variable/1</a>.</p>
  2269. <h3><a name="update_tree-2">update_tree/2</a></h3>
  2270. <p><tt>update_tree(Node::<a href="#type-syntaxTree">syntaxTree()</a>, Groups::[[<a href="#type-syntaxTree">syntaxTree()</a>]]) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2271. <p>Creates a syntax tree with the same type and attributes as the
  2272. given tree. This is equivalent to <code>copy_attrs(Node,
  2273. make_tree(type(Node), Groups))</code>.
  2274. </p>
  2275. <p><b>See also:</b> <a href="#copy_attrs-2">copy_attrs/2</a>, <a href="#make_tree-2">make_tree/2</a>, <a href="#type-1">type/1</a>.</p>
  2276. <h3><a name="variable-1">variable/1</a></h3>
  2277. <p><tt>variable(Name) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt>
  2278. <ul><li><tt>Name = atom() | string()</tt></li></ul></p>
  2279. <p>Creates an abstract variable with the given name.
  2280. <code>Name</code> may be any atom or string that represents a
  2281. lexically valid variable name, but <em>not</em> a single underscore
  2282. character; cf. <code>underscore/0</code>.
  2283. <p>Note: no checking is done whether the character sequence
  2284. represents a proper variable name, i.e., whether or not its first
  2285. character is an uppercase Erlang character, or whether it does not
  2286. contain control characters, whitespace, etc.</p>
  2287. </p>
  2288. <p><b>See also:</b> <a href="#underscore-0">underscore/0</a>, <a href="#variable_literal-1">variable_literal/1</a>, <a href="#variable_name-1">variable_name/1</a>.</p>
  2289. <h3><a name="variable_literal-1">variable_literal/1</a></h3>
  2290. <p><tt>variable_literal(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; string()</tt></p>
  2291. <p>Returns the name of a <code>variable</code> node as a string.
  2292. </p>
  2293. <p><b>See also:</b> <a href="#variable-1">variable/1</a>.</p>
  2294. <h3><a name="variable_name-1">variable_name/1</a></h3>
  2295. <p><tt>variable_name(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; atom()</tt></p>
  2296. <p>Returns the name of a <code>variable</code> node as an atom.
  2297. </p>
  2298. <p><b>See also:</b> <a href="#variable-1">variable/1</a>.</p>
  2299. <h3><a name="warning_marker-1">warning_marker/1</a></h3>
  2300. <p><tt>warning_marker(Error::term()) -&gt; <a href="#type-syntaxTree">syntaxTree()</a></tt></p>
  2301. <p>Creates an abstract warning marker. The result represents an
  2302. occurrence of a possible problem in the source code, with an
  2303. associated Erlang I/O ErrorInfo structure given by <code>Error</code>
  2304. (see module <code>io</code> for details). Warning markers are
  2305. regarded as source code forms, but have no defined lexical form.
  2306. <p>Note: this is supported only for backwards compatibility with
  2307. existing parsers and tools.</p>
  2308. </p>
  2309. <p><b>See also:</b> <a href="/usr/local/home/richardc/hipe/otp/lib/stdlib/doc/io.html">io</a>, <a href="#eof_marker-0">eof_marker/0</a>, <a href="#error_marker-1">error_marker/1</a>, <a href="#is_form-1">is_form/1</a>, <a href="#warning_marker_info-1">warning_marker_info/1</a>.</p>
  2310. <h3><a name="warning_marker_info-1">warning_marker_info/1</a></h3>
  2311. <p><tt>warning_marker_info(Node::<a href="#type-syntaxTree">syntaxTree()</a>) -&gt; term()</tt></p>
  2312. <p>Returns the ErrorInfo structure of a <code>warning_marker</code>
  2313. node.
  2314. </p>
  2315. <p><b>See also:</b> <a href="#warning_marker-1">warning_marker/1</a>.</p>
  2316. </body>
  2317. </html>