Module epp_dodger

epp_dodger - bypasses the Erlang preprocessor.

Description

epp_dodger - bypasses the Erlang preprocessor.

This module tokenises and parses most Erlang source code without expanding preprocessor directives and macro applications, as long as these are syntactically "well-behaved". Because the normal parse trees of the erl_parse module cannot represent these things (normally, they are expanded by the Erlang preprocessor "epp" before the parser sees them), an extended syntax tree is created, using the erl_syntax module.

Function Index

format_error/1Callback function for formatting error descriptors.
parse/1

Equivalent to parse(IODevice, 1).

parse/2Reads and parses program text from an I/O stream.
parse_file/1Reads and parses a file.
parse_form/2Reads and parses a single program form from an I/O stream.

Function Details

format_error/1

format_error(X1::term()) -> string()

Callback function for formatting error descriptors.

parse/1

parse(Dev::IODevice) -> {ok, Forms} | {error, ErrorInfo}

Equivalent to parse(IODevice, 1).

parse/2

parse(Dev::IODevice, L0::StartLine) -> {ok, Forms} | {error, ErrorInfo}

Reads and parses program text from an I/O stream. Characters are read from IODevice until end-of-file; apart from this, the behaviour is the same as for parse_file/1. StartLine is the initial line number, which should be a positive integer.

See also: parse_file/1.

parse_file/1

parse_file(File) -> {ok, Forms} | {error, ErrorInfo}

Reads and parses a file. If successful, {ok, Forms} is returned, where Forms is a list of abstract syntax trees representing the "program forms" of the file (cf. erl_syntax:is_form/1). Otherwise, {error, ErrorInfo} is returned, where ErrorInfo is an Erlang I/O ErrorInfo structure (see module io.)

See also: io, erl_syntax:is_form/1.

parse_form/2

parse_form(Dev::IODevice, L0::StartLine) -> {ok, Forms, LineNo} | {eof, LineNo} | {error, ErrorInfo, LineNo}

Reads and parses a single program form from an I/O stream. Characters are read from IODevice until an end-of-form marker is found (a period character followed by whitespace), or until end-of-file; apart from this, the behaviour is similar to that of parse/2, except that the return values also contain the final line number, given that StartLine is the initial line number, and that {eof, LineNo} may be returned.

See also: parse/2.