.TH epp 3erl "stdlib 1.18.1" "Ericsson AB" "Erlang Module Definition" .SH NAME epp \- An Erlang Code Preprocessor .SH DESCRIPTION .LP The Erlang code preprocessor includes functions which are used by \fIcompile\fR\& to preprocess macros and include files before the actual parsing takes place\&. .SH DATA TYPES .nf \fBmacros()\fR\& = [{atom(), term()}] .br .fi .nf \fBepp_handle()\fR\& = pid() .br .fi .RS .LP Handle to the epp server\&. .RE .SH EXPORTS .LP .nf .B open(FileName, IncludePath) -> .B {ok, Epp} | {error, ErrorDescriptor} .br .fi .br .nf .B open(FileName, IncludePath, PredefMacros) -> .B {ok, Epp} | {error, ErrorDescriptor} .br .fi .br .RS .LP Types: .RS 3 FileName = \fBfile:name()\fR\& .br IncludePath = [DirectoryName :: \fBfile:name()\fR\&] .br PredefMacros = \fBmacros()\fR\& .br Epp = \fBepp_handle()\fR\& .br ErrorDescriptor = term() .br .RE .RE .RS .LP Opens a file for preprocessing\&. .RE .LP .nf .B close(Epp) -> ok .br .fi .br .RS .LP Types: .RS 3 Epp = \fBepp_handle()\fR\& .br .RE .RE .RS .LP Closes the preprocessing of a file\&. .RE .LP .nf .B parse_erl_form(Epp) -> .B {ok, AbsForm} | {eof, Line} | {error, ErrorInfo} .br .fi .br .RS .LP Types: .RS 3 Epp = \fBepp_handle()\fR\& .br AbsForm = \fBerl_parse:abstract_form()\fR\& .br Line = \fBerl_scan:line()\fR\& .br ErrorInfo = \fBerl_scan:error_info()\fR\& | \fBerl_parse:error_info()\fR\& .br .RE .RE .RS .LP Returns the next Erlang form from the opened Erlang source file\&. The tuple \fI{eof, Line}\fR\& is returned at end-of-file\&. The first form corresponds to an implicit attribute \fI-file(File,1)\&.\fR\&, where \fIFile\fR\& is the name of the file\&. .RE .LP .nf .B parse_file(FileName, IncludePath, PredefMacros) -> .B {ok, [Form]} | {error, OpenError} .br .fi .br .RS .LP Types: .RS 3 FileName = \fBfile:name()\fR\& .br IncludePath = [DirectoryName :: \fBfile:name()\fR\&] .br Form = \fBerl_parse:abstract_form()\fR\& .br | {error, ErrorInfo} .br | {eof, Line} .br PredefMacros = \fBmacros()\fR\& .br Line = \fBerl_scan:line()\fR\& .br ErrorInfo = \fBerl_scan:error_info()\fR\& | \fBerl_parse:error_info()\fR\& .br OpenError = \fBfile:posix()\fR\& | badarg | system_limit .br .RE .RE .RS .LP Preprocesses and parses an Erlang source file\&. Note that the tuple \fI{eof, Line}\fR\& returned at end-of-file is included as a "form"\&. .RE .LP .nf .B format_error(ErrorDescriptor) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 ErrorDescriptor = term() .br .RE .RE .RS .LP Takes an \fIErrorDescriptor\fR\& and returns a string which describes the error or warning\&. This function is usually called implicitly when processing an \fIErrorInfo\fR\& structure (see below)\&. .RE .SH "ERROR INFORMATION" .LP The \fIErrorInfo\fR\& mentioned above is the standard \fIErrorInfo\fR\& structure which is returned from all IO modules\&. It has the following format: .LP .nf {ErrorLine, Module, ErrorDescriptor} .fi .LP A string which describes the error is obtained with the following call: .LP .nf Module:format_error(ErrorDescriptor) .fi .SH "SEE ALSO" .LP \fBerl_parse(3erl)\fR\&