epp_dodger
- bypasses the Erlang preprocessor.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.
format_error/1 | Callback function for formatting error descriptors. |
parse/1 | Equivalent to parse(IODevice, 1). |
parse/2 | Reads and parses program text from an I/O stream. |
parse_file/1 | Reads and parses a file. |
parse_form/2 | Reads and parses a single program form from an I/O stream. |
quick_parse/1 | |
quick_parse/2 | |
quick_parse_file/1 | |
quick_parse_form/2 |
format_error(X1::term()) -> string()
Callback function for formatting error descriptors.
parse(Dev::IODevice) -> {ok, Forms} | {error, ErrorInfo}
Equivalent to parse(IODevice, 1).
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(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(Dev::IODevice, L0::StartLine) -> {ok, Form, 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. If
the scanning/parsing determines that the form should be discarded,
{ok, none, LineNo}
will be returned.
See also: parse/2.