1erl_anno(3)                Erlang Module Definition                erl_anno(3)
2
3
4

NAME

6       erl_anno  -  Abstract  datatype  for the annotations of the Erlang Com‐
7       piler.
8
9

DESCRIPTION

11       This module provides an abstract type that is used by the  Erlang  Com‐
12       piler and its helper modules for holding data such as column, line num‐
13       ber, and text.  The  data  type  is  a  collection  of  annotations  as
14       described in the following.
15
16       The  Erlang Token Scanner returns tokens with a subset of the following
17       annotations, depending on the options:
18
19         column:
20           The column where the token begins.
21
22         location:
23           The line and column where the token begins, or just the line if the
24           column is unknown.
25
26         text:
27           The token's text.
28
29       From this, the following annotation is derived:
30
31         line:
32           The line where the token begins.
33
34       This  module also supports the following annotations, which are used by
35       various modules:
36
37         file:
38           A filename.
39
40         generated:
41           A Boolean indicating if the abstract  code  is  compiler-generated.
42           The Erlang Compiler does not emit warnings for such code.
43
44         record:
45           A  Boolean  indicating  if  the  origin  of  the abstract code is a
46           record. Used by Dialyzer to assign types to tuple elements.
47
48       The functions column(), end_location(), line(), location(), and  text()
49       in  the  erl_scan  module  can  be  used  for inspecting annotations in
50       tokens.
51
52       The   functions    anno_from_term(),    anno_to_term(),    fold_anno(),
53       map_anno(), mapfold_anno(), and new_anno(), in the erl_parse module can
54       be used for manipulating annotations in abstract code.
55

DATA TYPES

57       anno()
58
59              A collection of annotations.
60
61       anno_term() = term()
62
63              The term representing a collection of annotations. It is  either
64              a location() or a list of key-value pairs.
65
66       column() = integer() >= 1
67
68       line() = integer() >= 0
69
70       location() = line() | {line(), column()}
71
72       text() = string()
73

EXPORTS

75       column(Anno) -> column() | undefined
76
77              Types:
78
79                 Anno = anno()
80                 column() = integer() >= 1
81
82              Returns the column of the annotations Anno.
83
84       end_location(Anno) -> location() | undefined
85
86              Types:
87
88                 Anno = anno()
89                 location() = line() | {line(), column()}
90
91              Returns the end location of the text of the annotations Anno. If
92              there is no text, undefined is returned.
93
94       file(Anno) -> filename() | undefined
95
96              Types:
97
98                 Anno = anno()
99                 filename() = file:filename_all()
100
101              Returns the filename of the annotations Anno.  If  there  is  no
102              filename, undefined is returned.
103
104       from_term(Term) -> Anno
105
106              Types:
107
108                 Term = anno_term()
109                 Anno = anno()
110
111              Returns annotations with representation Term.
112
113              See also to_term().
114
115       generated(Anno) -> generated()
116
117              Types:
118
119                 Anno = anno()
120                 generated() = boolean()
121
122              Returns  true  if  annotations  Anno is marked as generated. The
123              default is to return false.
124
125       is_anno(Term) -> boolean()
126
127              Types:
128
129                 Term = any()
130
131              Returns true if Term is a collection of  annotations,  otherwise
132              false.
133
134       line(Anno) -> line()
135
136              Types:
137
138                 Anno = anno()
139                 line() = integer() >= 0
140
141              Returns the line of the annotations Anno.
142
143       location(Anno) -> location()
144
145              Types:
146
147                 Anno = anno()
148                 location() = line() | {line(), column()}
149
150              Returns the location of the annotations Anno.
151
152       new(Location) -> anno()
153
154              Types:
155
156                 Location = location()
157                 location() = line() | {line(), column()}
158
159              Creates a new collection of annotations given a location.
160
161       set_file(File, Anno) -> Anno
162
163              Types:
164
165                 File = filename()
166                 Anno = anno()
167                 filename() = file:filename_all()
168
169              Modifies the filename of the annotations Anno.
170
171       set_generated(Generated, Anno) -> Anno
172
173              Types:
174
175                 Generated = generated()
176                 Anno = anno()
177                 generated() = boolean()
178
179              Modifies the generated marker of the annotations Anno.
180
181       set_line(Line, Anno) -> Anno
182
183              Types:
184
185                 Line = line()
186                 Anno = anno()
187                 line() = integer() >= 0
188
189              Modifies the line of the annotations Anno.
190
191       set_location(Location, Anno) -> Anno
192
193              Types:
194
195                 Location = location()
196                 Anno = anno()
197                 location() = line() | {line(), column()}
198
199              Modifies the location of the annotations Anno.
200
201       set_record(Record, Anno) -> Anno
202
203              Types:
204
205                 Record = record()
206                 Anno = anno()
207                 record() = boolean()
208
209              Modifies the record marker of the annotations Anno.
210
211       set_text(Text, Anno) -> Anno
212
213              Types:
214
215                 Text = text()
216                 Anno = anno()
217                 text() = string()
218
219              Modifies the text of the annotations Anno.
220
221       text(Anno) -> text() | undefined
222
223              Types:
224
225                 Anno = anno()
226                 text() = string()
227
228              Returns  the  text of the annotations Anno. If there is no text,
229              undefined is returned.
230
231       to_term(Anno) -> anno_term()
232
233              Types:
234
235                 Anno = anno()
236
237              Returns the term representing the annotations Anno.
238
239              See also from_term().
240

SEE ALSO

242       erl_parse(3), erl_scan(3)
243
244
245
246Ericsson AB                      stdlib 3.12.1                     erl_anno(3)
Impressum