PageRenderTime 235ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/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

Large files files are truncated, but you can click here to view the full file

  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_fieā€¦

Large files files are truncated, but you can click here to view the full file