# Module epp_dodger

- Function index
- Exported functions

## 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

Exported Functions
format_error/1 | Callback function for formatting error descriptors.
parse/1 | See `parse/2`.
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.

## Exported Functions

### format_error/1

`format_error(term()) -> string()`

Callback function for formatting error descriptors.

### parse/1

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

Equivalent to `parse(IODevice, 1)`.

### parse/2

`parse(IODevice, StartLine) -> {ok, Forms} | {error, ErrorInfo}`

- IODevice = pid()
- StartLine = integer()
- Forms = [erl_syntax:syntaxTree()]
- ErrorInfo = term()

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}`

- File = file:filename()
- Forms = [erl_syntax:syntaxTree()]
- ErrorInfo = term()

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(IODevice, StartLine) -> {ok, Forms, LineNo} | {eof, LineNo} | {error, ErrorInfo, LineNo}`

- IODevice = pid()
- StartLine = integer()
- Forms = [erl_syntax:syntaxTree()]
- ErrorInfo = term()
- LineNo = integer()

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`.