.TH epp_dodger 3erl "syntax_tools 3.1" "" "Erlang Module Definition" .SH NAME epp_dodger \- epp_dodger - bypasses the Erlang preprocessor. .SH DESCRIPTION .LP \fIepp_dodger\fR\& - bypasses the Erlang preprocessor\&. .LP 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 \fIerl_parse\fR\& module cannot represent these things (normally, they are expanded by the Erlang preprocessor epp(3erl) before the parser sees them), an extended syntax tree is created, using the erl_syntax module\&. .SH "DATA TYPES" .RS 2 .TP 2 .B errorinfo() = erl_scan:error_info(): .TP 2 .B option() = atom() | {atom(), term()}: .RE .SH EXPORTS .LP .B parse(Dev::file:io_device()) -> {ok, erl_syntax:forms()} .br .RS .LP Equivalent to parse(IODevice, 1)\&. .RE .LP .B parse(Dev::file:io_device(), L::erl_anno:location()) -> {ok, erl_syntax:forms()} .br .RS .LP Equivalent to parse(IODevice, StartLocation, [])\&. .LP \fISee also:\fR\& parse/1\&. .RE .LP .B parse(Dev::file:io_device(), L0::erl_anno:location(), Options::[option()]) -> {ok, erl_syntax:forms()} .br .RS .LP Reads and parses program text from an I/O stream\&. Characters are read from \fIIODevice\fR\& until end-of-file; apart from this, the behaviour is the same as for parse_file/2\&. \fIStartLocation\fR\& is the initial location\&. .LP \fISee also:\fR\& parse/2, parse_file/2, parse_form/2, quick_parse/3\&. .RE .LP .B parse_file(File::file:filename()) -> {ok, erl_syntax:forms()} | {error, errorinfo()} .br .RS .LP Equivalent to parse_file(File, [])\&. .RE .LP .B parse_file(File::file:filename(), Options::[option()]) -> {ok, erl_syntax:forms()} | {error, errorinfo()} .br .RS .LP Reads and parses a file\&. If successful, \fI{ok, Forms}\fR\& is returned, where \fIForms\fR\& is a list of abstract syntax trees representing the "program forms" of the file (cf\&. \fIerl_syntax:is_form/1\fR\&)\&. Otherwise, \fI{error, errorinfo()}\fR\& 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 \fI{error, errorinfo()}\fR\&\&. .LP Options: .RS 2 .TP 2 .B \fI{no_fail, boolean()}\fR\&: If \fItrue\fR\&, this makes \fIepp_dodger\fR\& replace any program forms that could not be parsed with nodes of type \fItext\fR\& (see erl_syntax:text/1), representing the raw token sequence of the form, instead of reporting a parse error\&. The default value is \fIfalse\fR\&\&. .TP 2 .B \fI{clever, boolean()}\fR\&: If set to \fItrue\fR\&, this makes \fIepp_dodger\fR\& try to repair the source code as it seems fit, in certain cases where parsing would otherwise fail\&. Currently, it inserts \fI++\fR\&-operators between string literals and macros where it looks like concatenation was intended\&. The default value is \fIfalse\fR\&\&. .RE .LP .LP \fISee also:\fR\& parse/2, quick_parse_file/1, erl_syntax:is_form/1\&. .RE .LP .B 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()} .br .RS .LP Equivalent to parse_form(IODevice, StartLocation, [])\&. .LP \fISee also:\fR\& quick_parse_form/2\&. .RE .LP .B 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()} .br .RS .LP Reads and parses a single program form from an I/O stream\&. Characters are read from \fIIODevice\fR\& 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 \fIparse/3\fR\&, except that the return values also contain the final location given that \fIStartLocation\fR\& is the initial location, and that \fI{eof, Location}\fR\& may be returned\&. .LP \fISee also:\fR\& parse/3, parse_form/2, quick_parse_form/3\&. .RE .LP .B quick_parse(Dev::file:io_device()) -> {ok, erl_syntax:forms()} .br .RS .LP Equivalent to quick_parse(IODevice, 1)\&. .RE .LP .B quick_parse(Dev::file:io_device(), L::erl_anno:location()) -> {ok, erl_syntax:forms()} .br .RS .LP Equivalent to quick_parse(IODevice, StartLocation, [])\&. .LP \fISee also:\fR\& quick_parse/1\&. .RE .LP .B quick_parse(Dev::file:io_device(), L0::erl_anno:location(), Options::[option()]) -> {ok, erl_syntax:forms()} .br .RS .LP Similar to parse/3, but does a more quick-and-dirty processing of the code\&. See quick_parse_file/2 for details\&. .LP \fISee also:\fR\& parse/3, quick_parse/2, quick_parse_file/2, quick_parse_form/2\&. .RE .LP .B quick_parse_file(File::file:filename()) -> {ok, erl_syntax:forms()} | {error, errorinfo()} .br .RS .LP Equivalent to quick_parse_file(File, [])\&. .RE .LP .B quick_parse_file(File::file:filename(), Options::[option()]) -> {ok, erl_syntax:forms()} | {error, errorinfo()} .br .RS .LP 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\&. .LP Options: see parse_file/2\&. Note however that for \fIquick_parse_file/2\fR\&, the option \fIno_fail\fR\& is \fItrue\fR\& by default\&. .LP \fISee also:\fR\& parse_file/2, quick_parse/2\&. .RE .LP .B 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()} .br .RS .LP Equivalent to quick_parse_form(IODevice, StartLocation, [])\&. .LP \fISee also:\fR\& parse_form/2\&. .RE .LP .B 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()} .br .RS .LP Similar to parse_form/3, but does a more quick-and-dirty processing of the code\&. See quick_parse_file/2 for details\&. .LP \fISee also:\fR\& parse/3, parse_form/3, quick_parse_form/2\&. .RE .LP .B tokens_to_string(Ts::[term()]) -> string() .br .RS .LP Generates a string corresponding to the given token sequence\&. The string can be re-tokenized to yield the same token list again\&. .RE .SH AUTHORS .LP Richard Carlsson .I