NAME
erl_anno - Abstract datatype for the annotations of the Erlang Compiler.DESCRIPTION
This module provides an abstract type that is used by the Erlang Compiler and its helper modules for holding data such as column, line number, and text. The data type is a collection of annotations as described in the following. The Erlang Token Scanner returns tokens with a subset of the following annotations, depending on the options:- 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.
- line:
- The line where the token begins.
- 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.
DATA TYPES
anno()
A collection of annotations.
anno_term() = term()
The term representing a collection of annotations. It is either a
location() 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.
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.
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.
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.
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
erl_parse(3erl), erl_scan(3erl)stdlib 4.2 | Ericsson AB |