.TH erl_anno 3erl "stdlib 4.3.1.3" "Ericsson AB" "Erlang Module Definition" .SH NAME erl_anno \- Abstract datatype for the annotations of the Erlang Compiler. .SH DESCRIPTION .LP 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 \fIannotations\fR\& as described in the following\&. .LP The Erlang Token Scanner returns tokens with a subset of the following annotations, depending on the options: .RS 2 .TP 2 .B \fIcolumn\fR\&: The column where the token begins\&. .TP 2 .B \fIlocation\fR\&: The line and column where the token begins, or just the line if the column is unknown\&. .TP 2 .B \fItext\fR\&: The token\&'s text\&. .RE .LP From this, the following annotation is derived: .RS 2 .TP 2 .B \fIline\fR\&: The line where the token begins\&. .RE .LP This module also supports the following annotations, which are used by various modules: .RS 2 .TP 2 .B \fIfile\fR\&: A filename\&. .TP 2 .B \fIgenerated\fR\&: A Boolean indicating if the abstract code is compiler-generated\&. The Erlang Compiler does not emit warnings for such code\&. .TP 2 .B \fIrecord\fR\&: A Boolean indicating if the origin of the abstract code is a record\&. Used by Dialyzer to assign types to tuple elements\&. .RE .LP The functions \fIcolumn()\fR\&, \fIend_location()\fR\&, \fIline()\fR\&, \fIlocation()\fR\&, and \fItext()\fR\& in the \fIerl_scan\fR\& module can be used for inspecting annotations in tokens\&. .LP The functions \fIanno_from_term()\fR\&, \fIanno_to_term()\fR\&, \fIfold_anno()\fR\&, \fImap_anno()\fR\&, \fImapfold_anno()\fR\&, and \fInew_anno()\fR\&, in the \fIerl_parse\fR\& module can be used for manipulating annotations in abstract code\&. .SH DATA TYPES .nf .B anno() .br .fi .RS .LP A collection of annotations\&. .RE .nf \fBanno_term()\fR\& = term() .br .fi .RS .LP The term representing a collection of annotations\&. It is either a \fIlocation()\fR\& or a list of key-value pairs\&. .RE .nf \fBcolumn()\fR\& = integer() >= 1 .br .fi .nf \fBline()\fR\& = integer() >= 0 .br .fi .nf \fBlocation()\fR\& = line() | {line(), column()} .br .fi .nf \fBtext()\fR\& = string() .br .fi .SH EXPORTS .LP .nf .B column(Anno) -> column() | undefined .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBcolumn()\fR\& = integer() >= 1 .fi .br .RE .RE .RS .LP Returns the column of the annotations Anno\&. .RE .LP .nf .B end_location(Anno) -> location() | undefined .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBlocation()\fR\& = line() | {line(), column()} .fi .br .RE .RE .RS .LP Returns the end location of the text of the annotations Anno\&. If there is no text, \fIundefined\fR\& is returned\&. .RE .LP .nf .B file(Anno) -> filename() | undefined .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBfilename()\fR\& = file:filename_all() .fi .br .RE .RE .RS .LP Returns the filename of the annotations Anno\&. If there is no filename, \fIundefined\fR\& is returned\&. .RE .LP .nf .B from_term(Term) -> Anno .br .fi .br .RS .LP Types: .RS 3 Term = anno_term() .br Anno = anno() .br .RE .RE .RS .LP Returns annotations with representation Term\&. .LP See also to_term()\&. .RE .LP .nf .B generated(Anno) -> generated() .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBgenerated()\fR\& = boolean() .fi .br .RE .RE .RS .LP Returns \fItrue\fR\& if annotations Anno is marked as generated\&. The default is to return \fIfalse\fR\&\&. .RE .LP .nf .B is_anno(Term) -> boolean() .br .fi .br .RS .LP Types: .RS 3 Term = any() .br .RE .RE .RS .LP Returns \fItrue\fR\& if Term is a collection of annotations, otherwise \fIfalse\fR\&\&. .RE .LP .nf .B line(Anno) -> line() .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBline()\fR\& = integer() >= 0 .fi .br .RE .RE .RS .LP Returns the line of the annotations Anno\&. .RE .LP .nf .B location(Anno) -> location() .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBlocation()\fR\& = line() | {line(), column()} .fi .br .RE .RE .RS .LP Returns the location of the annotations Anno\&. .RE .LP .nf .B new(Location) -> anno() .br .fi .br .RS .LP Types: .RS 3 Location = location() .br .nf \fBlocation()\fR\& = line() | {line(), column()} .fi .br .RE .RE .RS .LP Creates a new collection of annotations given a location\&. .RE .LP .nf .B set_file(File, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 File = filename() .br Anno = anno() .br .nf \fBfilename()\fR\& = file:filename_all() .fi .br .RE .RE .RS .LP Modifies the filename of the annotations Anno\&. .RE .LP .nf .B set_generated(Generated, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 Generated = generated() .br Anno = anno() .br .nf \fBgenerated()\fR\& = boolean() .fi .br .RE .RE .RS .LP Modifies the generated marker of the annotations Anno\&. .RE .LP .nf .B set_line(Line, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 Line = line() .br Anno = anno() .br .nf \fBline()\fR\& = integer() >= 0 .fi .br .RE .RE .RS .LP Modifies the line of the annotations Anno\&. .RE .LP .nf .B set_location(Location, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 Location = location() .br Anno = anno() .br .nf \fBlocation()\fR\& = line() | {line(), column()} .fi .br .RE .RE .RS .LP Modifies the location of the annotations Anno\&. .RE .LP .nf .B set_record(Record, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 Record = record() .br Anno = anno() .br .nf \fBrecord()\fR\& = boolean() .fi .br .RE .RE .RS .LP Modifies the record marker of the annotations Anno\&. .RE .LP .nf .B set_text(Text, Anno) -> Anno .br .fi .br .RS .LP Types: .RS 3 Text = text() .br Anno = anno() .br .nf \fBtext()\fR\& = string() .fi .br .RE .RE .RS .LP Modifies the text of the annotations Anno\&. .RE .LP .nf .B text(Anno) -> text() | undefined .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .nf \fBtext()\fR\& = string() .fi .br .RE .RE .RS .LP Returns the text of the annotations Anno\&. If there is no text, \fIundefined\fR\& is returned\&. .RE .LP .nf .B to_term(Anno) -> anno_term() .br .fi .br .RS .LP Types: .RS 3 Anno = anno() .br .RE .RE .RS .LP Returns the term representing the annotations Anno\&. .LP See also from_term()\&. .RE .SH "SEE ALSO" .LP \fIerl_parse(3erl)\fR\&, \fIerl_scan(3erl)\fR\&