60
60
functions separately unless you have written your own Erlang
65
<name name="error_info"/>
68
<name name="error_description"/>
65
<name>module(AbsForms) -> {ok,Warnings} | {error,Errors,Warnings}</name>
66
<name>module(AbsForms, FileName) -> {ok,Warnings} | {error,Errors,Warnings}</name>
67
<name>module(AbsForms, FileName, CompileOptions) -> {ok,Warnings} | {error,Errors,Warnings}</name>
73
<name name="module" arity="1"/>
74
<name name="module" arity="2"/>
75
<name name="module" arity="3"/>
68
76
<fsummary>Check a module for errors</fsummary>
70
<v>AbsForms = [term()]</v>
71
<v>FileName = FileName2 = atom() | string()</v>
72
<v>Warnings = Errors = [{Filename2,[ErrorInfo]}]</v>
73
<v>ErrorInfo = see separate description below.</v>
74
<v>CompileOptions = [term()]</v>
77
78
<p>This function checks all the forms in a module for errors.
81
<tag><c>{ok,Warnings}</c></tag>
82
<tag><c>{ok,<anno>Warnings</anno>}</c></tag>
83
84
<p>There were no errors in the module.</p>
85
<tag><c>{error,Errors,Warnings}</c></tag>
86
<tag><c>{error,<anno>Errors</anno>,<anno>Warnings</anno>}</c></tag>
87
88
<p>There were errors in the module.</p>
93
94
elements of <c>Options</c> that control the warnings are
94
95
only described in <seealso marker="compiler:compile#erl_lint_options">compile(3)</seealso>.
96
<p>The <c>AbsForms</c> of a module which comes from a file
97
<p>The <c><anno>AbsForms</anno></c> of a module which comes from a file
97
98
that is read through <c>epp</c>, the Erlang pre-processor,
98
99
can come from many files. This means that any references to
99
100
errors must include the file name (see <seealso marker="epp">epp(3)</seealso>, or parser <seealso marker="erl_parse">erl_parse(3)</seealso>).
100
101
The warnings and errors returned have the following format:
102
103
<code type="none">
103
[{FileName2,[ErrorInfo]}] </code>
104
[{<anno>FileName2</anno>,[<anno>ErrorInfo</anno>]}] </code>
104
105
<p>The errors and warnings are listed in the order in which
105
106
they are encountered in the forms. This means that the
106
107
errors from one file may be split into different entries in
111
<name>is_guard_test(Expr) -> bool()</name>
112
<name name="is_guard_test" arity="1"/>
112
113
<fsummary>Test for a guard test</fsummary>
117
<p>This function tests if <c>Expr</c> is a legal guard test.
118
<c>Expr</c> is an Erlang term representing the abstract form
115
<p>This function tests if <c><anno>Expr</anno></c> is a legal guard test.
116
<c><anno>Expr</anno></c> is an Erlang term representing the abstract form
119
117
for the expression. <c>erl_parse:parse_exprs(Tokens)</c> can
120
be used to generate a list of <c>Expr</c>.</p>
118
be used to generate a list of <c><anno>Expr</anno></c>.</p>
124
<name>format_error(ErrorDescriptor) -> Chars</name>
122
<name name="format_error" arity="1"/>
125
123
<fsummary>Format an error descriptor</fsummary>
127
<v>ErrorDescriptor = errordesc()</v>
128
<v>Chars = [char() | Chars]</v>
131
<p>Takes an <c>ErrorDescriptor</c> and returns a string which
125
<p>Takes an <c><anno>ErrorDescriptor</anno></c> and returns a string which
132
126
describes the error or warning. This function is usually
133
127
called implicitly when processing an <c>ErrorInfo</c>
134
128
structure (see below).</p>