From 047ed337859241db5c7befebf8eee1c5333ee0dc Mon Sep 17 00:00:00 2001
From: Richard Carlsson Note: This is equivalent to
@@ -1073,9 +1045,6 @@ remove_comments(Node) ->
%% =====================================================================
-%% @spec copy_comments(Source::syntaxTree(), Target::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Copies the pre- and postcomments from Note: this is equivalent to
@@ -2090,7 +1964,6 @@ tuple_size(Node) ->
%% =====================================================================
-%% @spec list(List) -> syntaxTree()
%% @equiv list(List, none)
-spec list([syntaxTree()]) -> syntaxTree().
@@ -2100,10 +1973,6 @@ list(List) ->
%% =====================================================================
-%% @spec list(List, Tail) -> syntaxTree()
-%% List = [syntaxTree()]
-%% Tail = none | syntaxTree()
-%%
%% @doc Constructs an abstract list skeleton. The result has type
%% Note: if The user may (for special purposes) create additional nodes
-%% with other type tags, using the Note: The primary constructor functions for a node type should
-%% always have the same name as the node type itself. A node of type Note: not all literals are leaf nodes, and vice versa. E.g.,
+%% Note: not all literals are leaf nodes, and vice versa. E.g.,
%% tuples with nonzero arity and nonempty lists may be literals, but are
%% not leaf nodes. Variables, on the other hand, are leaf nodes but not
-%% literals. This is equivalent to If possible, the comment should be moved before any preceding
+%% If possible, the comment should be moved before any preceding
%% separator characters on the same line. E.g.:
-%% Note: This is equivalent to If possible, the comment should be moved past any following
+%% If possible, the comment should be moved past any following
%% separator characters on the same line, rather than placing the
%% separators on the following line. E.g.:
-%% Node
. If Node
%% does not represent a syntax tree, evaluation fails with reason
%% badarg
. Node types currently defined by this module are:
@@ -604,8 +607,6 @@ type(Node) ->
%% =====================================================================
-%% @spec is_leaf(Node::syntaxTree()) -> boolean()
-%%
%% @doc Returns true
if Node
is a leaf node,
%% otherwise false
. The currently recognised leaf node
%% types are:
@@ -664,8 +665,6 @@ is_leaf(Node) ->
%% =====================================================================
-%% @spec is_form(Node::syntaxTree()) -> boolean()
-%%
%% @doc Returns true
if Node
is a syntax tree
%% representing a so-called "source code form", otherwise
%% false
. Forms are the Erlang source code units which,
@@ -713,8 +712,6 @@ is_form(Node) ->
%% =====================================================================
-%% @spec get_pos(Node::syntaxTree()) -> term()
-%%
%% @doc Returns the position information associated with
%% Node
. This is usually a nonnegative integer (indicating
%% the source code line number), but may be any term. By default, all
@@ -748,8 +745,6 @@ get_pos(Node) ->
%% =====================================================================
-%% @spec set_pos(Node::syntaxTree(), Pos::term()) -> syntaxTree()
-%%
%% @doc Sets the position information of Node
to
%% Pos
.
%%
@@ -772,9 +767,6 @@ set_pos(Node, Pos) ->
%% =====================================================================
-%% @spec copy_pos(Source::syntaxTree(), Target::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Copies the position information from Source
to
%% Target
.
%%
@@ -809,8 +801,6 @@ set_com(Node, Com) ->
%% =====================================================================
-%% @spec get_precomments(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the associated pre-comments of a node. This is a
%% possibly empty list of abstract comments, in top-down textual order.
%% When the code is formatted, pre-comments are typically displayed
@@ -844,9 +834,6 @@ get_precomments_1(#attr{com = #com{pre = Cs}}) -> Cs.
%% =====================================================================
-%% @spec set_precomments(Node::syntaxTree(),
-%% Comments::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Sets the pre-comments of Node
to
%% Comments
. Comments
should be a possibly
%% empty list of abstract comments, in top-down textual order.
@@ -878,9 +865,6 @@ set_precomments_1(#attr{com = Com} = Attr, Cs) ->
%% =====================================================================
-%% @spec add_precomments(Comments::[syntaxTree()],
-%% Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Appends Comments
to the pre-comments of
%% Node
.
%%
@@ -913,8 +897,6 @@ add_precomments_1(Cs, #attr{com = Com} = Attr) ->
%% =====================================================================
-%% @spec get_postcomments(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the associated post-comments of a node. This is a
%% possibly empty list of abstract comments, in top-down textual order.
%% When the code is formatted, post-comments are typically displayed to
@@ -948,9 +930,6 @@ get_postcomments_1(#attr{com = #com{post = Cs}}) -> Cs.
%% =====================================================================
-%% @spec set_postcomments(Node::syntaxTree(),
-%% Comments::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Sets the post-comments of Node
to
%% Comments
. Comments
should be a possibly
%% empty list of abstract comments, in top-down textual order
@@ -982,9 +961,6 @@ set_postcomments_1(#attr{com = Com} = Attr, Cs) ->
%% =====================================================================
-%% @spec add_postcomments(Comments::[syntaxTree()],
-%% Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Appends Comments
to the post-comments of
%% Node
.
%%
@@ -1017,8 +993,6 @@ add_postcomments_1(Cs, #attr{com = Com} = Attr) ->
%% =====================================================================
-%% @spec has_comments(Node::syntaxTree()) -> boolean()
-%%
%% @doc Yields false
if the node has no associated
%% comments, and true
otherwise.
%%
@@ -1048,8 +1022,6 @@ has_comments(_) -> false.
%% =====================================================================
-%% @spec remove_comments(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Clears the associated comments of Node
.
%%
%% Source
to
%% Target
.
%%
@@ -1097,9 +1066,6 @@ copy_comments(Source, Target) ->
%% =====================================================================
-%% @spec join_comments(Source::syntaxTree(), Target::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Appends the comments of Source
to the current
%% comments of Target
.
%%
@@ -1123,8 +1089,6 @@ join_comments(Source, Target) ->
%% =====================================================================
-%% @spec get_ann(syntaxTree()) -> [term()]
-%%
%% @doc Returns the list of user annotations associated with a syntax
%% tree node. For a newly created node, this is the empty list. The
%% annotations may be any terms.
@@ -1140,9 +1104,6 @@ get_ann(_) -> [].
%% =====================================================================
-%% @spec set_ann(Node::syntaxTree(), Annotations::[term()]) ->
-%% syntaxTree()
-%%
%% @doc Sets the list of user annotations of Node
to
%% Annotations
.
%%
@@ -1166,8 +1127,6 @@ set_ann(Node, As) ->
%% =====================================================================
-%% @spec add_ann(Annotation::term(), Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Appends the term Annotation
to the list of user
%% annotations of Node
.
%%
@@ -1193,9 +1152,6 @@ add_ann(A, Node) ->
%% =====================================================================
-%% @spec copy_ann(Source::syntaxTree(), Target::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Copies the list of user annotations from Source
to
%% Target
.
%%
@@ -1212,8 +1168,6 @@ copy_ann(Source, Target) ->
%% =====================================================================
-%% @spec get_attrs(syntaxTree()) -> syntaxTreeAttributes()
-%%
%% @doc Returns a representation of the attributes associated with a
%% syntax tree node. The attributes are all the extra information that
%% can be attached to a node. Currently, this includes position
@@ -1245,9 +1199,6 @@ get_attrs(Node) -> #attr{pos = get_pos(Node),
%% =====================================================================
-%% @spec set_attrs(Node::syntaxTree(),
-%% Attributes::syntaxTreeAttributes()) -> syntaxTree()
-%%
%% @doc Sets the attributes of Node
to
%% Attributes
.
%%
@@ -1268,9 +1219,6 @@ set_attrs(Node, Attr) ->
%% =====================================================================
-%% @spec copy_attrs(Source::syntaxTree(), Target::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Copies the attributes from Source
to
%% Target
.
%%
@@ -1287,7 +1235,6 @@ copy_attrs(S, T) ->
%% =====================================================================
-%% @spec comment(Strings) -> syntaxTree()
%% @equiv comment(none, Strings)
-spec comment([string()]) -> syntaxTree().
@@ -1297,9 +1244,6 @@ comment(Strings) ->
%% =====================================================================
-%% @spec comment(Padding, Strings::[string()]) -> syntaxTree()
-%% Padding = none | integer()
-%%
%% @doc Creates an abstract comment with the given padding and text. If
%% Strings
is a (possibly empty) list
%% ["Txt1", ..., "TxtN"]
, the result
@@ -1336,8 +1280,6 @@ comment(Pad, Strings) ->
%% =====================================================================
-%% @spec comment_text(syntaxTree()) -> [string()]
-%%
%% @doc Returns the lines of text of the abstract comment.
%%
%% @see comment/2
@@ -1349,8 +1291,6 @@ comment_text(Node) ->
%% =====================================================================
-%% @spec comment_padding(syntaxTree()) -> none | integer()
-%%
%% @doc Returns the amount of padding before the comment, or
%% none
. The latter means that a default padding may be
%% used.
@@ -1364,8 +1304,6 @@ comment_padding(Node) ->
%% =====================================================================
-%% @spec form_list(Forms::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract sequence of "source code forms". If
%% Forms
is [F1, ..., Fn]
, where each
%% Fi
is a form (cf. is_form/1
, the result
@@ -1399,8 +1337,6 @@ form_list(Forms) ->
%% =====================================================================
-%% @spec form_list_elements(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of subnodes of a form_list
node.
%%
%% @see form_list/1
@@ -1412,8 +1348,6 @@ form_list_elements(Node) ->
%% =====================================================================
-%% @spec flatten_form_list(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Flattens sublists of a form_list
node. Returns
%% Node
with all subtrees of type form_list
%% recursively expanded, yielding a single "flat" abstract form
@@ -1441,8 +1375,6 @@ flatten_form_list_1([], As) ->
%% =====================================================================
-%% @spec text(String::string()) -> syntaxTree()
-%%
%% @doc Creates an abstract piece of source code text. The result
%% represents exactly the sequence of characters in String
.
%% This is useful in cases when one wants full control of the resulting
@@ -1461,8 +1393,6 @@ text(String) ->
%% =====================================================================
-%% @spec text_string(syntaxTree()) -> string()
-%%
%% @doc Returns the character sequence represented by a
%% text
node.
%%
@@ -1475,9 +1405,6 @@ text_string(Node) ->
%% =====================================================================
-%% @spec variable(Name) -> syntaxTree()
-%% Name = atom() | string()
-%%
%% @doc Creates an abstract variable with the given name.
%% Name
may be any atom or string that represents a
%% lexically valid variable name, but not a single underscore
@@ -1515,8 +1442,6 @@ revert_variable(Node) ->
%% =====================================================================
-%% @spec variable_name(syntaxTree()) -> atom()
-%%
%% @doc Returns the name of a variable
node as an atom.
%%
%% @see variable/1
@@ -1533,8 +1458,6 @@ variable_name(Node) ->
%% =====================================================================
-%% @spec variable_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the name of a variable
node as a string.
%%
%% @see variable/1
@@ -1551,8 +1474,6 @@ variable_literal(Node) ->
%% =====================================================================
-%% @spec underscore() -> syntaxTree()
-%%
%% @doc Creates an abstract universal pattern ("_
"). The
%% lexical representation is a single underscore character. Note that
%% this is not a variable, lexically speaking.
@@ -1577,8 +1498,6 @@ revert_underscore(Node) ->
%% =====================================================================
-%% @spec integer(Value::integer()) -> syntaxTree()
-%%
%% @doc Creates an abstract integer literal. The lexical representation
%% is the canonical decimal numeral of Value
.
%%
@@ -1606,8 +1525,6 @@ revert_integer(Node) ->
%% =====================================================================
-%% @spec is_integer(Node::syntaxTree(), Value::integer()) -> boolean()
-%%
%% @doc Returns true
if Node
has type
%% integer
and represents Value
, otherwise
%% false
.
@@ -1628,8 +1545,6 @@ is_integer(Node, Value) ->
%% =====================================================================
-%% @spec integer_value(syntaxTree()) -> integer()
-%%
%% @doc Returns the value represented by an integer
node.
%%
%% @see integer/1
@@ -1646,8 +1561,6 @@ integer_value(Node) ->
%% =====================================================================
-%% @spec integer_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the numeral string represented by an
%% integer
node.
%%
@@ -1660,8 +1573,6 @@ integer_literal(Node) ->
%% =====================================================================
-%% @spec float(Value::float()) -> syntaxTree()
-%%
%% @doc Creates an abstract floating-point literal. The lexical
%% representation is the decimal floating-point numeral of
%% Value
.
@@ -1699,8 +1610,6 @@ revert_float(Node) ->
%% =====================================================================
-%% @spec float_value(syntaxTree()) -> float()
-%%
%% @doc Returns the value represented by a float
node. Note
%% that floating-point values should usually not be compared for
%% equality.
@@ -1719,8 +1628,6 @@ float_value(Node) ->
%% =====================================================================
-%% @spec float_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the numeral string represented by a float
%% node.
%%
@@ -1733,8 +1640,6 @@ float_literal(Node) ->
%% =====================================================================
-%% @spec char(Value::char()) -> syntaxTree()
-%%
%% @doc Creates an abstract character literal. The result represents
%% "$Name
", where Name
corresponds to
%% Value
.
@@ -1769,8 +1674,6 @@ revert_char(Node) ->
%% =====================================================================
-%% @spec is_char(Node::syntaxTree(), Value::char()) -> boolean()
-%%
%% @doc Returns true
if Node
has type
%% char
and represents Value
, otherwise
%% false
.
@@ -1791,8 +1694,6 @@ is_char(Node, Value) ->
%% =====================================================================
-%% @spec char_value(syntaxTree()) -> char()
-%%
%% @doc Returns the value represented by a char
node.
%%
%% @see char/1
@@ -1809,8 +1710,6 @@ char_value(Node) ->
%% =====================================================================
-%% @spec char_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the literal string represented by a char
%% node. This includes the leading "$
" character.
%%
@@ -1823,8 +1722,6 @@ char_literal(Node) ->
%% =====================================================================
-%% @spec string(Value::string()) -> syntaxTree()
-%%
%% @doc Creates an abstract string literal. The result represents
%% "Text"
(including the surrounding
%% double-quotes), where Text
corresponds to the sequence
@@ -1859,8 +1756,6 @@ revert_string(Node) ->
%% =====================================================================
-%% @spec is_string(Node::syntaxTree(), Value::string()) -> boolean()
-%%
%% @doc Returns true
if Node
has type
%% string
and represents Value
, otherwise
%% false
.
@@ -1881,8 +1776,6 @@ is_string(Node, Value) ->
%% =====================================================================
-%% @spec string_value(syntaxTree()) -> string()
-%%
%% @doc Returns the value represented by a string
node.
%%
%% @see string/1
@@ -1899,8 +1792,6 @@ string_value(Node) ->
%% =====================================================================
-%% @spec string_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the literal string represented by a string
%% node. This includes surrounding double-quote characters.
%%
@@ -1913,9 +1804,6 @@ string_literal(Node) ->
%% =====================================================================
-%% @spec atom(Name) -> syntaxTree()
-%% Name = atom() | string()
-%%
%% @doc Creates an abstract atom literal. The print name of the atom is
%% the character sequence represented by Name
.
%%
@@ -1946,8 +1834,6 @@ revert_atom(Node) ->
%% =====================================================================
-%% @spec is_atom(Node::syntaxTree(), Value::atom()) -> boolean()
-%%
%% @doc Returns true
if Node
has type
%% atom
and represents Value
, otherwise
%% false
.
@@ -1968,8 +1854,6 @@ is_atom(Node, Value) ->
%% =====================================================================
-%% @spec atom_value(syntaxTree()) -> atom()
-%%
%% @doc Returns the value represented by an atom
node.
%%
%% @see atom/1
@@ -1986,8 +1870,6 @@ atom_value(Node) ->
%% =====================================================================
-%% @spec atom_name(syntaxTree()) -> string()
-%%
%% @doc Returns the printname of an atom
node.
%%
%% @see atom/1
@@ -1999,8 +1881,6 @@ atom_name(Node) ->
%% =====================================================================
-%% @spec atom_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the literal string represented by an atom
%% node. This includes surrounding single-quote characters if necessary.
%%
@@ -2019,8 +1899,6 @@ atom_literal(Node) ->
%% =====================================================================
-%% @spec tuple(Elements::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract tuple. If Elements
is
%% [X1, ..., Xn]
, the result represents
%% "{X1, ..., Xn}
".
@@ -2053,8 +1931,6 @@ revert_tuple(Node) ->
%% =====================================================================
-%% @spec tuple_elements(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of element subtrees of a tuple
%% node.
%%
@@ -2072,8 +1948,6 @@ tuple_elements(Node) ->
%% =====================================================================
-%% @spec tuple_size(syntaxTree()) -> integer()
-%%
%% @doc Returns the number of elements of a tuple
node.
%%
%% list
or nil
. If List
is a
%% nonempty list [E1, ..., En]
, the result has type
@@ -2185,8 +2054,6 @@ revert_list(Node) ->
S, P).
%% =====================================================================
-%% @spec nil() -> syntaxTree()
-%%
%% @doc Creates an abstract empty list. The result represents
%% "[]
". The empty list is traditionally called "nil".
%%
@@ -2211,8 +2078,6 @@ revert_nil(Node) ->
%% =====================================================================
-%% @spec list_prefix(Node::syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the prefix element subtrees of a list
node.
%% If Node
represents "[E1, ...,
%% En]
" or "[E1, ..., En |
@@ -2233,8 +2098,6 @@ list_prefix(Node) ->
%% =====================================================================
-%% @spec list_suffix(Node::syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the suffix subtree of a
list
node, if one
%% exists. If Node
represents "[E1, ...,
%% En | Tail]
", the returned value is
@@ -2271,8 +2134,6 @@ list_suffix(Node) ->
%% =====================================================================
-%% @spec cons(Head::syntaxTree(), Tail::syntaxTree()) -> syntaxTree()
-%%
%% @doc "Optimising" list skeleton cons operation. Creates an abstract
%% list skeleton whose first element is Head
and whose tail
%% corresponds to Tail
. This is similar to
@@ -2306,8 +2167,6 @@ cons(Head, Tail) ->
%% =====================================================================
-%% @spec list_head(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the head element subtree of a list
node. If
%% Node
represents "[Head ...]
", the
%% result will represent "Head
".
@@ -2323,8 +2182,6 @@ list_head(Node) ->
%% =====================================================================
-%% @spec list_tail(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the tail of a list
node. If
%% Node
represents a single-element list
%% "[E]
", then the result has type
@@ -2356,8 +2213,6 @@ list_tail(Node) ->
%% =====================================================================
-%% @spec is_list_skeleton(syntaxTree()) -> boolean()
-%%
%% @doc Returns true
if Node
has type
%% list
or nil
, otherwise false
.
%%
@@ -2375,8 +2230,6 @@ is_list_skeleton(Node) ->
%% =====================================================================
-%% @spec is_proper_list(Node::syntaxTree()) -> boolean()
-%%
%% @doc Returns true
if Node
represents a
%% proper list, and false
otherwise. A proper list is a
%% list skeleton either on the form "[]
" or
@@ -2415,8 +2268,6 @@ is_proper_list(Node) ->
%% =====================================================================
-%% @spec list_elements(Node::syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of element subtrees of a list skeleton.
%% Node
must represent a proper list. E.g., if
%% Node
represents "[X1, X2 |
@@ -2448,8 +2299,6 @@ list_elements(Node, As) ->
%% =====================================================================
-%% @spec list_length(Node::syntaxTree()) -> integer()
-%%
%% @doc Returns the number of element subtrees of a list skeleton.
%%
Node
must represent a proper list. E.g., if
%% Node
represents "[X1 | [X2, X3 | [X4, X5,
@@ -2485,8 +2334,6 @@ list_length(Node, A) ->
%% =====================================================================
-%% @spec normalize_list(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Expands an abstract list skeleton to its most explicit form. If
%%
Node
represents "[E1, ..., En |
%% Tail]
", the result represents "[E1 |
@@ -2526,8 +2373,6 @@ normalize_list_1(Es, Tail) ->
%% =====================================================================
-%% @spec compact_list(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Yields the most compact form for an abstract list skeleton. The
%% result either represents "
[E1, ..., En |
%% Tail]
", where Tail
is not a list
@@ -2573,8 +2418,6 @@ compact_list(Node) ->
%% =====================================================================
-%% @spec binary(Fields::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract binary-object template. If
%% Fields
is [F1, ..., Fn]
, the result
%% represents "<<F1, ...,
@@ -2609,8 +2452,6 @@ revert_binary(Node) ->
%% =====================================================================
-%% @spec binary_fields(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of field subtrees of a
binary
%% node.
%%
@@ -2629,7 +2470,6 @@ binary_fields(Node) ->
%% =====================================================================
-%% @spec binary_field(Body) -> syntaxTree()
%% @equiv binary_field(Body, [])
-spec binary_field(syntaxTree()) -> syntaxTree().
@@ -2639,10 +2479,6 @@ binary_field(Body) ->
%% =====================================================================
-%% @spec binary_field(Body::syntaxTree(), Size,
-%% Types::[syntaxTree()]) -> syntaxTree()
-%% Size = none | syntaxTree()
-%%
%% @doc Creates an abstract binary template field.
%% If Size
is none
, this is equivalent to
%% "binary_field(Body, Types)
", otherwise it is
@@ -2665,9 +2501,6 @@ binary_field(Body, Size, Types) ->
%% =====================================================================
-%% @spec binary_field(Body::syntaxTree(), Types::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract binary template field. If
%% Types
is the empty list, the result simply represents
%% "Body
", otherwise, if Types
is
@@ -2725,8 +2558,6 @@ revert_binary_field(Node) ->
%% =====================================================================
-%% @spec binary_field_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a binary_field
.
%%
%% @see binary_field/2
@@ -2747,8 +2578,6 @@ binary_field_body(Node) ->
%% =====================================================================
-%% @spec binary_field_types(Node::syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of type-specifier subtrees of a
%% binary_field
node. If Node
represents
%% ".../T1, ..., Tn
", the result is
@@ -2772,8 +2601,6 @@ binary_field_types(Node) ->
%% =====================================================================
-%% @spec binary_field_size(Node::syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the size specifier subtree of a
%% binary_field
node, if any. If Node
%% represents "Body:Size
" or
@@ -2808,9 +2635,6 @@ binary_field_size(Node) ->
%% =====================================================================
-%% @spec size_qualifier(Body::syntaxTree(), Size::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract size qualifier. The result represents
%% "Body:Size
".
%%
@@ -2832,8 +2656,6 @@ size_qualifier(Body, Size) ->
%% =====================================================================
-%% @spec size_qualifier_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a size_qualifier
%% node.
%%
@@ -2846,8 +2668,6 @@ size_qualifier_body(Node) ->
%% =====================================================================
-%% @spec size_qualifier_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument subtree (the size) of a
%% size_qualifier
node.
%%
@@ -2860,8 +2680,6 @@ size_qualifier_argument(Node) ->
%% =====================================================================
-%% @spec error_marker(Error::term()) -> syntaxTree()
-%%
%% @doc Creates an abstract error marker. The result represents an
%% occurrence of an error in the source code, with an associated Erlang
%% I/O ErrorInfo structure given by Error
(see module
@@ -2900,8 +2718,6 @@ revert_error_marker(Node) ->
%% =====================================================================
-%% @spec error_marker_info(syntaxTree()) -> term()
-%%
%% @doc Returns the ErrorInfo structure of an error_marker
%% node.
%%
@@ -2919,8 +2735,6 @@ error_marker_info(Node) ->
%% =====================================================================
-%% @spec warning_marker(Error::term()) -> syntaxTree()
-%%
%% @doc Creates an abstract warning marker. The result represents an
%% occurrence of a possible problem in the source code, with an
%% associated Erlang I/O ErrorInfo structure given by Error
@@ -2959,8 +2773,6 @@ revert_warning_marker(Node) ->
%% =====================================================================
-%% @spec warning_marker_info(syntaxTree()) -> term()
-%%
%% @doc Returns the ErrorInfo structure of a warning_marker
%% node.
%%
@@ -2978,8 +2790,6 @@ warning_marker_info(Node) ->
%% =====================================================================
-%% @spec eof_marker() -> syntaxTree()
-%%
%% @doc Creates an abstract end-of-file marker. This represents the
%% end of input when reading a sequence of source code forms. An
%% end-of-file marker is itself regarded as a source code form
@@ -3011,7 +2821,6 @@ revert_eof_marker(Node) ->
%% =====================================================================
-%% @spec attribute(Name) -> syntaxTree()
%% @equiv attribute(Name, none)
-spec attribute(syntaxTree()) -> syntaxTree().
@@ -3021,9 +2830,6 @@ attribute(Name) ->
%% =====================================================================
-%% @spec attribute(Name::syntaxTree(), Arguments) -> syntaxTree()
-%% Arguments = none | [syntaxTree()]
-%%
%% @doc Creates an abstract program attribute. If
%% Arguments
is [A1, ..., An]
, the result
%% represents "-Name(A1, ...,
@@ -3231,8 +3037,6 @@ revert_module_name(A) ->
%% =====================================================================
-%% @spec attribute_name(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of an
attribute
node.
%%
%% @see attribute/1
@@ -3249,9 +3053,6 @@ attribute_name(Node) ->
%% =====================================================================
-%% @spec attribute_arguments(Node::syntaxTree()) ->
-%% none | [syntaxTree()]
-%%
%% @doc Returns the list of argument subtrees of an
%% attribute
node, if any. If Node
%% represents "-Name.
", the result is
@@ -3324,9 +3125,6 @@ attribute_arguments(Node) ->
%% =====================================================================
-%% @spec arity_qualifier(Body::syntaxTree(), Arity::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract arity qualifier. The result represents
%% "Body/Arity
".
%%
@@ -3348,8 +3146,6 @@ arity_qualifier(Body, Arity) ->
%% =====================================================================
-%% @spec arity_qualifier_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of an arity_qualifier
%% node.
%%
@@ -3362,8 +3158,6 @@ arity_qualifier_body(Node) ->
%% =====================================================================
-%% @spec arity_qualifier_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument (the arity) subtree of an
%% arity_qualifier
node.
%%
@@ -3376,9 +3170,6 @@ arity_qualifier_argument(Node) ->
%% =====================================================================
-%% @spec module_qualifier(Module::syntaxTree(), Body::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract module qualifier. The result represents
%% "Module:Body
".
%%
@@ -3412,8 +3203,6 @@ revert_module_qualifier(Node) ->
%% =====================================================================
-%% @spec module_qualifier_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument (the module) subtree of a
%% module_qualifier
node.
%%
@@ -3431,8 +3220,6 @@ module_qualifier_argument(Node) ->
%% =====================================================================
-%% @spec module_qualifier_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a module_qualifier
%% node.
%%
@@ -3450,8 +3237,6 @@ module_qualifier_body(Node) ->
%% =====================================================================
-%% @spec qualified_name(Segments::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract qualified name. The result represents
%% "S1.S2. ... .Sn
", if
%% Segments
is [S1, S2, ..., Sn]
.
@@ -3482,8 +3267,6 @@ revert_qualified_name(Node) ->
%% =====================================================================
-%% @spec qualified_name_segments(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of name segments of a
%% qualified_name
node.
%%
@@ -3501,9 +3284,6 @@ qualified_name_segments(Node) ->
%% =====================================================================
-%% @spec function(Name::syntaxTree(), Clauses::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract function definition. If Clauses
%% is [C1, ..., Cn]
, the result represents
%% "Name C1; ...; Name
@@ -3521,13 +3301,12 @@ qualified_name_segments(Node) ->
%% @see is_form/1
%% @see rule/2
--record(function, {name, clauses}).
-%% XXX: This one is problematic because there is a tuple with the same
-%% tag and size that comes from 'erl_parse'
-%% -record(function, {name :: syntaxTree(), clauses :: [syntaxTree()]}).
+%% Don't use the name 'function' for this record, to avoid confusion with
+%% the tuples on the form {function,Name,Arity} used by erl_parse.
+-record(func, {name :: syntaxTree(), clauses :: [syntaxTree()]}).
%% type(Node) = function
-%% data(Node) = #function{name :: Name, clauses :: Clauses}
+%% data(Node) = #func{name :: Name, clauses :: Clauses}
%%
%% Name = syntaxTree()
%% Clauses = [syntaxTree()]
@@ -3554,7 +3333,7 @@ qualified_name_segments(Node) ->
-spec function(syntaxTree(), [syntaxTree()]) -> syntaxTree().
function(Name, Clauses) ->
- tree(function, #function{name = Name, clauses = Clauses}).
+ tree(function, #func{name = Name, clauses = Clauses}).
revert_function(Node) ->
Name = function_name(Node),
@@ -3570,8 +3349,6 @@ revert_function(Node) ->
%% =====================================================================
-%% @spec function_name(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of a
function
node.
%%
%% @see function/2
@@ -3583,13 +3360,11 @@ function_name(Node) ->
{function, Pos, Name, _, _} ->
set_pos(atom(Name), Pos);
Node1 ->
- (data(Node1))#function.name
+ (data(Node1))#func.name
end.
%% =====================================================================
-%% @spec function_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of a function
%% node.
%%
@@ -3602,13 +3377,11 @@ function_clauses(Node) ->
{function, _, _, _, Clauses} ->
Clauses;
Node1 ->
- (data(Node1))#function.clauses
+ (data(Node1))#func.clauses
end.
%% =====================================================================
-%% @spec function_arity(Node::syntaxTree()) -> integer()
-%%
%% @doc Returns the arity of a function
node. The result
%% is the number of parameter patterns in the first clause of the
%% function; subsequent clauses are ignored.
@@ -3632,7 +3405,6 @@ function_arity(Node) ->
%% =====================================================================
-%% @spec clause(Guard, Body) -> syntaxTree()
%% @equiv clause([], Guard, Body)
-type guard() :: 'none' | syntaxTree() | [syntaxTree()] | [[syntaxTree()]].
@@ -3644,11 +3416,6 @@ clause(Guard, Body) ->
%% =====================================================================
-%% @spec clause(Patterns::[syntaxTree()], Guard,
-%% Body::[syntaxTree()]) -> syntaxTree()
-%% Guard = none | syntaxTree()
-%% | [syntaxTree()] | [[syntaxTree()]]
-%%
%% @doc Creates an abstract clause. If Patterns
is
%% [P1, ..., Pn]
and Body
is [B1, ...,
%% Bm]
, then if Guard
is none
, the
@@ -3787,8 +3554,6 @@ unfold_try_clause({clause, Pos, [{tuple, _, [C, V, _]}],
%% =====================================================================
-%% @spec clause_patterns(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of pattern subtrees of a clause
%% node.
%%
@@ -3806,8 +3571,6 @@ clause_patterns(Node) ->
%% =====================================================================
-%% @spec clause_guard(Node::syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the guard subtree of a clause
node, if
%% any. If Node
represents "(P1, ...,
%% Pn) when Guard -> B1, ...,
@@ -3834,8 +3597,6 @@ clause_guard(Node) ->
%% =====================================================================
-%% @spec clause_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Return the list of body subtrees of a
clause
%% node.
%%
@@ -3853,8 +3614,6 @@ clause_body(Node) ->
%% =====================================================================
-%% @spec disjunction(List::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract disjunction. If List
is
%% [E1, ..., En]
, the result represents
%% "E1; ...; En
".
@@ -3872,8 +3631,6 @@ disjunction(Tests) ->
%% =====================================================================
-%% @spec disjunction_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a
%% disjunction
node.
%%
@@ -3886,8 +3643,6 @@ disjunction_body(Node) ->
%% =====================================================================
-%% @spec conjunction(List::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract conjunction. If List
is
%% [E1, ..., En]
, the result represents
%% "E1, ..., En
".
@@ -3905,8 +3660,6 @@ conjunction(Tests) ->
%% =====================================================================
-%% @spec conjunction_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a
%% conjunction
node.
%%
@@ -3919,8 +3672,6 @@ conjunction_body(Node) ->
%% =====================================================================
-%% @spec catch_expr(Expr::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract catch-expression. The result represents
%% "catch Expr
".
%%
@@ -3947,8 +3698,6 @@ revert_catch_expr(Node) ->
%% =====================================================================
-%% @spec catch_expr_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a catch_expr
node.
%%
%% @see catch_expr/1
@@ -3965,9 +3714,6 @@ catch_expr_body(Node) ->
%% =====================================================================
-%% @spec match_expr(Pattern::syntaxTree(), Body::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract match-expression. The result represents
%% "Pattern = Body
".
%%
@@ -4000,8 +3746,6 @@ revert_match_expr(Node) ->
%% =====================================================================
-%% @spec match_expr_pattern(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the pattern subtree of a match_expr
node.
%%
%% @see match_expr/2
@@ -4018,8 +3762,6 @@ match_expr_pattern(Node) ->
%% =====================================================================
-%% @spec match_expr_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a match_expr
node.
%%
%% @see match_expr/2
@@ -4036,9 +3778,6 @@ match_expr_body(Node) ->
%% =====================================================================
-%% @spec operator(Name) -> syntaxTree()
-%% Name = atom() | string()
-%%
%% @doc Creates an abstract operator. The name of the operator is the
%% character sequence represented by Name
. This is
%% analogous to the print name of an atom, but an operator is never
@@ -4062,8 +3801,6 @@ operator(Name) ->
%% =====================================================================
-%% @spec operator_name(syntaxTree()) -> atom()
-%%
%% @doc Returns the name of an operator
node. Note that
%% the name is returned as an atom.
%%
@@ -4076,8 +3813,6 @@ operator_name(Node) ->
%% =====================================================================
-%% @spec operator_literal(syntaxTree()) -> string()
-%%
%% @doc Returns the literal string represented by an
%% operator
node. This is simply the operator name as a
%% string.
@@ -4091,9 +3826,6 @@ operator_literal(Node) ->
%% =====================================================================
-%% @spec infix_expr(Left::syntaxTree(), Operator::syntaxTree(),
-%% Right::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract infix operator expression. The result
%% represents "Left Operator
%% Right
".
@@ -4142,8 +3874,6 @@ revert_infix_expr(Node) ->
%% =====================================================================
-%% @spec infix_expr_left(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the left argument subtree of an
%% infix_expr
node.
%%
@@ -4161,8 +3891,6 @@ infix_expr_left(Node) ->
%% =====================================================================
-%% @spec infix_expr_operator(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the operator subtree of an infix_expr
%% node.
%%
@@ -4180,8 +3908,6 @@ infix_expr_operator(Node) ->
%% =====================================================================
-%% @spec infix_expr_right(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the right argument subtree of an
%% infix_expr
node.
%%
@@ -4199,9 +3925,6 @@ infix_expr_right(Node) ->
%% =====================================================================
-%% @spec prefix_expr(Operator::syntaxTree(), Argument::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract prefix operator expression. The result
%% represents "Operator Argument
".
%%
@@ -4245,8 +3968,6 @@ revert_prefix_expr(Node) ->
%% =====================================================================
-%% @spec prefix_expr_operator(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the operator subtree of a prefix_expr
%% node.
%%
@@ -4264,8 +3985,6 @@ prefix_expr_operator(Node) ->
%% =====================================================================
-%% @spec prefix_expr_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument subtree of a prefix_expr
%% node.
%%
@@ -4283,7 +4002,6 @@ prefix_expr_argument(Node) ->
%% =====================================================================
-%% @spec record_field(Name) -> syntaxTree()
%% @equiv record_field(Name, none)
-spec record_field(syntaxTree()) -> syntaxTree().
@@ -4293,9 +4011,6 @@ record_field(Name) ->
%% =====================================================================
-%% @spec record_field(Name::syntaxTree(), Value) -> syntaxTree()
-%% Value = none | syntaxTree()
-%%
%% @doc Creates an abstract record field specification. If
%% Value
is none
, the result represents
%% simply "Name
", otherwise it represents
@@ -4319,8 +4034,6 @@ record_field(Name, Value) ->
%% =====================================================================
-%% @spec record_field_name(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of a record_field
node.
%%
%% @see record_field/2
@@ -4332,8 +4045,6 @@ record_field_name(Node) ->
%% =====================================================================
-%% @spec record_field_value(syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the value subtree of a record_field
node,
%% if any. If Node
represents
%% "Name
", none
is
@@ -4350,9 +4061,6 @@ record_field_value(Node) ->
%% =====================================================================
-%% @spec record_index_expr(Type::syntaxTree(), Field::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract record field index expression. The result
%% represents "#Type.Field
".
%%
@@ -4397,8 +4105,6 @@ revert_record_index_expr(Node) ->
%% =====================================================================
-%% @spec record_index_expr_type(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the type subtree of a record_index_expr
%% node.
%%
@@ -4416,8 +4122,6 @@ record_index_expr_type(Node) ->
%% =====================================================================
-%% @spec record_index_expr_field(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the field subtree of a record_index_expr
%% node.
%%
@@ -4435,7 +4139,6 @@ record_index_expr_field(Node) ->
%% =====================================================================
-%% @spec record_access(Argument, Field) -> syntaxTree()
%% @equiv record_access(Argument, none, Field)
-spec record_access(syntaxTree(), syntaxTree()) -> syntaxTree().
@@ -4445,10 +4148,6 @@ record_access(Argument, Field) ->
%% =====================================================================
-%% @spec record_access(Argument::syntaxTree(), Type,
-%% Field::syntaxTree()) -> syntaxTree()
-%% Type = none | syntaxTree()
-%%
%% @doc Creates an abstract record field access expression. If
%% Type
is not none
, the result represents
%% "Argument#Type.Field
".
@@ -4510,8 +4209,6 @@ revert_record_access(Node) ->
%% =====================================================================
-%% @spec record_access_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument subtree of a record_access
%% node.
%%
@@ -4531,8 +4228,6 @@ record_access_argument(Node) ->
%% =====================================================================
-%% @spec record_access_type(syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the type subtree of a record_access
node,
%% if any. If Node
represents
%% "Argument.Field
", none
@@ -4556,8 +4251,6 @@ record_access_type(Node) ->
%% =====================================================================
-%% @spec record_access_field(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the field subtree of a record_access
%% node.
%%
@@ -4577,7 +4270,6 @@ record_access_field(Node) ->
%% =====================================================================
-%% @spec record_expr(Type, Fields) -> syntaxTree()
%% @equiv record_expr(none, Type, Fields)
-spec record_expr(syntaxTree(), [syntaxTree()]) -> syntaxTree().
@@ -4587,10 +4279,6 @@ record_expr(Type, Fields) ->
%% =====================================================================
-%% @spec record_expr(Argument, Type::syntaxTree(),
-%% Fields::[syntaxTree()]) -> syntaxTree()
-%% Argument = none | syntaxTree()
-%%
%% @doc Creates an abstract record expression. If Fields
is
%% [F1, ..., Fn]
, then if Argument
is
%% none
, the result represents
@@ -4659,8 +4347,6 @@ revert_record_expr(Node) ->
%% =====================================================================
-%% @spec record_expr_argument(syntaxTree()) -> none | syntaxTree()
-%%
%% @doc Returns the argument subtree of a record_expr
node,
%% if any. If Node
represents
%% "#Type{...}
", none
is returned.
@@ -4684,8 +4370,6 @@ record_expr_argument(Node) ->
%% =====================================================================
-%% @spec record_expr_type(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the type subtree of a record_expr
node.
%%
%% @see record_expr/3
@@ -4704,8 +4388,6 @@ record_expr_type(Node) ->
%% =====================================================================
-%% @spec record_expr_fields(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of field subtrees of a
%% record_expr
node.
%%
@@ -4725,10 +4407,6 @@ record_expr_fields(Node) ->
%% =====================================================================
-%% @spec application(Module, Function::syntaxTree(),
-%% Arguments::[syntaxTree()]) -> syntaxTree()
-%% Module = none | syntaxTree()
-%%
%% @doc Creates an abstract function application expression. If
%% Module
is none
, this is call is equivalent
%% to application(Function, Arguments)
, otherwise it is
@@ -4750,9 +4428,6 @@ application(Module, Name, Arguments) ->
%% =====================================================================
-%% @spec application(Operator::syntaxTree(),
-%% Arguments::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract function application expression. If
%% Arguments
is [A1, ..., An]
, the result
%% represents "Operator(A1, ...,
@@ -4792,8 +4467,6 @@ revert_application(Node) ->
%% =====================================================================
-%% @spec application_operator(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the operator subtree of an
application
%% node.
%%
@@ -4816,8 +4489,6 @@ application_operator(Node) ->
%% =====================================================================
-%% @spec application_arguments(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of argument subtrees of an
%% application
node.
%%
@@ -4835,9 +4506,6 @@ application_arguments(Node) ->
%% =====================================================================
-%% @spec list_comp(Template::syntaxTree(), Body::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract list comprehension. If Body
is
%% [E1, ..., En]
, the result represents
%% "[Template || E1, ..., En]
".
@@ -4874,8 +4542,6 @@ revert_list_comp(Node) ->
%% =====================================================================
-%% @spec list_comp_template(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the template subtree of a list_comp
node.
%%
%% @see list_comp/2
@@ -4892,8 +4558,6 @@ list_comp_template(Node) ->
%% =====================================================================
-%% @spec list_comp_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a list_comp
%% node.
%%
@@ -4910,9 +4574,6 @@ list_comp_body(Node) ->
end.
%% =====================================================================
-%% @spec binary_comp(Template::syntaxTree(), Body::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract binary comprehension. If Body
is
%% [E1, ..., En]
, the result represents
%% "<<Template || E1, ..., En>>
".
@@ -4949,8 +4610,6 @@ revert_binary_comp(Node) ->
%% =====================================================================
-%% @spec binary_comp_template(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the template subtree of a binary_comp
node.
%%
%% @see binary_comp/2
@@ -4967,8 +4626,6 @@ binary_comp_template(Node) ->
%% =====================================================================
-%% @spec binary_comp_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a binary_comp
%% node.
%%
@@ -4986,8 +4643,6 @@ binary_comp_body(Node) ->
%% =====================================================================
-%% @spec query_expr(Body::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract Mnemosyne query expression. The result
%% represents "query Body end
".
%%
@@ -5016,8 +4671,6 @@ revert_query_expr(Node) ->
%% =====================================================================
-%% @spec query_expr_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a query_expr
node.
%%
%% @see query_expr/1
@@ -5034,9 +4687,6 @@ query_expr_body(Node) ->
%% =====================================================================
-%% @spec rule(Name::syntaxTree(), Clauses::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract Mnemosyne rule. If Clauses
is
%% [C1, ..., Cn]
, the results represents
%% "Name C1; ...; Name
@@ -5095,8 +4745,6 @@ revert_rule(Node) ->
%% =====================================================================
-%% @spec rule_name(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of a
rule
node.
%%
%% @see rule/2
@@ -5112,8 +4760,6 @@ rule_name(Node) ->
end.
%% =====================================================================
-%% @spec rule_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of a rule
node.
%%
%% @see rule/2
@@ -5129,8 +4775,6 @@ rule_clauses(Node) ->
end.
%% =====================================================================
-%% @spec rule_arity(Node::syntaxTree()) -> integer()
-%%
%% @doc Returns the arity of a rule
node. The result is the
%% number of parameter patterns in the first clause of the rule;
%% subsequent clauses are ignored.
@@ -5154,9 +4798,6 @@ rule_arity(Node) ->
%% =====================================================================
-%% @spec generator(Pattern::syntaxTree(), Body::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract generator. The result represents
%% "Pattern <- Body
".
%%
@@ -5191,8 +4832,6 @@ revert_generator(Node) ->
%% =====================================================================
-%% @spec generator_pattern(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the pattern subtree of a generator
node.
%%
%% @see generator/2
@@ -5209,8 +4848,6 @@ generator_pattern(Node) ->
%% =====================================================================
-%% @spec generator_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a generator
node.
%%
%% @see generator/2
@@ -5227,9 +4864,6 @@ generator_body(Node) ->
%% =====================================================================
-%% @spec binary_generator(Pattern::syntaxTree(), Body::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract binary_generator. The result represents
%% "Pattern <- Body
".
%%
@@ -5264,8 +4898,6 @@ revert_binary_generator(Node) ->
%% =====================================================================
-%% @spec binary_generator_pattern(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the pattern subtree of a generator
node.
%%
%% @see binary_generator/2
@@ -5282,8 +4914,6 @@ binary_generator_pattern(Node) ->
%% =====================================================================
-%% @spec binary_generator_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a generator
node.
%%
%% @see binary_generator/2
@@ -5300,8 +4930,6 @@ binary_generator_body(Node) ->
%% =====================================================================
-%% @spec block_expr(Body::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract block expression. If Body
is
%% [B1, ..., Bn]
, the result represents "begin
%% B1, ..., Bn end
".
@@ -5319,7 +4947,7 @@ binary_generator_body(Node) ->
%%
%% Body = [erl_parse()] \ []
--spec block_expr(Body::[syntaxTree()]) -> syntaxTree().
+-spec block_expr([syntaxTree()]) -> syntaxTree().
block_expr(Body) ->
tree(block_expr, Body).
@@ -5331,8 +4959,6 @@ revert_block_expr(Node) ->
%% =====================================================================
-%% @spec block_expr_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a block_expr
%% node.
%%
@@ -5350,8 +4976,6 @@ block_expr_body(Node) ->
%% =====================================================================
-%% @spec if_expr(Clauses::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract if-expression. If Clauses
is
%% [C1, ..., Cn]
, the result represents "if
%% C1; ...; Cn end
". More exactly, if each
@@ -5390,8 +5014,6 @@ revert_if_expr(Node) ->
%% =====================================================================
-%% @spec if_expr_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of an if_expr
%% node.
%%
@@ -5409,9 +5031,6 @@ if_expr_clauses(Node) ->
%% =====================================================================
-%% @spec case_expr(Argument::syntaxTree(), Clauses::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract case-expression. If Clauses
is
%% [C1, ..., Cn]
, the result represents "case
%% Argument of C1; ...; Cn end
". More
@@ -5459,8 +5078,6 @@ revert_case_expr(Node) ->
%% =====================================================================
-%% @spec case_expr_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument subtree of a case_expr
node.
%%
%% @see case_expr/2
@@ -5477,8 +5094,6 @@ case_expr_argument(Node) ->
%% =====================================================================
-%% @spec case_expr_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of a case_expr
%% node.
%%
@@ -5496,8 +5111,6 @@ case_expr_clauses(Node) ->
%% =====================================================================
-%% @spec cond_expr(Clauses::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract cond-expression. If Clauses
is
%% [C1, ..., Cn]
, the result represents "cond
%% C1; ...; Cn end
". More exactly, if each
@@ -5536,8 +5149,6 @@ revert_cond_expr(Node) ->
%% =====================================================================
-%% @spec cond_expr_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of a cond_expr
%% node.
%%
@@ -5555,7 +5166,6 @@ cond_expr_clauses(Node) ->
%% =====================================================================
-%% @spec receive_expr(Clauses) -> syntaxTree()
%% @equiv receive_expr(Clauses, none, [])
-spec receive_expr([syntaxTree()]) -> syntaxTree().
@@ -5565,10 +5175,6 @@ receive_expr(Clauses) ->
%% =====================================================================
-%% @spec receive_expr(Clauses::[syntaxTree()], Timeout,
-%% Action::[syntaxTree()]) -> syntaxTree()
-%% Timeout = none | syntaxTree()
-%%
%% @doc Creates an abstract receive-expression. If Timeout
%% is none
, the result represents "receive
%% C1; ...; Cn end
" (the Action
@@ -5647,9 +5253,6 @@ revert_receive_expr(Node) ->
%% =====================================================================
-%% @spec receive_expr_clauses(syntaxTree()) -> [syntaxTree()]
-%% type(Node) = receive_expr
-%%
%% @doc Returns the list of clause subtrees of a
%% receive_expr
node.
%%
@@ -5669,9 +5272,6 @@ receive_expr_clauses(Node) ->
%% =====================================================================
-%% @spec receive_expr_timeout(Node::syntaxTree()) -> Timeout
-%% Timeout = none | syntaxTree()
-%%
%% @doc Returns the timeout subtree of a receive_expr
node,
%% if any. If Node
represents "receive C1;
%% ...; Cn end
", none
is returned.
@@ -5695,8 +5295,6 @@ receive_expr_timeout(Node) ->
%% =====================================================================
-%% @spec receive_expr_action(Node::syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of action body subtrees of a
%% receive_expr
node. If Node
represents
%% "receive C1; ...; Cn end
", this is the
@@ -5718,8 +5316,6 @@ receive_expr_action(Node) ->
%% =====================================================================
-%% @spec try_expr(Body::syntaxTree(), Handlers::[syntaxTree()]) ->
-%% syntaxTree()
%% @equiv try_expr(Body, [], Handlers)
-spec try_expr([syntaxTree()], [syntaxTree()]) -> syntaxTree().
@@ -5729,8 +5325,6 @@ try_expr(Body, Handlers) ->
%% =====================================================================
-%% @spec try_expr(Body::syntaxTree(), Clauses::[syntaxTree()],
-%% Handlers::[syntaxTree()]) -> syntaxTree()
%% @equiv try_expr(Body, Clauses, Handlers, [])
-spec try_expr([syntaxTree()], [syntaxTree()], [syntaxTree()]) -> syntaxTree().
@@ -5740,8 +5334,6 @@ try_expr(Body, Clauses, Handlers) ->
%% =====================================================================
-%% @spec try_after_expr(Body::syntaxTree(), After::[syntaxTree()]) ->
-%% syntaxTree()
%% @equiv try_expr(Body, [], [], After)
-spec try_after_expr([syntaxTree()], [syntaxTree()]) -> syntaxTree().
@@ -5751,10 +5343,6 @@ try_after_expr(Body, After) ->
%% =====================================================================
-%% @spec try_expr(Body::[syntaxTree()], Clauses::[syntaxTree()],
-%% Handlers::[syntaxTree()], After::[syntaxTree()]) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract try-expression. If Body
is
%% [B1, ..., Bn]
, Clauses
is [C1, ...,
%% Cj]
, Handlers
is [H1, ..., Hk]
, and
@@ -5832,8 +5420,6 @@ revert_try_expr(Node) ->
%% =====================================================================
-%% @spec try_expr_body(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of body subtrees of a try_expr
%% node.
%%
@@ -5851,8 +5437,6 @@ try_expr_body(Node) ->
%% =====================================================================
-%% @spec try_expr_clauses(Node::syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of case-clause subtrees of a
%% try_expr
node. If Node
represents
%% "try Body catch H1; ...; Hn
@@ -5872,8 +5456,6 @@ try_expr_clauses(Node) ->
%% =====================================================================
-%% @spec try_expr_handlers(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of handler-clause subtrees of a
%%
try_expr
node.
%%
@@ -5891,8 +5473,6 @@ try_expr_handlers(Node) ->
%% =====================================================================
-%% @spec try_expr_after(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of "after" subtrees of a try_expr
%% node.
%%
@@ -5910,9 +5490,6 @@ try_expr_after(Node) ->
%% =====================================================================
-%% @spec class_qualifier(Class::syntaxTree(), Body::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract class qualifier. The result represents
%% "Class:Body
".
%%
@@ -5935,8 +5512,6 @@ class_qualifier(Class, Body) ->
%% =====================================================================
-%% @spec class_qualifier_argument(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the argument (the class) subtree of a
%% class_qualifier
node.
%%
@@ -5949,8 +5524,6 @@ class_qualifier_argument(Node) ->
%% =====================================================================
-%% @spec class_qualifier_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a class_qualifier
node.
%%
%% @see class_qualifier/2
@@ -5962,9 +5535,6 @@ class_qualifier_body(Node) ->
%% =====================================================================
-%% @spec implicit_fun(Name::syntaxTree(), Arity::syntaxTree()) ->
-%% syntaxTree()
-%%
%% @doc Creates an abstract "implicit fun" expression. If
%% Arity
is none
, this is equivalent to
%% implicit_fun(Name)
, otherwise it is equivalent to
@@ -5984,9 +5554,6 @@ implicit_fun(Name, Arity) ->
%% =====================================================================
-%% @spec implicit_fun(Module::syntaxTree(), Name::syntaxTree(),
-%% Arity::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract module-qualified "implicit fun" expression.
%% If Module
is none
, this is equivalent to
%% implicit_fun(Name, Arity)
, otherwise it is equivalent to
@@ -6008,8 +5575,6 @@ implicit_fun(Module, Name, Arity) ->
%% =====================================================================
-%% @spec implicit_fun(Name::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract "implicit fun" expression. The result
%% represents "fun Name
". Name
should
%% represent either F/A
or
@@ -6070,8 +5635,6 @@ revert_implicit_fun(Node) ->
%% =====================================================================
-%% @spec implicit_fun_name(Node::syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of an implicit_fun
node.
%%
%% Node
represents "fun
@@ -6108,8 +5671,6 @@ implicit_fun_name(Node) ->
%% =====================================================================
-%% @spec fun_expr(Clauses::[syntaxTree()]) -> syntaxTree()
-%%
%% @doc Creates an abstract fun-expression. If
Clauses
is
%% [C1, ..., Cn]
, the result represents "fun
%% C1; ...; Cn end
". More exactly, if each
@@ -6150,8 +5711,6 @@ revert_fun_expr(Node) ->
%% =====================================================================
-%% @spec fun_expr_clauses(syntaxTree()) -> [syntaxTree()]
-%%
%% @doc Returns the list of clause subtrees of a fun_expr
%% node.
%%
@@ -6169,8 +5728,6 @@ fun_expr_clauses(Node) ->
%% =====================================================================
-%% @spec fun_expr_arity(syntaxTree()) -> integer()
-%%
%% @doc Returns the arity of a fun_expr
node. The result is
%% the number of parameter patterns in the first clause of the
%% fun-expression; subsequent clauses are ignored.
@@ -6192,8 +5749,6 @@ fun_expr_arity(Node) ->
%% =====================================================================
-%% @spec parentheses(Body::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates an abstract parenthesised expression. The result
%% represents "(Body)
", independently of the
%% context.
@@ -6213,8 +5768,6 @@ revert_parentheses(Node) ->
%% =====================================================================
-%% @spec parentheses_body(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the body subtree of a parentheses
node.
%%
%% @see parentheses/1
@@ -6226,7 +5779,6 @@ parentheses_body(Node) ->
%% =====================================================================
-%% @spec macro(Name) -> syntaxTree()
%% @equiv macro(Name, none)
-spec macro(syntaxTree()) -> syntaxTree().
@@ -6236,9 +5788,6 @@ macro(Name) ->
%% =====================================================================
-%% @spec macro(Name::syntaxTree(), Arguments) -> syntaxTree()
-%% Arguments = none | [syntaxTree()]
-%%
%% @doc Creates an abstract macro application. If Arguments
%% is none
, the result represents
%% "?Name
", otherwise, if Arguments
@@ -6276,8 +5825,6 @@ macro(Name, Arguments) ->
%% =====================================================================
-%% @spec macro_name(syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns the name subtree of a macro
node.
%%
%% @see macro/2
@@ -6289,8 +5836,6 @@ macro_name(Node) ->
%% =====================================================================
-%% @spec macro_arguments(Node::syntaxTree()) -> none | [syntaxTree()]
-%%
%% @doc Returns the list of argument subtrees of a macro
%% node, if any. If Node
represents
%% "?Name
", none
is returned.
@@ -6307,8 +5852,6 @@ macro_arguments(Node) ->
%% =====================================================================
-%% @spec abstract(Term::term()) -> syntaxTree()
-%%
%% @doc Returns the syntax tree corresponding to an Erlang term.
%% Term
must be a literal term, i.e., one that can be
%% represented as a source code literal. Thus, it may not contain a
@@ -6365,8 +5908,6 @@ abstract_tail(H, T) ->
%% =====================================================================
-%% @spec concrete(Node::syntaxTree()) -> term()
-%%
%% @doc Returns the Erlang term represented by a syntax tree. Evaluation
%% fails with reason badarg
if Node
does not
%% represent a literal term.
@@ -6431,8 +5972,6 @@ concrete_list([]) ->
%% =====================================================================
-%% @spec is_literal(Node::syntaxTree()) -> boolean()
-%%
%% @doc Returns true
if Node
represents a
%% literal term, otherwise false
. This function returns
%% true
if and only if the value of
@@ -6467,8 +6006,6 @@ is_literal(T) ->
%% =====================================================================
-%% @spec revert(Tree::syntaxTree()) -> syntaxTree()
-%%
%% @doc Returns an erl_parse
-compatible representation of a
%% syntax tree, if possible. If Tree
represents a
%% well-formed Erlang program or expression, the conversion should work
@@ -6617,10 +6154,6 @@ revert_root(Node) ->
%% =====================================================================
-%% @spec revert_forms(Forms) -> [erl_parse()]
-%%
-%% Forms = syntaxTree() | [syntaxTree()]
-%%
%% @doc Reverts a sequence of Erlang source code forms. The sequence can
%% be given either as a form_list
syntax tree (possibly
%% nested), or as a list of "program form" syntax trees. If successful,
@@ -6635,10 +6168,10 @@ revert_root(Node) ->
-type forms() :: syntaxTree() | [syntaxTree()].
-%% -spec revert_forms(forms()) -> [erl_parse()].
+-spec revert_forms(forms()) -> [erl_parse()].
-revert_forms(L) when is_list(L) ->
- revert_forms(form_list(L));
+revert_forms(Forms) when is_list(Forms) ->
+ revert_forms(form_list(Forms));
revert_forms(T) ->
case type(T) of
form_list ->
@@ -6675,8 +6208,6 @@ revert_forms_1([]) ->
%% =====================================================================
-%% @spec subtrees(Node::syntaxTree()) -> [[syntaxTree()]]
-%%
%% @doc Returns the grouped list of all subtrees of a syntax tree. If
%% Node
is a leaf node (cf. is_leaf/1
), this
%% is the empty list, otherwise the result is always a nonempty list,
@@ -6898,9 +6429,6 @@ subtrees(T) ->
%% =====================================================================
-%% @spec update_tree(Node::syntaxTree(), Groups::[[syntaxTree()]]) ->
-%% syntaxTree()
-%%
%% @doc Creates a syntax tree with the same type and attributes as the
%% given tree. This is equivalent to copy_attrs(Node,
%% make_tree(type(Node), Groups))
.
@@ -6916,9 +6444,6 @@ update_tree(Node, Groups) ->
%% =====================================================================
-%% @spec make_tree(Type::atom(), Groups::[[syntaxTree()]]) ->
-%% syntaxTree()
-%%
%% @doc Creates a syntax tree with the given type and subtrees.
%% Type
must be a node type name (cf. type/1
)
%% that does not denote a leaf node type (cf. is_leaf/1
).
@@ -6997,8 +6522,6 @@ make_tree(tuple, [E]) -> tuple(E).
%% =====================================================================
-%% @spec meta(Tree::syntaxTree()) -> syntaxTree()
-%%
%% @doc Creates a meta-representation of a syntax tree. The result
%% represents an Erlang expression "MetaTree
"
%% which, if evaluated, will yield a new syntax tree representing the
@@ -7163,17 +6686,14 @@ meta_call(F, As) ->
%% =====================================================================
-%% @spec tree(Type) -> syntaxTree()
%% @equiv tree(Type, [])
--spec tree(atom()) -> syntaxTree().
+-spec tree(atom()) -> #tree{}.
tree(Type) ->
tree(Type, []).
%% =====================================================================
-%% @spec tree(Type::atom(), Data::term()) -> syntaxTree()
-%%
%% @doc For special purposes only. Creates an abstract syntax
%% tree node with type tag Type
and associated data
%% Data
.
@@ -7202,15 +6722,13 @@ tree(Type) ->
%% @see data/1
%% @see type/1
--spec tree(atom(), term()) -> syntaxTree().
+-spec tree(atom(), term()) -> #tree{}.
tree(Type, Data) ->
#tree{type = Type, data = Data}.
%% =====================================================================
-%% @spec is_tree(Tree::syntaxTree()) -> boolean()
-%%
%% @doc For special purposes only. Returns true
if
%% Tree
is an abstract syntax tree and false
%% otherwise.
@@ -7229,8 +6747,6 @@ is_tree(_) ->
%% =====================================================================
-%% @spec data(Tree::syntaxTree()) -> term()
-%%
%% @doc For special purposes only. Returns the associated data
%% of a syntax tree node. Evaluation fails with reason
%% badarg
if is_tree(Node)
does not yield
@@ -7250,13 +6766,6 @@ data(T) -> erlang:error({badarg, T}).
%% =====================================================================
-%% @spec wrap(Node::erl_parse()) -> syntaxTree()
-%%
-%% @type erl_parse() = erl_parse:parse_tree(). The "parse tree"
-%% representation built by the Erlang standard library parser
-%% erl_parse
. This is a subset of the
-%% syntaxTree
type.
-%%
%% @doc Creates a wrapper structure around an erl_parse
%% "parse tree".
%%
@@ -7269,7 +6778,7 @@ data(T) -> erlang:error({badarg, T}).
%% trees. Attaching a wrapper onto another wrapper structure is an
%% error.Node
%% is a wrapper structure, this function returns the wrapped
%% erl_parse
tree; otherwise it returns Node
%% itself.
--spec unwrap(syntaxTree()) -> syntaxTree().
+-spec unwrap(syntaxTree()) -> #tree{} | erl_parse().
unwrap(#wrapper{tree = Node}) -> Node;
unwrap(Node) -> Node. % This could also be a new-form node.
%% =====================================================================
-%% @spec is_wrapper(Term::term()) -> boolean()
-%%
%% @doc Returns true
if the argument is a wrapper
%% structure, otherwise false
.
--
cgit v1.2.3
From 7dc58ca03d6c59dadfb6c570b97e05c08644041b Mon Sep 17 00:00:00 2001
From: Richard Carlsson erl_parse
(often referred to as "parse
+%% parser module `erl_parse' (often referred to as "parse
%% trees", which is a bit of a misnomer). This means that all
-%% erl_parse
trees are valid abstract syntax trees, but the
+%% `erl_parse' trees are valid abstract syntax trees, but the
%% reverse is not true: abstract syntax trees can in general not be used
-%% as input to functions expecting an erl_parse
tree.
+%% as input to functions expecting an `erl_parse' tree.
%% However, as long as an abstract syntax tree represents a correct
-%% Erlang program, the function revert/1
should be able to
-%% transform it to the corresponding erl_parse
+%% Erlang program, the function {@link revert/1} should be able to
+%% transform it to the corresponding `erl_parse'
%% representation.
%%
-%% A recommended starting point for the first-time user is the
-%% documentation of the syntaxTree()
data type, and
-%% the function type/1
.
+%% A recommended starting point for the first-time user is the documentation
+%% of the {@link syntaxTree()} data type, and the function {@link type/1}.
%%
-%% NOTES:
+%% == NOTES: ==
%%
%% This module deals with the composition and decomposition of
%% syntactic entities (as opposed to semantic ones); its
@@ -50,36 +47,31 @@
%% in general, the user is assumed to pass type-correct arguments - if
%% this is not done, the effects are not defined.
%%
-%% With the exception of the erl_parse
data structures,
+%% With the exception of the {@link erl_parse()} data structures,
%% the internal representations of abstract syntax trees are subject to
%% change without notice, and should not be documented outside this
%% module. Furthermore, we do not give any guarantees on how an abstract
%% syntax tree may or may not be represented, with the following
%% exceptions: no syntax tree is represented by a single atom, such
-%% as none
, by a list constructor [X | Y]
, or
-%% by the empty list []
. This can be relied on when writing
+%% as `none', by a list constructor `[X | Y]', or
+%% by the empty list `[]'. This can be relied on when writing
%% functions that operate on syntax trees.
-%% @type syntaxTree(). An abstract syntax tree. The
-%% erl_parse
"parse tree" representation is a subset of the
-%% syntaxTree()
representation.
+%% @type syntaxTree(). An abstract syntax tree. The {@link erl_parse()}
+%% "parse tree" representation is a proper subset of the `syntaxTree()'
+%% representation.
%%
%% Every abstract syntax tree node has a type, given by the
-%% function type/1
. Each node also
-%% has associated attributes; see get_attrs/1
for details. The
-%% functions make_tree/2
and subtrees/1
are generic
+%% function {@link type/1}. Each node also has associated
+%% attributes; see {@link get_attrs/1} for details. The functions
+%% {@link make_tree/2} and {@link subtrees/1} are generic
%% constructor/decomposition functions for abstract syntax trees. The
-%% functions abstract/1
and concrete/1
convert between
+%% functions {@link abstract/1} and {@link concrete/1} convert between
%% constant Erlang terms and their syntactic representations. The set of
-%% syntax tree nodes is extensible through the tree/2
function.
+%% syntax tree nodes is extensible through the {@link tree/2} function.
%%
-%% A syntax tree can be transformed to the erl_parse
-%% representation with the revert/1
-%% function.
+%% A syntax tree can be transformed to the {@link erl_parse()}
+%% representation with the {@link revert/1} function.
-module(erl_syntax).
@@ -396,8 +388,7 @@
-type erl_parse() :: erl_parse:abstract_form() | erl_parse:abstract_expr().
%% The representation built by the Erlang standard library parser
-%% `erl_parse'. This is a subset of the `syntaxTree' type.
+%% `erl_parse'. This is a subset of the {@link syntaxTree()} type.
%% =====================================================================
%%
@@ -407,10 +398,11 @@
%% =====================================================================
-%% @doc Returns the type tag of Node
. If Node
+%% @doc Returns the type tag of `Node'. If `Node'
%% does not represent a syntax tree, evaluation fails with reason
-%% badarg
. Node types currently defined by this module are:
-%%
+%% `badarg'. Node types currently defined by this module are:
+%%
+%%
%%
%%
-%% application
%% arity_qualifier
@@ -477,12 +469,13 @@
%% variable
%% warning_marker
%% tree/2
function.true
if Node
is a leaf node,
-%% otherwise false
. The currently recognised leaf node
+%% @doc Returns `true' if `Node' is a leaf node,
+%% otherwise `false'. The currently recognised leaf node
%% types are:
-%%
+%%
+%%
%%
-%%
-%% atom
-%% char
-%% comment
-%% eof_marker
+%% error_marker
`atom'
+%% `char'
+%% `comment'
+%% `eof_marker'
+%% `error_marker'
%%
-%%
-%% float
-%% integer
-%% nil
-%% operator
+%% string
`float'
+%% `integer'
+%% `nil'
+%% `operator'
+%% `string'
%%
-%%
-%%
-%% text
-%% underscore
-%% variable
+%% warning_marker
`text'
+%% `underscore'
+%% `variable'
+%% `warning_marker'
%% tuple
is a leaf node if and only if
-%% its arity is zero.true
if Node
is a syntax tree
+%% @doc Returns `true' if `Node' is a syntax tree
%% representing a so-called "source code form", otherwise
-%% false
. Forms are the Erlang source code units which,
+%% `false'. Forms are the Erlang source code units which,
%% placed in sequence, constitute an Erlang program. Current form types
%% are:
-%%
+%%
+%%
%%
-%%
-%% attribute
-%% comment
-%% error_marker
-%% eof_marker
+%% form_list
`attribute'
+%% `comment'
+%% `error_marker'
+%% `eof_marker'
+%% `form_list'
%%
-%%
-%%
-%% function
-%% rule
-%% warning_marker
+%% text
`function'
+%% `rule'
+%% `warning_marker'
+%% `text'
%% Node
. This is usually a nonnegative integer (indicating
+%% `Node'. This is usually a nonnegative integer (indicating
%% the source code line number), but may be any term. By default, all
%% new tree nodes have their associated position information set to the
%% integer zero.
@@ -745,8 +741,7 @@ get_pos(Node) ->
%% =====================================================================
-%% @doc Sets the position information of Node
to
-%% Pos
.
+%% @doc Sets the position information of `Node' to `Pos'.
%%
%% @see get_pos/1
%% @see copy_pos/2
@@ -767,11 +762,10 @@ set_pos(Node, Pos) ->
%% =====================================================================
-%% @doc Copies the position information from Source
to
-%% Target
.
+%% @doc Copies the position information from `Source' to `Target'.
%%
-%% set_pos(Target,
-%% get_pos(Source))
, but potentially more efficient.
-%% % Pre-comment of function
-%% foo(X) -> {bar, X}.
+%% ```% Pre-comment of function
+%% foo(X) -> {bar, X}.'''
%%
-%%
-%% foo([X | Xs]) ->
-%% % Pre-comment of 'bar(X)' node
-%% [bar(X) | foo(Xs)];
-%% ...
-%% (where the comment is moved before the "[
").Node
to
-%% Comments
. Comments
should be a possibly
+%% @doc Sets the pre-comments of `Node' to
+%% `Comments'. `Comments' should be a possibly
%% empty list of abstract comments, in top-down textual order.
%%
%% @see comment/2
@@ -865,12 +857,11 @@ set_precomments_1(#attr{com = Com} = Attr, Cs) ->
%% =====================================================================
-%% @doc Appends Comments
to the pre-comments of
-%% Node
.
+%% @doc Appends `Comments' to the pre-comments of `Node'.
%%
-%% set_precomments(Node,
-%% get_precomments(Node) ++ Comments)
, but potentially more
-%% efficient.
-%% {foo, X, Y} % Post-comment of tuple
+%% ```{foo, X, Y} % Post-comment of tuple'''
%%
-%%
-%% foo([X | Xs], Y) ->
-%% foo(Xs, bar(X)); % Post-comment of 'bar(X)' node
-%% ...
-%% (where the comment is moved past the rightmost ")
" and
-%% the ";
").
Node
to
-%% Comments
. Comments
should be a possibly
+%% @doc Sets the post-comments of `Node' to
+%% `Comments'. `Comments' should be a possibly
%% empty list of abstract comments, in top-down textual order
%%
%% @see comment/2
@@ -961,12 +950,11 @@ set_postcomments_1(#attr{com = Com} = Attr, Cs) ->
%% =====================================================================
-%% @doc Appends Comments
to the post-comments of
-%% Node
.
+%% @doc Appends `Comments' to the post-comments of `Node'.
%%
-%% Note: This is equivalent to set_postcomments(Node,
-%% get_postcomments(Node) ++ Comments)
, but potentially more
-%% efficient.
false
if the node has no associated
-%% comments, and true
otherwise.
+%% @doc Yields `false' if the node has no associated
+%% comments, and `true' otherwise.
%%
-%% Note: This is equivalent to (get_precomments(Node) == [])
-%% and (get_postcomments(Node) == [])
, but potentially more
-%% efficient.
Node
.
+%% @doc Clears the associated comments of `Node'.
%%
-%% Note: This is equivalent to
-%% set_precomments(set_postcomments(Node, []), [])
, but
-%% potentially more efficient.
Source
to
-%% Target
.
+%% @doc Copies the pre- and postcomments from `Source' to `Target'.
%%
-%% Note: This is equivalent to
-%% set_postcomments(set_precomments(Target,
-%% get_precomments(Source)), get_postcomments(Source))
, but
-%% potentially more efficient.
Source
to the current
-%% comments of Target
.
+%% @doc Appends the comments of `Source' to the current
+%% comments of `Target'.
%%
-%% Note: This is equivalent to
-%% add_postcomments(get_postcomments(Source),
-%% add_precomments(get_precomments(Source), Target))
, but
-%% potentially more efficient.
Node
to
-%% Annotations
.
+%% @doc Sets the list of user annotations of `Node' to `Annotations'.
%%
%% @see get_ann/1
%% @see add_ann/2
@@ -1127,11 +1113,11 @@ set_ann(Node, As) ->
%% =====================================================================
-%% @doc Appends the term Annotation
to the list of user
-%% annotations of Node
.
+%% @doc Appends the term `Annotation' to the list of user
+%% annotations of `Node'.
%%
-%% Note: this is equivalent to set_ann(Node, [Annotation |
-%% get_ann(Node)])
, but potentially more efficient.
Source
to
-%% Target
.
+%% @doc Copies the list of user annotations from `Source' to `Target'.
%%
-%% Note: this is equivalent to set_ann(Target,
-%% get_ann(Source))
, but potentially more efficient.
set_attrs/2
).
+%% another node (see {@link set_attrs/2}).
%%
-%% For accessing individual attributes, see get_pos/1
,
-%% get_ann/1
, get_precomments/1
and
-%% get_postcomments/1
.
get_attrs/1
.
-%%
+%% syntax tree node attributes; see the function {@link get_attrs/1}.
+%%
%% @see set_attrs/2
%% @see get_pos/1
%% @see get_ann/1
@@ -1199,8 +1183,7 @@ get_attrs(Node) -> #attr{pos = get_pos(Node),
%% =====================================================================
-%% @doc Sets the attributes of Node
to
-%% Attributes
.
+%% @doc Sets the attributes of `Node' to `Attributes'.
%%
%% @see get_attrs/1
%% @see copy_attrs/2
@@ -1219,11 +1202,10 @@ set_attrs(Node, Attr) ->
%% =====================================================================
-%% @doc Copies the attributes from Source
to
-%% Target
.
+%% @doc Copies the attributes from `Source' to `Target'.
%%
-%% Note: this is equivalent to set_attrs(Target,
-%% get_attrs(Source))
, but potentially more efficient.
Strings
is a (possibly empty) list
+%% `Strings' is a (possibly empty) list
%% ["Txt1", ..., "TxtN"]
, the result
%% represents the source code text
%% -%% %Txt1 -%% ... -%% %TxtN-%%
Padding
states the number of empty character positions
+%% %Txt1
+%% ...
+%% %TxtN
+%% `Padding' states the number of empty character positions
%% to the left of the comment separating it horizontally from
-%% source code on the same line (if any). If Padding
is
-%% none
, a default positive number is used. If
-%% Padding
is an integer less than 1, there should be no
+%% source code on the same line (if any). If `Padding' is
+%% `none', a default positive number is used. If
+%% `Padding' is an integer less than 1, there should be no
%% separating space. Comments are in themselves regarded as source
%% program forms.
%%
@@ -1292,8 +1274,7 @@ comment_text(Node) ->
%% =====================================================================
%% @doc Returns the amount of padding before the comment, or
-%% none
. The latter means that a default padding may be
-%% used.
+%% `none'. The latter means that a default padding may be used.
%%
%% @see comment/2
@@ -1305,20 +1286,20 @@ comment_padding(Node) ->
%% =====================================================================
%% @doc Creates an abstract sequence of "source code forms". If
-%% Forms
is [F1, ..., Fn]
, where each
-%% Fi
is a form (cf. is_form/1
, the result
+%% `Forms' is `[F1, ..., Fn]', where each
+%% `Fi' is a form (see {@link is_form/1}, the result
%% represents
%% -%% F1 -%% ... -%% Fn-%% where the
Fi
are separated by one or more line breaks. A
-%% node of type form_list
is itself regarded as a source
-%% code form; cf. flatten_form_list/1
.
-%%
-%% Note: this is simply a way of grouping source code forms as a +%% F1 +%% ... +%% Fn +%% where the `Fi' are separated by one or more line breaks. A +%% node of type `form_list' is itself regarded as a source +%% code form; see {@link flatten_form_list/1}. +%% +%% Note: this is simply a way of grouping source code forms as a %% single syntax tree, usually in order to form an Erlang module -%% definition.
+%% definition. %% %% @see form_list_elements/1 %% @see is_form/1 @@ -1337,7 +1318,7 @@ form_list(Forms) -> %% ===================================================================== -%% @doc Returns the list of subnodes of aform_list
node.
+%% @doc Returns the list of subnodes of a `form_list' node.
%%
%% @see form_list/1
@@ -1348,8 +1329,8 @@ form_list_elements(Node) ->
%% =====================================================================
-%% @doc Flattens sublists of a form_list
node. Returns
-%% Node
with all subtrees of type form_list
+%% @doc Flattens sublists of a `form_list' node. Returns
+%% `Node' with all subtrees of type `form_list'
%% recursively expanded, yielding a single "flat" abstract form
%% sequence.
%%
@@ -1376,7 +1357,7 @@ flatten_form_list_1([], As) ->
%% =====================================================================
%% @doc Creates an abstract piece of source code text. The result
-%% represents exactly the sequence of characters in String
.
+%% represents exactly the sequence of characters in `String'.
%% This is useful in cases when one wants full control of the resulting
%% output, e.g., for the appearance of floating-point numbers or macro
%% definitions.
@@ -1393,8 +1374,7 @@ text(String) ->
%% =====================================================================
-%% @doc Returns the character sequence represented by a
-%% text
node.
+%% @doc Returns the character sequence represented by a `text' node.
%%
%% @see text/1
@@ -1406,14 +1386,14 @@ text_string(Node) ->
%% =====================================================================
%% @doc Creates an abstract variable with the given name.
-%% Name
may be any atom or string that represents a
+%% `Name' may be any atom or string that represents a
%% lexically valid variable name, but not a single underscore
-%% character; cf. underscore/0
.
+%% character; see {@link underscore/0}.
%%
-%% Note: no checking is done whether the character sequence +%% Note: no checking is done whether the character sequence %% represents a proper variable name, i.e., whether or not its first %% character is an uppercase Erlang character, or whether it does not -%% contain control characters, whitespace, etc.
+%% contain control characters, whitespace, etc. %% %% @see variable_name/1 %% @see variable_literal/1 @@ -1442,7 +1422,7 @@ revert_variable(Node) -> %% ===================================================================== -%% @doc Returns the name of avariable
node as an atom.
+%% @doc Returns the name of a `variable' node as an atom.
%%
%% @see variable/1
@@ -1458,7 +1438,7 @@ variable_name(Node) ->
%% =====================================================================
-%% @doc Returns the name of a variable
node as a string.
+%% @doc Returns the name of a `variable' node as a string.
%%
%% @see variable/1
@@ -1474,7 +1454,7 @@ variable_literal(Node) ->
%% =====================================================================
-%% @doc Creates an abstract universal pattern ("_
"). The
+%% @doc Creates an abstract universal pattern ("`_'"). The
%% lexical representation is a single underscore character. Note that
%% this is not a variable, lexically speaking.
%%
@@ -1499,7 +1479,7 @@ revert_underscore(Node) ->
%% =====================================================================
%% @doc Creates an abstract integer literal. The lexical representation
-%% is the canonical decimal numeral of Value
.
+%% is the canonical decimal numeral of `Value'.
%%
%% @see integer_value/1
%% @see integer_literal/1
@@ -1525,9 +1505,8 @@ revert_integer(Node) ->
%% =====================================================================
-%% @doc Returns true
if Node
has type
-%% integer
and represents Value
, otherwise
-%% false
.
+%% @doc Returns `true' if `Node' has type
+%% `integer' and represents `Value', otherwise `false'.
%%
%% @see integer/1
@@ -1545,7 +1524,7 @@ is_integer(Node, Value) ->
%% =====================================================================
-%% @doc Returns the value represented by an integer
node.
+%% @doc Returns the value represented by an `integer' node.
%%
%% @see integer/1
@@ -1561,8 +1540,7 @@ integer_value(Node) ->
%% =====================================================================
-%% @doc Returns the numeral string represented by an
-%% integer
node.
+%% @doc Returns the numeral string represented by an `integer' node.
%%
%% @see integer/1
@@ -1574,8 +1552,7 @@ integer_literal(Node) ->
%% =====================================================================
%% @doc Creates an abstract floating-point literal. The lexical
-%% representation is the decimal floating-point numeral of
-%% Value
.
+%% representation is the decimal floating-point numeral of `Value'.
%%
%% @see float_value/1
%% @see float_literal/1
@@ -1610,7 +1587,7 @@ revert_float(Node) ->
%% =====================================================================
-%% @doc Returns the value represented by a float
node. Note
+%% @doc Returns the value represented by a `float' node. Note
%% that floating-point values should usually not be compared for
%% equality.
%%
@@ -1628,8 +1605,7 @@ float_value(Node) ->
%% =====================================================================
-%% @doc Returns the numeral string represented by a float
-%% node.
+%% @doc Returns the numeral string represented by a `float' node.
%%
%% @see float/1
@@ -1641,14 +1617,14 @@ float_literal(Node) ->
%% =====================================================================
%% @doc Creates an abstract character literal. The result represents
-%% "$Name
", where Name
corresponds to
-%% Value
.
+%% "$Name
", where `Name' corresponds to
+%% `Value'.
%%
-%% Note: the literal corresponding to a particular character value is
-%% not uniquely defined. E.g., the character "a
" can be
-%% written both as "$a
" and "$\141
", and a Tab
-%% character can be written as "$\11
", "$\011
"
-%% or "$\t
".
true
if Node
has type
-%% char
and represents Value
, otherwise
-%% false
.
+%% @doc Returns `true' if `Node' has type
+%% `char' and represents `Value', otherwise `false'.
%%
%% @see char/1
@@ -1694,7 +1669,7 @@ is_char(Node, Value) ->
%% =====================================================================
-%% @doc Returns the value represented by a char
node.
+%% @doc Returns the value represented by a `char' node.
%%
%% @see char/1
@@ -1710,8 +1685,8 @@ char_value(Node) ->
%% =====================================================================
-%% @doc Returns the literal string represented by a char
-%% node. This includes the leading "$
" character.
+%% @doc Returns the literal string represented by a `char'
+%% node. This includes the leading "`$'" character.
%%
%% @see char/1
@@ -1724,12 +1699,12 @@ char_literal(Node) ->
%% =====================================================================
%% @doc Creates an abstract string literal. The result represents
%% "Text"
(including the surrounding
-%% double-quotes), where Text
corresponds to the sequence
-%% of characters in Value
, but not representing a
-%% specific string literal. E.g., the result of
-%% string("x\ny")
represents any and all of
-%% "x\ny"
, "x\12y"
, "x\012y"
and
-%% "x\^Jy"
; cf. char/1
.
+%% double-quotes), where `Text' corresponds to the sequence
+%% of characters in `Value', but not representing a
+%% specific string literal.
+%%
+%% For example, the result of `string("x\ny")' represents any and all of
+%% `"x\ny"', `"x\12y"', `"x\012y"' and `"x\^Jy"'; see {@link char/1}.
%%
%% @see string_value/1
%% @see string_literal/1
@@ -1756,9 +1731,8 @@ revert_string(Node) ->
%% =====================================================================
-%% @doc Returns true
if Node
has type
-%% string
and represents Value
, otherwise
-%% false
.
+%% @doc Returns `true' if `Node' has type
+%% `string' and represents `Value', otherwise `false'.
%%
%% @see string/1
@@ -1776,7 +1750,7 @@ is_string(Node, Value) ->
%% =====================================================================
-%% @doc Returns the value represented by a string
node.
+%% @doc Returns the value represented by a `string' node.
%%
%% @see string/1
@@ -1792,7 +1766,7 @@ string_value(Node) ->
%% =====================================================================
-%% @doc Returns the literal string represented by a string
+%% @doc Returns the literal string represented by a `string'
%% node. This includes surrounding double-quote characters.
%%
%% @see string/1
@@ -1805,7 +1779,7 @@ string_literal(Node) ->
%% =====================================================================
%% @doc Creates an abstract atom literal. The print name of the atom is
-%% the character sequence represented by Name
.
+%% the character sequence represented by `Name'.
%%
%% @see atom_value/1
%% @see atom_name/1
@@ -1834,9 +1808,8 @@ revert_atom(Node) ->
%% =====================================================================
-%% @doc Returns true
if Node
has type
-%% atom
and represents Value
, otherwise
-%% false
.
+%% @doc Returns `true' if `Node' has type
+%% `atom' and represents `Value', otherwise `false'.
%%
%% @see atom/1
@@ -1854,7 +1827,7 @@ is_atom(Node, Value) ->
%% =====================================================================
-%% @doc Returns the value represented by an atom
node.
+%% @doc Returns the value represented by an `atom' node.
%%
%% @see atom/1
@@ -1870,7 +1843,7 @@ atom_value(Node) ->
%% =====================================================================
-%% @doc Returns the printname of an atom
node.
+%% @doc Returns the printname of an `atom' node.
%%
%% @see atom/1
@@ -1881,13 +1854,12 @@ atom_name(Node) ->
%% =====================================================================
-%% @doc Returns the literal string represented by an atom
+%% @doc Returns the literal string represented by an `atom'
%% node. This includes surrounding single-quote characters if necessary.
%%
-%% Note that e.g. the result of atom("x\ny")
represents
-%% any and all of 'x\ny'
, 'x\12y'
,
-%% 'x\012y'
and 'x\^Jy\'
; cf.
-%% string/1
.
Elements
is
-%% [X1, ..., Xn]
, the result represents
+%% @doc Creates an abstract tuple. If `Elements' is
+%% `[X1, ..., Xn]', the result represents
%% "{X1, ..., Xn}
".
%%
-%% Note: The Erlang language has distinct 1-tuples, i.e.,
-%% {X}
is always distinct from X
itself.
tuple
-%% node.
+%% @doc Returns the list of element subtrees of a `tuple' node.
%%
%% @see tuple/1
@@ -1948,11 +1919,11 @@ tuple_elements(Node) ->
%% =====================================================================
-%% @doc Returns the number of elements of a tuple
node.
+%% @doc Returns the number of elements of a `tuple' node.
%%
-%% Note: this is equivalent to
-%% length(tuple_elements(Node))
, but potentially more
-%% efficient.
list
or nil
. If List
is a
-%% nonempty list [E1, ..., En]
, the result has type
-%% list
and represents either "[E1, ...,
-%% En]
", if Tail
is none
, or
+%% `list' or `nil'. If `List' is a
+%% nonempty list `[E1, ..., En]', the result has type
+%% `list' and represents either "[E1, ...,
+%% En]
", if `Tail' is `none', or
%% otherwise "[E1, ..., En |
-%% Tail]
". If List
is the empty list,
-%% Tail
must be none
, and in that
-%% case the result has type nil
and represents
-%% "[]
" (cf. nil/0
).
+%% Tail]". If `List' is the empty list,
+%% `Tail' must be `none', and in that
+%% case the result has type `nil' and represents
+%% "`[]'" (see {@link nil/0}).
%%
-%% The difference between lists as semantic objects (built up of +%% The difference between lists as semantic objects (built up of %% individual "cons" and "nil" terms) and the various syntactic forms %% for denoting lists may be bewildering at first. This module provides %% functions both for exact control of the syntactic representation as %% well as for the simple composition and deconstruction in terms of -%% cons and head/tail operations.
+%% cons and head/tail operations. %% -%%Note: in list(Elements, none)
, the "nil" list
-%% terminator is implicit and has no associated information (cf.
-%% get_attrs/1
), while in the seemingly equivalent
-%% list(Elements, Tail)
when Tail
has type
-%% nil
, the list terminator subtree Tail
may
+%% Note: in `list(Elements, none)', the "nil" list
+%% terminator is implicit and has no associated information (see
+%% {@link get_attrs/1}), while in the seemingly equivalent
+%% `list(Elements, Tail)' when `Tail' has type
+%% `nil', the list terminator subtree `Tail' may
%% have attached attributes such as position, comments, and annotations,
-%% which will be preserved in the result.
[]
". The empty list is traditionally called "nil".
+%% "`[]'". The empty list is traditionally called "nil".
%%
%% @see list/2
%% @see is_list_skeleton/1
@@ -2078,11 +2049,11 @@ revert_nil(Node) ->
%% =====================================================================
-%% @doc Returns the prefix element subtrees of a list
node.
-%% If Node
represents "[E1, ...,
+%% @doc Returns the prefix element subtrees of a `list' node.
+%% If `Node' represents "[E1, ...,
%% En]
" or "[E1, ..., En |
-%% Tail]
", the returned value is [E1, ...,
-%% En]
.
+%% Tail]
", the returned value is `[E1, ...,
+%% En]'.
%%
%% @see list/2
@@ -2098,18 +2069,17 @@ list_prefix(Node) ->
%% =====================================================================
-%% @doc Returns the suffix subtree of a list
node, if one
-%% exists. If Node
represents "[E1, ...,
+%% @doc Returns the suffix subtree of a `list' node, if one
+%% exists. If `Node' represents "[E1, ...,
%% En | Tail]
", the returned value is
-%% Tail
, otherwise, i.e., if Node
represents
-%% "[E1, ..., En]
", none
is
+%% `Tail', otherwise, i.e., if `Node' represents
+%% "[E1, ..., En]
", `none' is
%% returned.
%%
-%% Note that even if this function returns some Tail
-%% that is not none
, the type of Tail
can be
-%% nil
, if the tail has been given explicitly, and the list
-%% skeleton has not been compacted (cf.
-%% compact_list/1
).
+%% Note that even if this function returns some `Tail'
+%% that is not `none', the type of `Tail' can be
+%% `nil', if the tail has been given explicitly, and the list
+%% skeleton has not been compacted (see {@link compact_list/1}).
%%
%% @see list/2
%% @see nil/0
@@ -2135,17 +2105,17 @@ list_suffix(Node) ->
%% =====================================================================
%% @doc "Optimising" list skeleton cons operation. Creates an abstract
-%% list skeleton whose first element is Head
and whose tail
-%% corresponds to Tail
. This is similar to
-%% list([Head], Tail)
, except that Tail
may
-%% not be none
, and that the result does not necessarily
+%% list skeleton whose first element is `Head' and whose tail
+%% corresponds to `Tail'. This is similar to
+%% `list([Head], Tail)', except that `Tail' may
+%% not be `none', and that the result does not necessarily
%% represent exactly "[Head | Tail]
", but
-%% may depend on the Tail
subtree. E.g., if
-%% Tail
represents [X, Y]
, the result may
+%% may depend on the `Tail' subtree. E.g., if
+%% `Tail' represents `[X, Y]', the result may
%% represent "[Head, X, Y]
", rather than
%% "[Head | [X, Y]]
". Annotations on
-%% Tail
itself may be lost if Tail
represents
-%% a list skeleton, but comments on Tail
are propagated to
+%% `Tail' itself may be lost if `Tail' represents
+%% a list skeleton, but comments on `Tail' are propagated to
%% the result.
%%
%% @see list/2
@@ -2167,8 +2137,8 @@ cons(Head, Tail) ->
%% =====================================================================
-%% @doc Returns the head element subtree of a list
node. If
-%% Node
represents "[Head ...]
", the
+%% @doc Returns the head element subtree of a `list' node. If
+%% `Node' represents "[Head ...]
", the
%% result will represent "Head
".
%%
%% @see list/2
@@ -2182,13 +2152,13 @@ list_head(Node) ->
%% =====================================================================
-%% @doc Returns the tail of a list
node. If
-%% Node
represents a single-element list
+%% @doc Returns the tail of a `list' node. If
+%% `Node' represents a single-element list
%% "[E]
", then the result has type
-%% nil
, representing "[]
". If
-%% Node
represents "[E1, E2
+%% `nil', representing "`[]'". If
+%% `Node' represents "[E1, E2
%% ...]
", the result will represent "[E2
-%% ...]
", and if Node
represents
+%% ...]
", and if `Node' represents
%% "[Head | Tail]
", the result will
%% represent "Tail
".
%%
@@ -2213,8 +2183,8 @@ list_tail(Node) ->
%% =====================================================================
-%% @doc Returns true
if Node
has type
-%% list
or nil
, otherwise false
.
+%% @doc Returns `true' if `Node' has type
+%% `list' or `nil', otherwise `false'.
%%
%% @see list/2
%% @see nil/0
@@ -2230,22 +2200,22 @@ is_list_skeleton(Node) ->
%% =====================================================================
-%% @doc Returns true
if Node
represents a
-%% proper list, and false
otherwise. A proper list is a
-%% list skeleton either on the form "[]
" or
+%% @doc Returns `true' if `Node' represents a
+%% proper list, and `false' otherwise. A proper list is a
+%% list skeleton either on the form "`[]'" or
%% "[E1, ..., En]
", or "[... |
-%% Tail]
" where recursively Tail
also
+%% Tail]
" where recursively `Tail' also
%% represents a proper list.
%%
-%% Note: Since Node
is a syntax tree, the actual
+%% Note: Since `Node' is a syntax tree, the actual
%% run-time values corresponding to its subtrees may often be partially
-%% or completely unknown. Thus, if Node
represents e.g.
-%% "[... | Ns]
" (where Ns
is a variable), then
-%% the function will return false
, because it is not known
-%% whether Ns
will be bound to a list at run-time. If
-%% Node
instead represents e.g. "[1, 2, 3]
" or
-%% "[A | []]
", then the function will return
-%% true
.
Node
must represent a proper list. E.g., if
-%% Node
represents "[X1, X2 |
+%% `Node' must represent a proper list. E.g., if
+%% `Node' represents "[X1, X2 |
%% [X3, X4 | []]
", then
-%% list_elements(Node)
yields the list [X1, X2, X3,
-%% X4]
.
+%% `list_elements(Node)' yields the list `[X1, X2, X3, X4]'.
%%
%% @see list/2
%% @see is_proper_list/1
@@ -2300,14 +2269,14 @@ list_elements(Node, As) ->
%% =====================================================================
%% @doc Returns the number of element subtrees of a list skeleton.
-%% Node
must represent a proper list. E.g., if
-%% Node
represents "[X1 | [X2, X3 | [X4, X5,
-%% X6]]]
", then list_length(Node)
returns the
+%% `Node' must represent a proper list. E.g., if
+%% `Node' represents "`[X1 | [X2, X3 | [X4, X5,
+%% X6]]]'", then `list_length(Node)' returns the
%% integer 6.
%%
-%% Note: this is equivalent to
-%% length(list_elements(Node))
, but potentially more
-%% efficient.
+%% Note: this is equivalent to
+%% `length(list_elements(Node))', but potentially more
+%% efficient.
%%
%% @see list/2
%% @see is_proper_list/1
@@ -2335,15 +2304,15 @@ list_length(Node, A) ->
%% =====================================================================
%% @doc Expands an abstract list skeleton to its most explicit form. If
-%% Node
represents "[E1, ..., En |
+%% `Node' represents "[E1, ..., En |
%% Tail]
", the result represents "[E1 |
%% ... [En | Tail1] ... ]
", where
-%% Tail1
is the result of
-%% normalize_list(Tail)
. If Node
represents
+%% `Tail1' is the result of
+%% `normalize_list(Tail)'. If `Node' represents
%% "[E1, ..., En]
", the result simply
%% represents "[E1 | ... [En | []] ...
-%% ]
". If Node
does not represent a list skeleton,
-%% Node
itself is returned.
+%% ]
". If `Node' does not represent a list skeleton,
+%% `Node' itself is returned.
%%
%% @see list/2
%% @see compact_list/1
@@ -2375,12 +2344,12 @@ normalize_list_1(Es, Tail) ->
%% =====================================================================
%% @doc Yields the most compact form for an abstract list skeleton. The
%% result either represents "[E1, ..., En |
-%% Tail]
", where Tail
is not a list
+%% Tail]
", where `Tail' is not a list
%% skeleton, or otherwise simply "[E1, ...,
-%% En]
". Annotations on subtrees of Node
+%% En]". Annotations on subtrees of `Node'
%% that represent list skeletons may be lost, but comments will be
-%% propagated to the result. Returns Node
itself if
-%% Node
does not represent a list skeleton.
+%% propagated to the result. Returns `Node' itself if
+%% `Node' does not represent a list skeleton.
%%
%% @see list/2
%% @see normalize_list/1
@@ -2419,7 +2388,7 @@ compact_list(Node) ->
%% =====================================================================
%% @doc Creates an abstract binary-object template. If
-%% Fields
is [F1, ..., Fn]
, the result
+%% `Fields' is `[F1, ..., Fn]', the result
%% represents "<<F1, ...,
%% Fn>>
".
%%
@@ -2452,8 +2421,7 @@ revert_binary(Node) ->
%% =====================================================================
-%% @doc Returns the list of field subtrees of a binary
-%% node.
+%% @doc Returns the list of field subtrees of a `binary' node.
%%
%% @see binary/1
%% @see binary_field/2
@@ -2480,10 +2448,10 @@ binary_field(Body) ->
%% =====================================================================
%% @doc Creates an abstract binary template field.
-%% If Size
is none
, this is equivalent to
-%% "binary_field(Body, Types)
", otherwise it is
-%% equivalent to "binary_field(size_qualifier(Body, Size),
-%% Types)
".
+%% If `Size' is `none', this is equivalent to
+%% "`binary_field(Body, Types)'", otherwise it is
+%% equivalent to "`binary_field(size_qualifier(Body, Size),
+%% Types)'".
%%
%% (This is a utility function.)
%%
@@ -2502,9 +2470,9 @@ binary_field(Body, Size, Types) ->
%% =====================================================================
%% @doc Creates an abstract binary template field. If
-%% Types
is the empty list, the result simply represents
-%% "Body
", otherwise, if Types
is
-%% [T1, ..., Tn]
, the result represents
+%% `Types' is the empty list, the result simply represents
+%% "Body
", otherwise, if `Types' is
+%% `[T1, ..., Tn]', the result represents
%% "Body/T1-...-Tn
".
%%
%% @see binary/1
@@ -2558,7 +2526,7 @@ revert_binary_field(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a binary_field
.
+%% @doc Returns the body subtree of a `binary_field'.
%%
%% @see binary_field/2
@@ -2579,9 +2547,9 @@ binary_field_body(Node) ->
%% =====================================================================
%% @doc Returns the list of type-specifier subtrees of a
-%% binary_field
node. If Node
represents
+%% `binary_field' node. If `Node' represents
%% ".../T1, ..., Tn
", the result is
-%% [T1, ..., Tn]
, otherwise the result is the empty list.
+%% `[T1, ..., Tn]', otherwise the result is the empty list.
%%
%% @see binary_field/2
@@ -2602,11 +2570,11 @@ binary_field_types(Node) ->
%% =====================================================================
%% @doc Returns the size specifier subtree of a
-%% binary_field
node, if any. If Node
+%% `binary_field' node, if any. If `Node'
%% represents "Body:Size
" or
%% "Body:Size/T1, ...,
-%% Tn
", the result is Size
, otherwise
-%% none
is returned.
+%% Tn", the result is `Size', otherwise
+%% `none' is returned.
%%
%% (This is a utility function.)
%%
@@ -2656,8 +2624,7 @@ size_qualifier(Body, Size) ->
%% =====================================================================
-%% @doc Returns the body subtree of a size_qualifier
-%% node.
+%% @doc Returns the body subtree of a `size_qualifier' node.
%%
%% @see size_qualifier/2
@@ -2669,7 +2636,7 @@ size_qualifier_body(Node) ->
%% =====================================================================
%% @doc Returns the argument subtree (the size) of a
-%% size_qualifier
node.
+%% `size_qualifier' node.
%%
%% @see size_qualifier/2
@@ -2682,12 +2649,12 @@ size_qualifier_argument(Node) ->
%% =====================================================================
%% @doc Creates an abstract error marker. The result represents an
%% occurrence of an error in the source code, with an associated Erlang
-%% I/O ErrorInfo structure given by Error
(see module
+%% I/O ErrorInfo structure given by `Error' (see module
%% {@link //stdlib/io} for details). Error markers are regarded as source
%% code forms, but have no defined lexical form.
%%
-%% Note: this is supported only for backwards compatibility with -%% existing parsers and tools.
+%% Note: this is supported only for backwards compatibility with +%% existing parsers and tools. %% %% @see error_marker_info/1 %% @see warning_marker/1 @@ -2718,8 +2685,7 @@ revert_error_marker(Node) -> %% ===================================================================== -%% @doc Returns the ErrorInfo structure of anerror_marker
-%% node.
+%% @doc Returns the ErrorInfo structure of an `error_marker' node.
%%
%% @see error_marker/1
@@ -2737,12 +2703,12 @@ error_marker_info(Node) ->
%% =====================================================================
%% @doc Creates an abstract warning marker. The result represents an
%% occurrence of a possible problem in the source code, with an
-%% associated Erlang I/O ErrorInfo structure given by Error
+%% associated Erlang I/O ErrorInfo structure given by `Error'
%% (see module {@link //stdlib/io} for details). Warning markers are
%% regarded as source code forms, but have no defined lexical form.
%%
-%% Note: this is supported only for backwards compatibility with -%% existing parsers and tools.
+%% Note: this is supported only for backwards compatibility with +%% existing parsers and tools. %% %% @see warning_marker_info/1 %% @see error_marker/1 @@ -2773,8 +2739,7 @@ revert_warning_marker(Node) -> %% ===================================================================== -%% @doc Returns the ErrorInfo structure of awarning_marker
-%% node.
+%% @doc Returns the ErrorInfo structure of a `warning_marker' node.
%%
%% @see warning_marker/1
@@ -2796,8 +2761,8 @@ warning_marker_info(Node) ->
%% (namely, the last in any sequence in which it occurs). It has no
%% defined lexical form.
%%
-%% Note: this is retained only for backwards compatibility with -%% existing parsers and tools.
+%% Note: this is retained only for backwards compatibility with +%% existing parsers and tools. %% %% @see error_marker/1 %% @see warning_marker/1 @@ -2831,19 +2796,19 @@ attribute(Name) -> %% ===================================================================== %% @doc Creates an abstract program attribute. If -%%Arguments
is [A1, ..., An]
, the result
+%% `Arguments' is `[A1, ..., An]', the result
%% represents "-Name(A1, ...,
-%% An).
". Otherwise, if Arguments
is
-%% none
, the result represents
+%% An).". Otherwise, if `Arguments' is
+%% `none', the result represents
%% "-Name.
". The latter form makes it possible
%% to represent preprocessor directives such as
-%% "-endif.
". Attributes are source code forms.
+%% "`-endif.'". Attributes are source code forms.
%%
-%% Note: The preprocessor macro definition directive
+%% Note: The preprocessor macro definition directive
%% "-define(Name, Body).
" has relatively
-%% few requirements on the syntactical form of Body
(viewed
-%% as a sequence of tokens). The text
node type can be used
-%% for a Body
that is not a normal Erlang construct.
attribute
node.
+%% @doc Returns the name subtree of an `attribute' node.
%%
%% @see attribute/1
@@ -3054,11 +3019,11 @@ attribute_name(Node) ->
%% =====================================================================
%% @doc Returns the list of argument subtrees of an
-%% attribute
node, if any. If Node
+%% `attribute' node, if any. If `Node'
%% represents "-Name.
", the result is
-%% none
. Otherwise, if Node
represents
+%% `none'. Otherwise, if `Node' represents
%% "-Name(E1, ..., En).
",
-%% [E1, ..., E1]
is returned.
+%% `[E1, ..., E1]' is returned.
%%
%% @see attribute/1
@@ -3146,8 +3111,7 @@ arity_qualifier(Body, Arity) ->
%% =====================================================================
-%% @doc Returns the body subtree of an arity_qualifier
-%% node.
+%% @doc Returns the body subtree of an `arity_qualifier' node.
%%
%% @see arity_qualifier/2
@@ -3159,7 +3123,7 @@ arity_qualifier_body(Node) ->
%% =====================================================================
%% @doc Returns the argument (the arity) subtree of an
-%% arity_qualifier
node.
+%% `arity_qualifier' node.
%%
%% @see arity_qualifier/2
@@ -3204,7 +3168,7 @@ revert_module_qualifier(Node) ->
%% =====================================================================
%% @doc Returns the argument (the module) subtree of a
-%% module_qualifier
node.
+%% `module_qualifier' node.
%%
%% @see module_qualifier/2
@@ -3220,8 +3184,7 @@ module_qualifier_argument(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a module_qualifier
-%% node.
+%% @doc Returns the body subtree of a `module_qualifier' node.
%%
%% @see module_qualifier/2
@@ -3239,7 +3202,7 @@ module_qualifier_body(Node) ->
%% =====================================================================
%% @doc Creates an abstract qualified name. The result represents
%% "S1.S2. ... .Sn
", if
-%% Segments
is [S1, S2, ..., Sn]
.
+%% `Segments' is `[S1, S2, ..., Sn]'.
%%
%% @see qualified_name_segments/1
@@ -3268,7 +3231,7 @@ revert_qualified_name(Node) ->
%% =====================================================================
%% @doc Returns the list of name segments of a
-%% qualified_name
node.
+%% `qualified_name' node.
%%
%% @see qualified_name/1
@@ -3284,10 +3247,10 @@ qualified_name_segments(Node) ->
%% =====================================================================
-%% @doc Creates an abstract function definition. If Clauses
-%% is [C1, ..., Cn]
, the result represents
+%% @doc Creates an abstract function definition. If `Clauses'
+%% is `[C1, ..., Cn]', the result represents
%% "Name C1; ...; Name
-%% Cn.
". More exactly, if each Ci
+%% Cn.". More exactly, if each `Ci'
%% represents "(Pi1, ..., Pim) Gi ->
%% Bi
", then the result represents
%% "Name(P11, ..., P1m) G1 ->
@@ -3349,7 +3312,7 @@ revert_function(Node) ->
%% =====================================================================
-%% @doc Returns the name subtree of a function
node.
+%% @doc Returns the name subtree of a `function' node.
%%
%% @see function/2
@@ -3365,8 +3328,7 @@ function_name(Node) ->
%% =====================================================================
-%% @doc Returns the list of clause subtrees of a function
-%% node.
+%% @doc Returns the list of clause subtrees of a `function' node.
%%
%% @see function/2
@@ -3382,14 +3344,14 @@ function_clauses(Node) ->
%% =====================================================================
-%% @doc Returns the arity of a function
node. The result
+%% @doc Returns the arity of a `function' node. The result
%% is the number of parameter patterns in the first clause of the
%% function; subsequent clauses are ignored.
%%
-%% An exception is thrown if function_clauses(Node)
+%% An exception is thrown if `function_clauses(Node)'
%% returns an empty list, or if the first element of that list is not
-%% a syntax tree C
of type clause
such that
-%% clause_patterns(C)
is a nonempty list.
+%% a syntax tree `C' of type `clause' such that
+%% `clause_patterns(C)' is a nonempty list.
%%
%% @see function/2
%% @see function_clauses/1
@@ -3416,29 +3378,28 @@ clause(Guard, Body) ->
%% =====================================================================
-%% @doc Creates an abstract clause. If Patterns
is
-%% [P1, ..., Pn]
and Body
is [B1, ...,
-%% Bm]
, then if Guard
is none
, the
+%% @doc Creates an abstract clause. If `Patterns' is
+%% `[P1, ..., Pn]' and `Body' is `[B1, ...,
+%% Bm]', then if `Guard' is `none', the
%% result represents "(P1, ..., Pn) ->
%% B1, ..., Bm
", otherwise, unless
-%% Guard
is a list, the result represents
+%% `Guard' is a list, the result represents
%% "(P1, ..., Pn) when Guard ->
%% B1, ..., Bm
".
%%
-%% For simplicity, the Guard
argument may also be any
+%% For simplicity, the `Guard' argument may also be any
%% of the following:
%%
-%% - An empty list
[]
. This is equivalent to passing
-%% none
.
-%% - A nonempty list
[E1, ..., Ej]
of syntax trees.
-%% This is equivalent to passing conjunction([E1, ...,
-%% Ej])
.
-%% - A nonempty list of lists of syntax trees
[[E1_1, ...,
-%% E1_k1], ..., [Ej_1, ..., Ej_kj]]
, which is equivalent
-%% to passing disjunction([conjunction([E1_1, ...,
-%% E1_k1]), ..., conjunction([Ej_1, ..., Ej_kj])])
.
+%% - An empty list `[]'. This is equivalent to passing
+%% `none'.
+%% - A nonempty list `[E1, ..., Ej]' of syntax trees.
+%% This is equivalent to passing `conjunction([E1, ...,
+%% Ej])'.
+%% - A nonempty list of lists of syntax trees `[[E1_1, ...,
+%% E1_k1], ..., [Ej_1, ..., Ej_kj]]', which is equivalent
+%% to passing `disjunction([conjunction([E1_1, ...,
+%% E1_k1]), ..., conjunction([Ej_1, ..., Ej_kj])])'.
%%
-%%
%%
%% @see clause/2
%% @see clause_patterns/1
@@ -3554,8 +3515,7 @@ unfold_try_clause({clause, Pos, [{tuple, _, [C, V, _]}],
%% =====================================================================
-%% @doc Returns the list of pattern subtrees of a clause
-%% node.
+%% @doc Returns the list of pattern subtrees of a `clause' node.
%%
%% @see clause/3
@@ -3571,11 +3531,11 @@ clause_patterns(Node) ->
%% =====================================================================
-%% @doc Returns the guard subtree of a clause
node, if
-%% any. If Node
represents "(P1, ...,
+%% @doc Returns the guard subtree of a `clause' node, if
+%% any. If `Node' represents "(P1, ...,
%% Pn) when Guard -> B1, ...,
-%% Bm
", Guard
is returned. Otherwise, the
-%% result is none
.
+%% Bm
", `Guard' is returned. Otherwise, the
+%% result is `none'.
%%
%% @see clause/3
@@ -3597,8 +3557,7 @@ clause_guard(Node) ->
%% =====================================================================
-%% @doc Return the list of body subtrees of a clause
-%% node.
+%% @doc Return the list of body subtrees of a `clause' node.
%%
%% @see clause/3
@@ -3614,8 +3573,8 @@ clause_body(Node) ->
%% =====================================================================
-%% @doc Creates an abstract disjunction. If List
is
-%% [E1, ..., En]
, the result represents
+%% @doc Creates an abstract disjunction. If `List' is
+%% `[E1, ..., En]', the result represents
%% "E1; ...; En
".
%%
%% @see disjunction_body/1
@@ -3632,7 +3591,7 @@ disjunction(Tests) ->
%% =====================================================================
%% @doc Returns the list of body subtrees of a
-%% disjunction
node.
+%% `disjunction' node.
%%
%% @see disjunction/1
@@ -3643,8 +3602,8 @@ disjunction_body(Node) ->
%% =====================================================================
-%% @doc Creates an abstract conjunction. If List
is
-%% [E1, ..., En]
, the result represents
+%% @doc Creates an abstract conjunction. If `List' is
+%% `[E1, ..., En]', the result represents
%% "E1, ..., En
".
%%
%% @see conjunction_body/1
@@ -3661,7 +3620,7 @@ conjunction(Tests) ->
%% =====================================================================
%% @doc Returns the list of body subtrees of a
-%% conjunction
node.
+%% `conjunction' node.
%%
%% @see conjunction/1
@@ -3698,7 +3657,7 @@ revert_catch_expr(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a catch_expr
node.
+%% @doc Returns the body subtree of a `catch_expr' node.
%%
%% @see catch_expr/1
@@ -3746,7 +3705,7 @@ revert_match_expr(Node) ->
%% =====================================================================
-%% @doc Returns the pattern subtree of a match_expr
node.
+%% @doc Returns the pattern subtree of a `match_expr' node.
%%
%% @see match_expr/2
@@ -3762,7 +3721,7 @@ match_expr_pattern(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a match_expr
node.
+%% @doc Returns the body subtree of a `match_expr' node.
%%
%% @see match_expr/2
@@ -3779,11 +3738,11 @@ match_expr_body(Node) ->
%% =====================================================================
%% @doc Creates an abstract operator. The name of the operator is the
-%% character sequence represented by Name
. This is
+%% character sequence represented by `Name'. This is
%% analogous to the print name of an atom, but an operator is never
%% written within single-quotes; e.g., the result of
-%% operator('++')
represents "++
" rather
-%% than "'++'
".
+%% `operator('++')' represents "`++'" rather
+%% than "`'++''".
%%
%% @see operator_name/1
%% @see operator_literal/1
@@ -3801,7 +3760,7 @@ operator(Name) ->
%% =====================================================================
-%% @doc Returns the name of an operator
node. Note that
+%% @doc Returns the name of an `operator' node. Note that
%% the name is returned as an atom.
%%
%% @see operator/1
@@ -3814,8 +3773,7 @@ operator_name(Node) ->
%% =====================================================================
%% @doc Returns the literal string represented by an
-%% operator
node. This is simply the operator name as a
-%% string.
+%% `operator' node. This is simply the operator name as a string.
%%
%% @see operator/1
@@ -3875,7 +3833,7 @@ revert_infix_expr(Node) ->
%% =====================================================================
%% @doc Returns the left argument subtree of an
-%% infix_expr
node.
+%% `infix_expr' node.
%%
%% @see infix_expr/3
@@ -3891,8 +3849,7 @@ infix_expr_left(Node) ->
%% =====================================================================
-%% @doc Returns the operator subtree of an infix_expr
-%% node.
+%% @doc Returns the operator subtree of an `infix_expr' node.
%%
%% @see infix_expr/3
@@ -3909,7 +3866,7 @@ infix_expr_operator(Node) ->
%% =====================================================================
%% @doc Returns the right argument subtree of an
-%% infix_expr
node.
+%% `infix_expr' node.
%%
%% @see infix_expr/3
@@ -3968,8 +3925,7 @@ revert_prefix_expr(Node) ->
%% =====================================================================
-%% @doc Returns the operator subtree of a prefix_expr
-%% node.
+%% @doc Returns the operator subtree of a `prefix_expr' node.
%%
%% @see prefix_expr/2
@@ -3985,8 +3941,7 @@ prefix_expr_operator(Node) ->
%% =====================================================================
-%% @doc Returns the argument subtree of a prefix_expr
-%% node.
+%% @doc Returns the argument subtree of a `prefix_expr' node.
%%
%% @see prefix_expr/2
@@ -4012,7 +3967,7 @@ record_field(Name) ->
%% =====================================================================
%% @doc Creates an abstract record field specification. If
-%% Value
is none
, the result represents
+%% `Value' is `none', the result represents
%% simply "Name
", otherwise it represents
%% "Name = Value
".
%%
@@ -4034,7 +3989,7 @@ record_field(Name, Value) ->
%% =====================================================================
-%% @doc Returns the name subtree of a record_field
node.
+%% @doc Returns the name subtree of a `record_field' node.
%%
%% @see record_field/2
@@ -4045,11 +4000,11 @@ record_field_name(Node) ->
%% =====================================================================
-%% @doc Returns the value subtree of a record_field
node,
-%% if any. If Node
represents
-%% "Name
", none
is
-%% returned. Otherwise, if Node
represents
-%% "Name = Value
", Value
+%% @doc Returns the value subtree of a `record_field' node,
+%% if any. If `Node' represents
+%% "Name
", `none' is
+%% returned. Otherwise, if `Node' represents
+%% "Name = Value
", `Value'
%% is returned.
%%
%% @see record_field/2
@@ -4064,9 +4019,9 @@ record_field_value(Node) ->
%% @doc Creates an abstract record field index expression. The result
%% represents "#Type.Field
".
%%
-%% (Note: the function name record_index/2
is reserved
+%% (Note: the function name `record_index/2' is reserved
%% by the Erlang compiler, which is why that name could not be used
-%% for this constructor.)
+%% for this constructor.)
%%
%% @see record_index_expr_type/1
%% @see record_index_expr_field/1
@@ -4105,8 +4060,7 @@ revert_record_index_expr(Node) ->
%% =====================================================================
-%% @doc Returns the type subtree of a record_index_expr
-%% node.
+%% @doc Returns the type subtree of a `record_index_expr' node.
%%
%% @see record_index_expr/2
@@ -4122,8 +4076,7 @@ record_index_expr_type(Node) ->
%% =====================================================================
-%% @doc Returns the field subtree of a record_index_expr
-%% node.
+%% @doc Returns the field subtree of a `record_index_expr' node.
%%
%% @see record_index_expr/2
@@ -4149,12 +4102,12 @@ record_access(Argument, Field) ->
%% =====================================================================
%% @doc Creates an abstract record field access expression. If
-%% Type
is not none
, the result represents
+%% `Type' is not `none', the result represents
%% "Argument#Type.Field
".
%%
-%% If Type
is none
, the result represents
+%% If `Type' is `none', the result represents
%% "Argument.Field
". This is a special
-%% form only allowed within Mnemosyne queries.
+%% form only allowed within Mnemosyne queries.
%%
%% @see record_access/2
%% @see record_access_argument/1
@@ -4209,8 +4162,7 @@ revert_record_access(Node) ->
%% =====================================================================
-%% @doc Returns the argument subtree of a record_access
-%% node.
+%% @doc Returns the argument subtree of a `record_access' node.
%%
%% @see record_access/3
@@ -4228,12 +4180,12 @@ record_access_argument(Node) ->
%% =====================================================================
-%% @doc Returns the type subtree of a record_access
node,
-%% if any. If Node
represents
-%% "Argument.Field
", none
-%% is returned, otherwise if Node
represents
+%% @doc Returns the type subtree of a `record_access' node,
+%% if any. If `Node' represents
+%% "Argument.Field
", `none'
+%% is returned, otherwise if `Node' represents
%% "Argument#Type.Field
",
-%% Type
is returned.
+%% `Type' is returned.
%%
%% @see record_access/3
@@ -4251,8 +4203,7 @@ record_access_type(Node) ->
%% =====================================================================
-%% @doc Returns the field subtree of a record_access
-%% node.
+%% @doc Returns the field subtree of a `record_access' node.
%%
%% @see record_access/3
@@ -4279,9 +4230,9 @@ record_expr(Type, Fields) ->
%% =====================================================================
-%% @doc Creates an abstract record expression. If Fields
is
-%% [F1, ..., Fn]
, then if Argument
is
-%% none
, the result represents
+%% @doc Creates an abstract record expression. If `Fields' is
+%% `[F1, ..., Fn]', then if `Argument' is
+%% `none', the result represents
%% "#Type{F1, ..., Fn}
",
%% otherwise it represents
%% "Argument#Type{F1, ...,
@@ -4347,12 +4298,12 @@ revert_record_expr(Node) ->
%% =====================================================================
-%% @doc Returns the argument subtree of a record_expr
node,
-%% if any. If Node
represents
-%% "#Type{...}
", none
is returned.
-%% Otherwise, if Node
represents
+%% @doc Returns the argument subtree of a `record_expr' node,
+%% if any. If `Node' represents
+%% "#Type{...}
", `none' is returned.
+%% Otherwise, if `Node' represents
%% "Argument#Type{...}
",
-%% Argument
is returned.
+%% `Argument' is returned.
%%
%% @see record_expr/3
@@ -4370,7 +4321,7 @@ record_expr_argument(Node) ->
%% =====================================================================
-%% @doc Returns the type subtree of a record_expr
node.
+%% @doc Returns the type subtree of a `record_expr' node.
%%
%% @see record_expr/3
@@ -4389,7 +4340,7 @@ record_expr_type(Node) ->
%% =====================================================================
%% @doc Returns the list of field subtrees of a
-%% record_expr
node.
+%% `record_expr' node.
%%
%% @see record_expr/3
@@ -4408,10 +4359,10 @@ record_expr_fields(Node) ->
%% =====================================================================
%% @doc Creates an abstract function application expression. If
-%% Module
is none
, this is call is equivalent
-%% to application(Function, Arguments)
, otherwise it is
-%% equivalent to application(module_qualifier(Module, Function),
-%% Arguments)
.
+%% `Module' is `none', this is call is equivalent
+%% to `application(Function, Arguments)', otherwise it is
+%% equivalent to `application(module_qualifier(Module, Function),
+%% Arguments)'.
%%
%% (This is a utility function.)
%%
@@ -4429,7 +4380,7 @@ application(Module, Name, Arguments) ->
%% =====================================================================
%% @doc Creates an abstract function application expression. If
-%% Arguments
is [A1, ..., An]
, the result
+%% `Arguments' is `[A1, ..., An]', the result
%% represents "Operator(A1, ...,
%% An)
".
%%
@@ -4467,12 +4418,11 @@ revert_application(Node) ->
%% =====================================================================
-%% @doc Returns the operator subtree of an application
-%% node.
+%% @doc Returns the operator subtree of an `application' node.
%%
-%% Note: if Node
represents
+%% Note: if `Node' represents
%% "M:F(...)
", then the result is the
-%% subtree representing "M:F
".
+%% subtree representing "M:F
".
%%
%% @see application/2
%% @see module_qualifier/2
@@ -4490,7 +4440,7 @@ application_operator(Node) ->
%% =====================================================================
%% @doc Returns the list of argument subtrees of an
-%% application
node.
+%% `application' node.
%%
%% @see application/2
@@ -4506,8 +4456,8 @@ application_arguments(Node) ->
%% =====================================================================
-%% @doc Creates an abstract list comprehension. If Body
is
-%% [E1, ..., En]
, the result represents
+%% @doc Creates an abstract list comprehension. If `Body' is
+%% `[E1, ..., En]', the result represents
%% "[Template || E1, ..., En]
".
%%
%% @see list_comp_template/1
@@ -4542,7 +4492,7 @@ revert_list_comp(Node) ->
%% =====================================================================
-%% @doc Returns the template subtree of a list_comp
node.
+%% @doc Returns the template subtree of a `list_comp' node.
%%
%% @see list_comp/2
@@ -4558,8 +4508,7 @@ list_comp_template(Node) ->
%% =====================================================================
-%% @doc Returns the list of body subtrees of a list_comp
-%% node.
+%% @doc Returns the list of body subtrees of a `list_comp' node.
%%
%% @see list_comp/2
@@ -4574,8 +4523,8 @@ list_comp_body(Node) ->
end.
%% =====================================================================
-%% @doc Creates an abstract binary comprehension. If Body
is
-%% [E1, ..., En]
, the result represents
+%% @doc Creates an abstract binary comprehension. If `Body' is
+%% `[E1, ..., En]', the result represents
%% "<<Template || E1, ..., En>>
".
%%
%% @see binary_comp_template/1
@@ -4610,7 +4559,7 @@ revert_binary_comp(Node) ->
%% =====================================================================
-%% @doc Returns the template subtree of a binary_comp
node.
+%% @doc Returns the template subtree of a `binary_comp' node.
%%
%% @see binary_comp/2
@@ -4626,8 +4575,7 @@ binary_comp_template(Node) ->
%% =====================================================================
-%% @doc Returns the list of body subtrees of a binary_comp
-%% node.
+%% @doc Returns the list of body subtrees of a `binary_comp' node.
%%
%% @see binary_comp/2
@@ -4671,7 +4619,7 @@ revert_query_expr(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a query_expr
node.
+%% @doc Returns the body subtree of a `query_expr' node.
%%
%% @see query_expr/1
@@ -4687,10 +4635,10 @@ query_expr_body(Node) ->
%% =====================================================================
-%% @doc Creates an abstract Mnemosyne rule. If Clauses
is
-%% [C1, ..., Cn]
, the results represents
+%% @doc Creates an abstract Mnemosyne rule. If `Clauses' is
+%% `[C1, ..., Cn]', the results represents
%% "Name C1; ...; Name
-%% Cn.
". More exactly, if each Ci
+%% Cn.
". More exactly, if each `Ci'
%% represents "(Pi1, ..., Pim) Gi ->
%% Bi
", then the result represents
%% "Name(P11, ..., P1m) G1 :-
@@ -4745,7 +4693,7 @@ revert_rule(Node) ->
%% =====================================================================
-%% @doc Returns the name subtree of a rule
node.
+%% @doc Returns the name subtree of a `rule' node.
%%
%% @see rule/2
@@ -4760,7 +4708,7 @@ rule_name(Node) ->
end.
%% =====================================================================
-%% @doc Returns the list of clause subtrees of a rule
node.
+%% @doc Returns the list of clause subtrees of a `rule' node.
%%
%% @see rule/2
@@ -4775,14 +4723,14 @@ rule_clauses(Node) ->
end.
%% =====================================================================
-%% @doc Returns the arity of a rule
node. The result is the
+%% @doc Returns the arity of a `rule' node. The result is the
%% number of parameter patterns in the first clause of the rule;
%% subsequent clauses are ignored.
%%
-%% An exception is thrown if rule_clauses(Node)
returns
+%% An exception is thrown if `rule_clauses(Node)' returns
%% an empty list, or if the first element of that list is not a syntax
-%% tree C
of type clause
such that
-%% clause_patterns(C)
is a nonempty list.
+%% tree `C' of type `clause' such that
+%% `clause_patterns(C)' is a nonempty list.
%%
%% @see rule/2
%% @see rule_clauses/1
@@ -4832,7 +4780,7 @@ revert_generator(Node) ->
%% =====================================================================
-%% @doc Returns the pattern subtree of a generator
node.
+%% @doc Returns the pattern subtree of a `generator' node.
%%
%% @see generator/2
@@ -4848,7 +4796,7 @@ generator_pattern(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a generator
node.
+%% @doc Returns the body subtree of a `generator' node.
%%
%% @see generator/2
@@ -4898,7 +4846,7 @@ revert_binary_generator(Node) ->
%% =====================================================================
-%% @doc Returns the pattern subtree of a generator
node.
+%% @doc Returns the pattern subtree of a `generator' node.
%%
%% @see binary_generator/2
@@ -4914,7 +4862,7 @@ binary_generator_pattern(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a generator
node.
+%% @doc Returns the body subtree of a `generator' node.
%%
%% @see binary_generator/2
@@ -4930,8 +4878,8 @@ binary_generator_body(Node) ->
%% =====================================================================
-%% @doc Creates an abstract block expression. If Body
is
-%% [B1, ..., Bn]
, the result represents "begin
+%% @doc Creates an abstract block expression. If `Body' is
+%% `[B1, ..., Bn]', the result represents "begin
%% B1, ..., Bn end
".
%%
%% @see block_expr_body/1
@@ -4959,8 +4907,7 @@ revert_block_expr(Node) ->
%% =====================================================================
-%% @doc Returns the list of body subtrees of a block_expr
-%% node.
+%% @doc Returns the list of body subtrees of a `block_expr' node.
%%
%% @see block_expr/1
@@ -4976,10 +4923,10 @@ block_expr_body(Node) ->
%% =====================================================================
-%% @doc Creates an abstract if-expression. If Clauses
is
-%% [C1, ..., Cn]
, the result represents "if
+%% @doc Creates an abstract if-expression. If `Clauses' is
+%% `[C1, ..., Cn]', the result represents "if
%% C1; ...; Cn end
". More exactly, if each
-%% Ci
represents "() Gi ->
+%% `Ci' represents "() Gi ->
%% Bi
", then the result represents "if
%% G1 -> B1; ...; Gn -> Bn
%% end
".
@@ -5014,8 +4961,7 @@ revert_if_expr(Node) ->
%% =====================================================================
-%% @doc Returns the list of clause subtrees of an if_expr
-%% node.
+%% @doc Returns the list of clause subtrees of an `if_expr' node.
%%
%% @see if_expr/1
@@ -5031,10 +4977,10 @@ if_expr_clauses(Node) ->
%% =====================================================================
-%% @doc Creates an abstract case-expression. If Clauses
is
-%% [C1, ..., Cn]
, the result represents "case
+%% @doc Creates an abstract case-expression. If `Clauses' is
+%% `[C1, ..., Cn]', the result represents "case
%% Argument of C1; ...; Cn end
". More
-%% exactly, if each Ci
represents "(Pi)
+%% exactly, if each `Ci' represents "(Pi)
%% Gi -> Bi
", then the result represents
%% "case Argument of P1 G1 ->
%% B1; ...; Pn Gn -> Bn end
".
@@ -5078,7 +5024,7 @@ revert_case_expr(Node) ->
%% =====================================================================
-%% @doc Returns the argument subtree of a case_expr
node.
+%% @doc Returns the argument subtree of a `case_expr' node.
%%
%% @see case_expr/2
@@ -5094,8 +5040,7 @@ case_expr_argument(Node) ->
%% =====================================================================
-%% @doc Returns the list of clause subtrees of a case_expr
-%% node.
+%% @doc Returns the list of clause subtrees of a `case_expr' node.
%%
%% @see case_expr/2
@@ -5111,10 +5056,10 @@ case_expr_clauses(Node) ->
%% =====================================================================
-%% @doc Creates an abstract cond-expression. If Clauses
is
-%% [C1, ..., Cn]
, the result represents "cond
+%% @doc Creates an abstract cond-expression. If `Clauses' is
+%% `[C1, ..., Cn]', the result represents "cond
%% C1; ...; Cn end
". More exactly, if each
-%% Ci
represents "() Ei ->
+%% `Ci' represents "() Ei ->
%% Bi
", then the result represents "cond
%% E1 -> B1; ...; En -> Bn
%% end
".
@@ -5149,8 +5094,7 @@ revert_cond_expr(Node) ->
%% =====================================================================
-%% @doc Returns the list of clause subtrees of a cond_expr
-%% node.
+%% @doc Returns the list of clause subtrees of a `cond_expr' node.
%%
%% @see cond_expr/1
@@ -5175,21 +5119,21 @@ receive_expr(Clauses) ->
%% =====================================================================
-%% @doc Creates an abstract receive-expression. If Timeout
-%% is none
, the result represents "receive
-%% C1; ...; Cn end
" (the Action
-%% argument is ignored). Otherwise, if Clauses
is
-%% [C1, ..., Cn]
and Action
is [A1, ...,
-%% Am]
, the result represents "receive C1; ...;
+%% @doc Creates an abstract receive-expression. If `Timeout'
+%% is `none', the result represents "receive
+%% C1; ...; Cn end
" (the `Action'
+%% argument is ignored). Otherwise, if `Clauses' is
+%% `[C1, ..., Cn]' and `Action' is `[A1, ...,
+%% Am]', the result represents "receive C1; ...;
%% Cn after Timeout -> A1, ..., Am
-%% end
". More exactly, if each Ci
represents
+%% end
". More exactly, if each `Ci' represents
%% "(Pi) Gi -> Bi
", then the
%% result represents "receive P1 G1 ->
%% B1; ...; Pn Gn -> Bn ...
%% end
".
%%
-%% Note that in Erlang, a receive-expression must have at least one
-%% clause if no timeout part is specified.
+%% Note that in Erlang, a receive-expression must have at least one
+%% clause if no timeout part is specified.
%%
%% @see receive_expr_clauses/1
%% @see receive_expr_timeout/1
@@ -5254,7 +5198,7 @@ revert_receive_expr(Node) ->
%% =====================================================================
%% @doc Returns the list of clause subtrees of a
-%% receive_expr
node.
+%% `receive_expr' node.
%%
%% @see receive_expr/3
@@ -5272,12 +5216,12 @@ receive_expr_clauses(Node) ->
%% =====================================================================
-%% @doc Returns the timeout subtree of a receive_expr
node,
-%% if any. If Node
represents "receive C1;
-%% ...; Cn end
", none
is returned.
-%% Otherwise, if Node
represents "receive
+%% @doc Returns the timeout subtree of a `receive_expr' node,
+%% if any. If `Node' represents "receive C1;
+%% ...; Cn end
", `none' is returned.
+%% Otherwise, if `Node' represents "receive
%% C1; ...; Cn after Timeout -> ... end
",
-%% Timeout
is returned.
+%% `Timeout' is returned.
%%
%% @see receive_expr/3
@@ -5296,7 +5240,7 @@ receive_expr_timeout(Node) ->
%% =====================================================================
%% @doc Returns the list of action body subtrees of a
-%% receive_expr
node. If Node
represents
+%% `receive_expr' node. If `Node' represents
%% "receive C1; ...; Cn end
", this is the
%% empty list.
%%
@@ -5343,26 +5287,26 @@ try_after_expr(Body, After) ->
%% =====================================================================
-%% @doc Creates an abstract try-expression. If Body
is
-%% [B1, ..., Bn]
, Clauses
is [C1, ...,
-%% Cj]
, Handlers
is [H1, ..., Hk]
, and
-%% After
is [A1, ..., Am]
, the result
+%% @doc Creates an abstract try-expression. If `Body' is
+%% `[B1, ..., Bn]', `Clauses' is `[C1, ...,
+%% Cj]', `Handlers' is `[H1, ..., Hk]', and
+%% `After' is `[A1, ..., Am]', the result
%% represents "try B1, ..., Bn of C1;
%% ...; Cj catch H1; ...; Hk after
%% A1, ..., Am end
". More exactly, if each
-%% Ci
represents "(CPi) CGi ->
-%% CBi
", and each Hi
represents
+%% `Ci' represents "(CPi) CGi ->
+%% CBi
", and each `Hi' represents
%% "(HPi) HGi -> HBi
", then the
%% result represents "try B1, ..., Bn of
%% CP1 CG1 -> CB1; ...; CPj
%% CGj -> CBj catch HP1 HG1 ->
%% HB1; ...; HPk HGk -> HBk after
-%% A1, ..., Am end
"; cf.
-%% case_expr/2
. If Clauses
is the empty list,
-%% the of ...
section is left out. If After
is
-%% the empty list, the after ...
section is left out. If
-%% Handlers
is the empty list, and After
is
-%% nonempty, the catch ...
section is left out.
+%% A1, ..., Am end
"; see
+%% {@link case_expr/2}. If `Clauses' is the empty list,
+%% the `of ...' section is left out. If `After' is
+%% the empty list, the `after ...' section is left out. If
+%% `Handlers' is the empty list, and `After' is
+%% nonempty, the `catch ...' section is left out.
%%
%% @see try_expr_body/1
%% @see try_expr_clauses/1
@@ -5420,8 +5364,7 @@ revert_try_expr(Node) ->
%% =====================================================================
-%% @doc Returns the list of body subtrees of a try_expr
-%% node.
+%% @doc Returns the list of body subtrees of a `try_expr' node.
%%
%% @see try_expr/4
@@ -5438,7 +5381,7 @@ try_expr_body(Node) ->
%% =====================================================================
%% @doc Returns the list of case-clause subtrees of a
-%% try_expr
node. If Node
represents
+%% `try_expr' node. If `Node' represents
%% "try Body catch H1; ...; Hn
%% end
", the result is the empty list.
%%
@@ -5457,7 +5400,7 @@ try_expr_clauses(Node) ->
%% =====================================================================
%% @doc Returns the list of handler-clause subtrees of a
-%% try_expr
node.
+%% `try_expr' node.
%%
%% @see try_expr/4
@@ -5473,8 +5416,7 @@ try_expr_handlers(Node) ->
%% =====================================================================
-%% @doc Returns the list of "after" subtrees of a try_expr
-%% node.
+%% @doc Returns the list of "after" subtrees of a `try_expr' node.
%%
%% @see try_expr/4
@@ -5513,7 +5455,7 @@ class_qualifier(Class, Body) ->
%% =====================================================================
%% @doc Returns the argument (the class) subtree of a
-%% class_qualifier
node.
+%% `class_qualifier' node.
%%
%% @see class_qualifier/2
@@ -5524,7 +5466,7 @@ class_qualifier_argument(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a class_qualifier
node.
+%% @doc Returns the body subtree of a `class_qualifier' node.
%%
%% @see class_qualifier/2
@@ -5536,9 +5478,9 @@ class_qualifier_body(Node) ->
%% =====================================================================
%% @doc Creates an abstract "implicit fun" expression. If
-%% Arity
is none
, this is equivalent to
-%% implicit_fun(Name)
, otherwise it is equivalent to
-%% implicit_fun(arity_qualifier(Name, Arity))
.
+%% `Arity' is `none', this is equivalent to
+%% `implicit_fun(Name)', otherwise it is equivalent to
+%% `implicit_fun(arity_qualifier(Name, Arity))'.
%%
%% (This is a utility function.)
%%
@@ -5555,10 +5497,10 @@ implicit_fun(Name, Arity) ->
%% =====================================================================
%% @doc Creates an abstract module-qualified "implicit fun" expression.
-%% If Module
is none
, this is equivalent to
-%% implicit_fun(Name, Arity)
, otherwise it is equivalent to
-%% implicit_fun(module_qualifier(Module, arity_qualifier(Name,
-%% Arity))
.
+%% If `Module' is `none', this is equivalent to
+%% `implicit_fun(Name, Arity)', otherwise it is equivalent to
+%% `implicit_fun(module_qualifier(Module, arity_qualifier(Name,
+%% Arity))'.
%%
%% (This is a utility function.)
%%
@@ -5576,7 +5518,7 @@ implicit_fun(Module, Name, Arity) ->
%% =====================================================================
%% @doc Creates an abstract "implicit fun" expression. The result
-%% represents "fun Name
". Name
should
+%% represents "fun Name
". `Name' should
%% represent either F/A
or
%% M:F/A
%%
@@ -5635,13 +5577,13 @@ revert_implicit_fun(Node) ->
%% =====================================================================
-%% @doc Returns the name subtree of an implicit_fun
node.
+%% @doc Returns the name subtree of an `implicit_fun' node.
%%
-%% Note: if Node
represents "fun
+%% Note: if `Node' represents "fun
%% N/A
" or "fun
%% M:N/A
", then the result is the
%% subtree representing "N/A
" or
-%% "M:N/A
", respectively.
+%% "M:N/A
", respectively.
%%
%% @see implicit_fun/1
%% @see arity_qualifier/2
@@ -5671,10 +5613,10 @@ implicit_fun_name(Node) ->
%% =====================================================================
-%% @doc Creates an abstract fun-expression. If Clauses
is
-%% [C1, ..., Cn]
, the result represents "fun
+%% @doc Creates an abstract fun-expression. If `Clauses' is
+%% `[C1, ..., Cn]', the result represents "fun
%% C1; ...; Cn end
". More exactly, if each
-%% Ci
represents "(Pi1, ..., Pim)
+%% `Ci' represents "(Pi1, ..., Pim)
%% Gi -> Bi
", then the result represents
%% "fun (P11, ..., P1m) G1 ->
%% B1; ...; (Pn1, ..., Pnm) Gn ->
@@ -5711,8 +5653,7 @@ revert_fun_expr(Node) ->
%% =====================================================================
-%% @doc Returns the list of clause subtrees of a fun_expr
-%% node.
+%% @doc Returns the list of clause subtrees of a `fun_expr' node.
%%
%% @see fun_expr/1
@@ -5728,14 +5669,14 @@ fun_expr_clauses(Node) ->
%% =====================================================================
-%% @doc Returns the arity of a fun_expr
node. The result is
+%% @doc Returns the arity of a `fun_expr' node. The result is
%% the number of parameter patterns in the first clause of the
%% fun-expression; subsequent clauses are ignored.
%%
-%% An exception is thrown if fun_expr_clauses(Node)
+%% An exception is thrown if `fun_expr_clauses(Node)'
%% returns an empty list, or if the first element of that list is not a
-%% syntax tree C
of type clause
such that
-%% clause_patterns(C)
is a nonempty list.
+%% syntax tree `C' of type `clause' such that
+%% `clause_patterns(C)' is a nonempty list.
%%
%% @see fun_expr/1
%% @see fun_expr_clauses/1
@@ -5768,7 +5709,7 @@ revert_parentheses(Node) ->
%% =====================================================================
-%% @doc Returns the body subtree of a parentheses
node.
+%% @doc Returns the body subtree of a `parentheses' node.
%%
%% @see parentheses/1
@@ -5788,22 +5729,22 @@ macro(Name) ->
%% =====================================================================
-%% @doc Creates an abstract macro application. If Arguments
-%% is none
, the result represents
-%% "?Name
", otherwise, if Arguments
-%% is [A1, ..., An]
, the result represents
+%% @doc Creates an abstract macro application. If `Arguments'
+%% is `none', the result represents
+%% "?Name
", otherwise, if `Arguments'
+%% is `[A1, ..., An]', the result represents
%% "?Name(A1, ..., An)
".
%%
-%% Notes: if Arguments
is the empty list, the result
+%% Notes: if `Arguments' is the empty list, the result
%% will thus represent "?Name()
", including a pair
-%% of matching parentheses.
+%% of matching parentheses.
%%
-%% The only syntactical limitation imposed by the preprocessor on the
+%% The only syntactical limitation imposed by the preprocessor on the
%% arguments to a macro application (viewed as sequences of tokens) is
%% that they must be balanced with respect to parentheses, brackets,
-%% begin ... end
, case ... end
, etc. The
-%% text
node type can be used to represent arguments which
-%% are not regular Erlang constructs.
+%% `begin ... end', `case ... end', etc. The
+%% `text' node type can be used to represent arguments which
+%% are not regular Erlang constructs.
%%
%% @see macro_name/1
%% @see macro_arguments/1
@@ -5825,7 +5766,7 @@ macro(Name, Arguments) ->
%% =====================================================================
-%% @doc Returns the name subtree of a macro
node.
+%% @doc Returns the name subtree of a `macro' node.
%%
%% @see macro/2
@@ -5836,12 +5777,12 @@ macro_name(Node) ->
%% =====================================================================
-%% @doc Returns the list of argument subtrees of a macro
-%% node, if any. If Node
represents
-%% "?Name
", none
is returned.
-%% Otherwise, if Node
represents
+%% @doc Returns the list of argument subtrees of a `macro'
+%% node, if any. If `Node' represents
+%% "?Name
", `none' is returned.
+%% Otherwise, if `Node' represents
%% "?Name(A1, ..., An)
",
-%% [A1, ..., An]
is returned.
+%% `[A1, ..., An]' is returned.
%%
%% @see macro/2
@@ -5853,12 +5794,12 @@ macro_arguments(Node) ->
%% =====================================================================
%% @doc Returns the syntax tree corresponding to an Erlang term.
-%% Term
must be a literal term, i.e., one that can be
+%% `Term' must be a literal term, i.e., one that can be
%% represented as a source code literal. Thus, it may not contain a
%% process identifier, port, reference, binary or function value as a
%% subterm. The function recognises printable strings, in order to get a
%% compact and readable representation. Evaluation fails with reason
-%% badarg
if Term
is not a literal term.
+%% `badarg' if `Term' is not a literal term.
%%
%% @see concrete/1
%% @see is_literal/1
@@ -5909,16 +5850,16 @@ abstract_tail(H, T) ->
%% =====================================================================
%% @doc Returns the Erlang term represented by a syntax tree. Evaluation
-%% fails with reason badarg
if Node
does not
+%% fails with reason `badarg' if `Node' does not
%% represent a literal term.
%%
-%% Note: Currently, the set of syntax trees which have a concrete
+%% Note: Currently, the set of syntax trees which have a concrete
%% representation is larger than the set of trees which can be built
-%% using the function abstract/1
. An abstract character
-%% will be concretised as an integer, while abstract/1
does
+%% using the function {@link abstract/1}. An abstract character
+%% will be concretised as an integer, while {@link abstract/1} does
%% not at present yield an abstract character for any input. (Use the
-%% char/1
function to explicitly create an abstract
-%% character.)
+%% {@link char/1} function to explicitly create an abstract
+%% character.)
%%
%% @see abstract/1
%% @see is_literal/1
@@ -5961,7 +5902,7 @@ concrete(Node) ->
{value, concrete(F), []}
end, [], true),
B;
- _ ->
+ _ ->
erlang:error({badarg, Node})
end.
@@ -5972,10 +5913,10 @@ concrete_list([]) ->
%% =====================================================================
-%% @doc Returns true
if Node
represents a
-%% literal term, otherwise false
. This function returns
-%% true
if and only if the value of
-%% concrete(Node)
is defined.
+%% @doc Returns `true' if `Node' represents a
+%% literal term, otherwise `false'. This function returns
+%% `true' if and only if the value of
+%% `concrete(Node)' is defined.
%%
%% @see abstract/1
%% @see concrete/1
@@ -6006,19 +5947,19 @@ is_literal(T) ->
%% =====================================================================
-%% @doc Returns an erl_parse
-compatible representation of a
-%% syntax tree, if possible. If Tree
represents a
+%% @doc Returns an `erl_parse'-compatible representation of a
+%% syntax tree, if possible. If `Tree' represents a
%% well-formed Erlang program or expression, the conversion should work
-%% without problems. Typically, is_tree/1
yields
-%% true
if conversion failed (i.e., the result is still an
-%% abstract syntax tree), and false
otherwise.
+%% without problems. Typically, {@link is_tree/1} yields
+%% `true' if conversion failed (i.e., the result is still an
+%% abstract syntax tree), and `false' otherwise.
%%
-%% The is_tree/1
test is not completely foolproof. For a
-%% few special node types (e.g. arity_qualifier
), if such a
+%% The {@link is_tree/1} test is not completely foolproof. For a
+%% few special node types (e.g. `arity_qualifier'), if such a
%% node occurs in a context where it is not expected, it will be left
%% unchanged as a non-reverted subtree of the result. This can only
-%% happen if Tree
does not actually represent legal Erlang
-%% code.
+%% happen if `Tree' does not actually represent legal Erlang
+%% code.
%%
%% @see revert_forms/1
%% @see //stdlib/erl_parse
@@ -6155,11 +6096,11 @@ revert_root(Node) ->
%% =====================================================================
%% @doc Reverts a sequence of Erlang source code forms. The sequence can
-%% be given either as a form_list
syntax tree (possibly
+%% be given either as a `form_list' syntax tree (possibly
%% nested), or as a list of "program form" syntax trees. If successful,
-%% the corresponding flat list of erl_parse
-compatible
-%% syntax trees is returned (cf. revert/1
). If some program
-%% form could not be reverted, {error, Form}
is thrown.
+%% the corresponding flat list of `erl_parse'-compatible
+%% syntax trees is returned (see {@link revert/1}). If some program
+%% form could not be reverted, `{error, Form}' is thrown.
%% Standalone comments in the form sequence are discarded.
%%
%% @see revert/1
@@ -6209,57 +6150,53 @@ revert_forms_1([]) ->
%% =====================================================================
%% @doc Returns the grouped list of all subtrees of a syntax tree. If
-%% Node
is a leaf node (cf. is_leaf/1
), this
+%% `Node' is a leaf node (see {@link is_leaf/1}), this
%% is the empty list, otherwise the result is always a nonempty list,
-%% containing the lists of subtrees of Node
, in
+%% containing the lists of subtrees of `Node', in
%% left-to-right order as they occur in the printed program text, and
%% grouped by category. Often, each group contains only a single
%% subtree.
%%
-%% Depending on the type of Node
, the size of some
+%% Depending on the type of `Node', the size of some
%% groups may be variable (e.g., the group consisting of all the
%% elements of a tuple), while others always contain the same number of
%% elements - usually exactly one (e.g., the group containing the
%% argument expression of a case-expression). Note, however, that the
%% exact structure of the returned list (for a given node type) should
%% in general not be depended upon, since it might be subject to change
-%% without notice.
+%% without notice.
%%
-%% The function subtrees/1
and the constructor functions
-%% make_tree/2
and update_tree/2
can be a
+%% The function {@link subtrees/1} and the constructor functions
+%% {@link make_tree/2} and {@link update_tree/2} can be a
%% great help if one wants to traverse a syntax tree, visiting all its
%% subtrees, but treat nodes of the tree in a uniform way in most or all
%% cases. Using these functions makes this simple, and also assures that
%% your code is not overly sensitive to extensions of the syntax tree
%% data type, because any node types not explicitly handled by your code
-%% can be left to a default case.
+%% can be left to a default case.
%%
-%% For example:
-%%
-%% postorder(F, Tree) ->
+%% For example:
+%% ```postorder(F, Tree) ->
%% F(case subtrees(Tree) of
%% [] -> Tree;
%% List -> update_tree(Tree,
%% [[postorder(F, Subtree)
%% || Subtree <- Group]
%% || Group <- List])
-%% end).
-%%
-%% maps the function F
on Tree
and all its
+%% end).'''
+%% maps the function `F' on `Tree' and all its
%% subtrees, doing a post-order traversal of the syntax tree. (Note the
-%% use of update_tree/2
to preserve node attributes.) For a
+%% use of {@link update_tree/2} to preserve node attributes.) For a
%% simple function like:
-%%
-%% f(Node) ->
+%% ```f(Node) ->
%% case type(Node) of
%% atom -> atom("a_" ++ atom_name(Node));
%% _ -> Node
-%% end.
-%%
-%% the call postorder(fun f/1, Tree)
will yield a new
-%% representation of Tree
in which all atom names have been
+%% end.'''
+%% the call `postorder(fun f/1, Tree)' will yield a new
+%% representation of `Tree' in which all atom names have been
%% extended with the prefix "a_", but nothing else (including comments,
-%% annotations and line numbers) has been changed.
+%% annotations and line numbers) has been changed.
%%
%% @see make_tree/2
%% @see type/1
@@ -6430,8 +6367,8 @@ subtrees(T) ->
%% =====================================================================
%% @doc Creates a syntax tree with the same type and attributes as the
-%% given tree. This is equivalent to copy_attrs(Node,
-%% make_tree(type(Node), Groups))
.
+%% given tree. This is equivalent to `copy_attrs(Node,
+%% make_tree(type(Node), Groups))'.
%%
%% @see make_tree/2
%% @see copy_attrs/2
@@ -6445,19 +6382,19 @@ update_tree(Node, Groups) ->
%% =====================================================================
%% @doc Creates a syntax tree with the given type and subtrees.
-%% Type
must be a node type name (cf. type/1
)
-%% that does not denote a leaf node type (cf. is_leaf/1
).
-%% Groups
must be a nonempty list of groups of
+%% `Type' must be a node type name (see {@link type/1})
+%% that does not denote a leaf node type (see {@link is_leaf/1}).
+%% `Groups' must be a nonempty list of groups of
%% syntax trees, representing the subtrees of a node of the given type,
%% in left-to-right order as they would occur in the printed program
-%% text, grouped by category as done by subtrees/1
.
+%% text, grouped by category as done by {@link subtrees/1}.
%%
-%% The result of copy_attrs(Node, make_tree(type(Node),
-%% subtrees(Node)))
(cf. update_tree/2
) represents
-%% the same source code text as the original Node
, assuming
-%% that subtrees(Node)
yields a nonempty list. However, it
+%% The result of `copy_attrs(Node, make_tree(type(Node),
+%% subtrees(Node)))' (see {@link update_tree/2}) represents
+%% the same source code text as the original `Node', assuming
+%% that `subtrees(Node)' yields a nonempty list. However, it
%% does not necessarily have the same data representation as
-%% Node
.
+%% `Node'.
%%
%% @see update_tree/2
%% @see subtrees/1
@@ -6525,37 +6462,37 @@ make_tree(tuple, [E]) -> tuple(E).
%% @doc Creates a meta-representation of a syntax tree. The result
%% represents an Erlang expression "MetaTree
"
%% which, if evaluated, will yield a new syntax tree representing the
-%% same source code text as Tree
(although the actual data
+%% same source code text as `Tree' (although the actual data
%% representation may be different). The expression represented by
-%% MetaTree
is implementation independent with
+%% `MetaTree' is implementation independent with
%% regard to the data structures used by the abstract syntax tree
-%% implementation. Comments attached to nodes of Tree
will
+%% implementation. Comments attached to nodes of `Tree' will
%% be preserved, but other attributes are lost.
%%
-%% Any node in Tree
whose node type is
-%% variable
(cf. type/1
), and whose list of
-%% annotations (cf. get_ann/1
) contains the atom
-%% meta_var
, will remain unchanged in the resulting tree,
-%% except that exactly one occurrence of meta_var
is
-%% removed from its annotation list.
+%% Any node in `Tree' whose node type is
+%% `variable' (see {@link type/1}), and whose list of
+%% annotations (see {@link get_ann/1}) contains the atom
+%% `meta_var', will remain unchanged in the resulting tree,
+%% except that exactly one occurrence of `meta_var' is
+%% removed from its annotation list.
%%
-%% The main use of the function meta/1
is to transform a
-%% data structure Tree
, which represents a piece of program
+%% The main use of the function `meta/1' is to transform a
+%% data structure `Tree', which represents a piece of program
%% code, into a form that is representation independent when
-%% printed. E.g., suppose Tree
represents a variable
-%% named "V". Then (assuming a function print/1
for
-%% printing syntax trees), evaluating print(abstract(Tree))
-%% - simply using abstract/1
to map the actual data
+%% printed. E.g., suppose `Tree' represents a variable
+%% named "V". Then (assuming a function `print/1' for
+%% printing syntax trees), evaluating `print(abstract(Tree))'
+%% - simply using {@link abstract/1} to map the actual data
%% structure onto a syntax tree representation - would output a string
-%% that might look something like "{tree, variable, ..., "V",
-%% ...}
", which is obviously dependent on the implementation of
+%% that might look something like "`{tree, variable, ..., "V",
+%% ...}'", which is obviously dependent on the implementation of
%% the abstract syntax trees. This could e.g. be useful for caching a
%% syntax tree in a file. However, in some situations like in a program
%% generator generator (with two "generator"), it may be unacceptable.
-%% Using print(meta(Tree))
instead would output a
+%% Using `print(meta(Tree))' instead would output a
%% representation independent syntax tree generating
%% expression; in the above case, something like
-%% "erl_syntax:variable("V")
".
+%% "`erl_syntax:variable("V")'".
%%
%% @see abstract/1
%% @see type/1
@@ -6695,29 +6632,30 @@ tree(Type) ->
%% =====================================================================
%% @doc For special purposes only. Creates an abstract syntax
-%% tree node with type tag Type
and associated data
-%% Data
.
+%% tree node with type tag `Type' and associated data
+%% `Data'.
%%
-%% This function and the related is_tree/1
and
-%% data/1
provide a uniform way to extend the set of
-%% erl_parse
node types. The associated data is any term,
-%% whose format may depend on the type tag.
+%% This function and the related {@link is_tree/1} and
+%% {@link data/1} provide a uniform way to extend the set of
+%% `erl_parse' node types. The associated data is any term,
+%% whose format may depend on the type tag.
%%
-%% Notes:
+%% === Notes: ===
%%
%% - Any nodes created outside of this module must have type tags
%% distinct from those currently defined by this module; see
-%%
type/1
for a complete list.
+%% {@link type/1} for a complete list.
%% - The type tag of a syntax tree node may also be used
-%% as a primary tag by the
erl_parse
representation;
+%% as a primary tag by the `erl_parse' representation;
%% in that case, the selector functions for that node type
%% must handle both the abstract syntax tree and the
-%% erl_parse
form. The function type(T)
+%% `erl_parse' form. The function `type(T)'
%% should return the correct type tag regardless of the
-%% representation of T
, so that the user sees no
-%% difference between erl_syntax
and
-%% erl_parse
nodes.
+%% representation of `T', so that the user sees no
+%% difference between `erl_syntax' and
+%% `erl_parse' nodes.
%%
+%%
%% @see is_tree/1
%% @see data/1
%% @see type/1
@@ -6729,12 +6667,12 @@ tree(Type, Data) ->
%% =====================================================================
-%% @doc For special purposes only. Returns true
if
-%% Tree
is an abstract syntax tree and false
+%% @doc For special purposes only. Returns `true' if
+%% `Tree' is an abstract syntax tree and `false'
%% otherwise.
%%
-%% Note: this function yields false
for all
-%% "old-style" erl_parse
-compatible "parse trees".
+%% Note: this function yields `false' for all
+%% "old-style" `erl_parse'-compatible "parse trees".
%%
%% @see tree/2
@@ -6749,8 +6687,8 @@ is_tree(_) ->
%% =====================================================================
%% @doc For special purposes only. Returns the associated data
%% of a syntax tree node. Evaluation fails with reason
-%% badarg
if is_tree(Node)
does not yield
-%% true
.
+%% `badarg' if `is_tree(Node)' does not yield
+%% `true'.
%%
%% @see tree/2
@@ -6766,17 +6704,17 @@ data(T) -> erlang:error({badarg, T}).
%% =====================================================================
-%% @doc Creates a wrapper structure around an erl_parse
+%% @doc Creates a wrapper structure around an `erl_parse'
%% "parse tree".
%%
-%% This function and the related unwrap/1
and
-%% is_wrapper/1
provide a uniform way to attach arbitrary
-%% information to an erl_parse
tree. Some information about
+%% This function and the related {@link unwrap/1} and
+%% {@link is_wrapper/1} provide a uniform way to attach arbitrary
+%% information to an `erl_parse' tree. Some information about
%% the encapsuled tree may be cached in the wrapper, such as the node
%% type. All functions on syntax trees must behave so that the user sees
-%% no difference between wrapped and non-wrapped erl_parse
+%% no difference between wrapped and non-wrapped `erl_parse'
%% trees. Attaching a wrapper onto another wrapper structure is an
-%% error.
+%% error.
-spec wrap(erl_parse()) -> #wrapper{}.
@@ -6787,9 +6725,9 @@ wrap(Node) ->
%% =====================================================================
-%% @doc Removes any wrapper structure, if present. If Node
+%% @doc Removes any wrapper structure, if present. If `Node'
%% is a wrapper structure, this function returns the wrapped
-%% erl_parse
tree; otherwise it returns Node
+%% `erl_parse' tree; otherwise it returns `Node'
%% itself.
-spec unwrap(syntaxTree()) -> #tree{} | erl_parse().
@@ -6799,8 +6737,8 @@ unwrap(Node) -> Node. % This could also be a new-form node.
%% =====================================================================
-%% @doc Returns true
if the argument is a wrapper
-%% structure, otherwise false
.
+%% @doc Returns `true' if the argument is a wrapper
+%% structure, otherwise `false'.
-ifndef(NO_UNUSED).
-spec is_wrapper(term()) -> boolean().
--
cgit v1.2.3
From 53746070b5de7d1e9f809d516648948b0a246561 Mon Sep 17 00:00:00 2001
From: Richard Carlsson
Date: Sun, 22 Apr 2012 22:32:20 +0200
Subject: make list_suffix/1 and list_prefix/1 handle erl_parse() cons
sequences
---
lib/syntax_tools/src/erl_syntax.erl | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
(limited to 'lib/syntax_tools/src')
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index beae6f4a01..76a6a6dc36 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -2061,12 +2061,18 @@ revert_nil(Node) ->
list_prefix(Node) ->
case unwrap(Node) of
- {cons, _, Head, _} ->
- [Head];
+ {cons, _, Head, Tail} ->
+ [Head | cons_prefix(Tail)];
Node1 ->
(data(Node1))#list.prefix
end.
+%% collects sequences of conses; cf. cons_suffix/1 below
+cons_prefix({cons, _, Head, Tail}) ->
+ [Head | cons_prefix(Tail)];
+cons_prefix(_) ->
+ [].
+
%% =====================================================================
%% @doc Returns the suffix subtree of a `list' node, if one
@@ -2090,18 +2096,22 @@ list_prefix(Node) ->
list_suffix(Node) ->
case unwrap(Node) of
{cons, _, _, Tail} ->
- %% If there could be comments/annotations on the tail node,
- %% we should not return `none' even if it has type `nil'.
- case Tail of
+ case cons_suffix(Tail) of
{nil, _} ->
- none; % no interesting information is lost
- _ ->
- Tail
+ none;
+ Tail1 ->
+ Tail1
end;
Node1 ->
(data(Node1))#list.suffix
end.
+%% skips sequences of conses; cf. cons_prefix/1 above
+cons_suffix({cons, _, _, Tail}) ->
+ cons_suffix(Tail);
+cons_suffix(Tail) ->
+ Tail.
+
%% =====================================================================
%% @doc "Optimising" list skeleton cons operation. Creates an abstract
--
cgit v1.2.3