2015 2016 Ericsson AB, All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. The Initial Developer of the Original Code is Ericsson AB. erl_anno Hans Bolinder Kenneth Lundin 1 2015-02-26 A erl_anno.xml
erl_anno Abstract datatype for the annotations of the Erlang Compiler.

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.

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.

anno()

A collection of annotations.

The term representing a collection of annotations. It is either a location() or a list of key-value pairs.

Return the column.

Returns the column of the annotations Anno.

Return the end location of the text.

Returns the end location of the text of the annotations Anno. If there is no text, undefined is returned.

Return the filename.

Returns the filename of the annotations Anno. If there is no filename, undefined is returned.

Return annotations given a term.

Returns annotations with representation Term.

See also to_term().

Return the generated Boolean.

Returns true if annotations Anno is marked as generated. The default is to return false.

Test for a collection of annotations.

Returns true if Term is a collection of annotations, otherwise false.

Return the line.

Returns the line of the annotations Anno.

Return the location.

Returns the location of the annotations Anno.

Create a new collection of annotations.

Creates a new collection of annotations given a location.

Modify the filename.

Modifies the filename of the annotations Anno.

Modify the generated marker.

Modifies the generated marker of the annotations Anno.

Modify the line.

Modifies the line of the annotations Anno.

Modify the location.

Modifies the location of the annotations Anno.

Modify the record marker.

Modifies the record marker of the annotations Anno.

Modify the text.

Modifies the text of the annotations Anno.

Return the text.

Returns the text of the annotations Anno. If there is no text, undefined is returned.

Return the term representing a collection of annotations.

Returns the term representing the annotations Anno.

See also from_term().

See Also

erl_parse(3), erl_scan(3)