---
name: "epp_dodger"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/epp_dodger"
---

# epp\_dodger(3erl)

epp\_dodger - bypasses the Erlang preprocessor.

## NAME

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(3erl)](/epp/3erl.md) before the parser sees them), an extended syntax tree is created, using the erl\_syntax module.

## DATA TYPES

- **errorinfo() = erl\_scan:error\_info():**

  - **option() = atom() \| {atom(), term()}:**

  ## EXPORTS

**parse(Dev::file:io\_device()) -\> {ok, erl\_syntax:forms()}**\

Equivalent to parse(IODevice, 1).

**parse(Dev::file:io\_device(), L::erl\_anno:location()) -\> {ok, erl\_syntax:forms()}**\

Equivalent to parse(IODevice, StartLocation, \[\]).

*See also:* parse/1.

**parse(Dev::file:io\_device(), L0::erl\_anno:location(), Options::\[option()\]) -\> {ok, erl\_syntax:forms()}**\

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/2. *StartLocation* is the initial location.

*See also:* parse/2, parse\_file/2, parse\_form/2, quick\_parse/3.

**parse\_file(File::file:filename()) -\> {ok, erl\_syntax:forms()} \| {error, errorinfo()}**\

Equivalent to parse\_file(File, \[\]).

**parse\_file(File::file:filename(), Options::\[option()\]) -\> {ok, erl\_syntax: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, typically if the file could not be opened. Note that parse errors show up as error markers in the returned list of forms; they do not cause this function to fail or return *{error, errorinfo()}*.

Options:

- ***{no\_fail, boolean()}*:**

  If *true*, this makes *epp\_dodger* replace any program forms that could not be parsed with nodes of type *text* (see erl\_syntax:text/1), representing the raw token sequence of the form, instead of reporting a parse error. The default value is *false*.

- ***{clever, boolean()}*:**

  If set to *true*, this makes *epp\_dodger* try to repair the source code as it seems fit, in certain cases where parsing would otherwise fail. Currently, it inserts *++*-operators between string literals and macros where it looks like concatenation was intended. The default value is *false*.

*See also:* parse/2, quick\_parse\_file/1, erl\_syntax:is\_form/1.

**parse\_form(Dev::file:io\_device(), L0::erl\_anno:location()) -\> {ok, erl\_syntax:forms(), erl\_anno:location()} \| {eof, erl\_anno:location()} \| {error, errorinfo(), erl\_anno:location()}**\

Equivalent to parse\_form(IODevice, StartLocation, \[\]).

*See also:* quick\_parse\_form/2.

**parse\_form(Dev::file:io\_device(), L0::erl\_anno:location(), Options::\[option()\]) -\> {ok, erl\_syntax:forms(), erl\_anno:location()} \| {eof, erl\_anno:location()} \| {error, errorinfo(), erl\_anno:location()}**\

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/3*, except that the return values also contain the final location given that *StartLocation* is the initial location, and that *{eof, Location}* may be returned.

*See also:* parse/3, parse\_form/2, quick\_parse\_form/3.

**quick\_parse(Dev::file:io\_device()) -\> {ok, erl\_syntax:forms()}**\

Equivalent to quick\_parse(IODevice, 1).

**quick\_parse(Dev::file:io\_device(), L::erl\_anno:location()) -\> {ok, erl\_syntax:forms()}**\

Equivalent to quick\_parse(IODevice, StartLocation, \[\]).

*See also:* quick\_parse/1.

**quick\_parse(Dev::file:io\_device(), L0::erl\_anno:location(), Options::\[option()\]) -\> {ok, erl\_syntax:forms()}**\

Similar to parse/3, but does a more quick-and-dirty processing of the code. See quick\_parse\_file/2 for details.

*See also:* parse/3, quick\_parse/2, quick\_parse\_file/2, quick\_parse\_form/2.

**quick\_parse\_file(File::file:filename()) -\> {ok, erl\_syntax:forms()} \| {error, errorinfo()}**\

Equivalent to quick\_parse\_file(File, \[\]).

**quick\_parse\_file(File::file:filename(), Options::\[option()\]) -\> {ok, erl\_syntax:forms()} \| {error, errorinfo()}**\

Similar to parse\_file/2, but does a more quick-and-dirty processing of the code. Macro definitions and other preprocessor directives are discarded, and all macro calls are replaced with atoms. This is useful when only the main structure of the code is of interest, and not the details. Furthermore, the quick-parse method can usually handle more strange cases than the normal, more exact parsing.

Options: see parse\_file/2. Note however that for *quick\_parse\_file/2*, the option *no\_fail* is *true* by default.

*See also:* parse\_file/2, quick\_parse/2.

**quick\_parse\_form(Dev::file:io\_device(), L0::erl\_anno:location()) -\> {ok, erl\_syntax:forms(), erl\_anno:location()} \| {eof, erl\_anno:location()} \| {error, errorinfo(), erl\_anno:location()}**\

Equivalent to quick\_parse\_form(IODevice, StartLocation, \[\]).

*See also:* parse\_form/2.

**quick\_parse\_form(Dev::file:io\_device(), L0::erl\_anno:location(), Options::\[option()\]) -\> {ok, erl\_syntax:forms(), erl\_anno:location()} \| {eof, erl\_anno:location()} \| {error, errorinfo(), erl\_anno:location()}**\

Similar to parse\_form/3, but does a more quick-and-dirty processing of the code. See quick\_parse\_file/2 for details.

*See also:* parse/3, parse\_form/3, quick\_parse\_form/2.

**tokens\_to\_string(Ts::\[term()\]) -\> string()**\

Generates a string corresponding to the given token sequence. The string can be re-tokenized to yield the same token list again.

## AUTHORS

Richard Carlsson *\<carlsson.richard@gmail.com\>*
