erl_anno(3erl)
π erl_anno(3erl) β Erlang Module Definition π
π NAME π
erl_anno β the abstract datatype for annotations of the Erlang Compiler, bestie. It's giving compiler-glam, no cap.
β¨ DESCRIPTION β¨
Okay so this module provides an abstract type that the Erlang Compiler and its helper modules use for holding data like column, line number, and text. The data type is a collection of annotations, described right here:
columnβ the column where the token begins.locationβ the line and column where the token begins, or just the line if the column is unknown.textβ the token's text.
The Erlang Token Scanner returns tokens with a subset of those annotations, depending on the options. From this, the following annotation is derived:
lineβ the line where the token begins.
This module also supports the following annotations, which are used by various modules:
fileβ a filename.generatedβ a Boolean indicating if the abstract code is compiler-generated. The Erlang Compiler does not emit warnings for such code.recordβ a Boolean indicating if the origin of the abstract code is a record. Used by Dialyzer to assign types to tuple elements.
The functions column(), end_location(), line(), location(), and text() in the erl_scan module can be used for inspecting annotations in tokens.
The functions anno_from_term(), anno_to_term(), fold_anno(), map_anno(), mapfold_anno(), and new_anno(), in the erl_parse module can be used for manipulating annotations in abstract code.
𧬠DATA TYPES π§¬
anno()β a collection of annotations.anno_term() = term()β the term representing a collection of annotations. It is either alocation()or a list of key-value pairs.column() = integer() >= 1line() = integer() >= 0location() = line() | {line(), column()}text() = string()
π¦ EXPORTS π¦
πΈ column(Anno) -> column() | undefined
Types:
Anno = anno()
column() = integer() >= 1
Returns the column of the annotations Anno. Slay.
π¦ end_location(Anno) -> location() | undefined
Types:
Anno = anno()
location() = line() | {line(), column()}
Returns the end location of the text of the annotations Anno. If there is no text, undefined is returned. Periodt.
π file(Anno) -> filename() | undefined
Types:
Anno = anno()
filename() = file:filename_all()
Returns the filename of the annotations Anno. If there is no filename, undefined is returned.
β from_term(Term) -> Anno
Types:
Term = anno_term()
Anno = anno()
Returns annotations with representation Term.
See also to_term().
π₯ generated(Anno) -> generated()
Types:
Anno = anno()
generated() = boolean()
Returns true if annotations Anno is marked as generated. The default is to return false. Very demure, very mindful.
π is_anno(Term) -> boolean()
Types:
Term = any()
Returns true if Term is a collection of annotations, otherwise false.
π line(Anno) -> line()
Types:
Anno = anno()
line() = integer() >= 0
Returns the line of the annotations Anno.
π§ location(Anno) -> location()
Types:
Anno = anno()
location() = line() | {line(), column()}
Returns the location of the annotations Anno.
π new(Location) -> anno()
Types:
Location = location()
location() = line() | {line(), column()}
Creates a new collection of annotations given a location. Fresh out the box, bestie.
π set_file(File, Anno) -> Anno
Types:
File = filename()
Anno = anno()
filename() = file:filename_all()
Modifies the filename of the annotations Anno.
π set_generated(Generated, Anno) -> Anno
Types:
Generated = generated()
Anno = anno()
generated() = boolean()
Modifies the generated marker of the annotations Anno.
π«Ά set_line(Line, Anno) -> Anno
Types:
Line = line()
Anno = anno()
line() = integer() >= 0
Modifies the line of the annotations Anno.
πΈ set_location(Location, Anno) -> Anno
Types:
Location = location()
Anno = anno()
location() = line() | {line(), column()}
Modifies the location of the annotations Anno.
β¨ set_record(Record, Anno) -> Anno
Types:
Record = record()
Anno = anno()
record() = boolean()
Modifies the record marker of the annotations Anno.
π¦ set_text(Text, Anno) -> Anno
Types:
Text = text()
Anno = anno()
text() = string()
Modifies the text of the annotations Anno.
π text(Anno) -> text() | undefined
Types:
Anno = anno()
text() = string()
Returns the text of the annotations Anno. If there is no text, undefined is returned.
π to_term(Anno) -> anno_term()
Types:
Anno = anno()
Returns the term representing the annotations Anno.
See also from_term().
π SEE ALSO π
π Footer sign-off: Ericsson AB Β· stdlib 4.3.1.3 Β· erl_anno(3erl) Β· the footer has no date field, so I'm not making one up, bestie π
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms