Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

erl_pp(3erl) [linux man page]

erl_pp(3erl)						     Erlang Module Definition						      erl_pp(3erl)

NAME
erl_pp - The Erlang Pretty Printer DESCRIPTION
The functions in this module are used to generate aesthetically attractive representations of abstract forms, which are suitable for print- ing. All functions return (possibly deep) lists of characters and generate an error if the form is wrong. All functions can have an optional argument which specifies a hook that is called if an attempt is made to print an unknown form. EXPORTS
form(Form) -> DeepCharList form(Form, HookFunction) -> DeepCharList Types Form = term() HookFunction = see separate description below. DeepCharList = [char()|DeepCharList] Pretty prints a Form which is an abstract form of a type which is returned by erl_parse:parse_form . attribute(Attribute) -> DeepCharList attribute(Attribute, HookFunction) -> DeepCharList Types Attribute = term() HookFunction = see separate description below. DeepCharList = [char()|DeepCharList] The same as form , but only for the attribute Attribute . function(Function) -> DeepCharList function(Function, HookFunction) -> DeepCharList Types Function = term() HookFunction = see separate description below. DeepCharList = [char()|DeepCharList] The same as form , but only for the function Function . guard(Guard) -> DeepCharList guard(Guard, HookFunction) -> DeepCharList Types Form = term() HookFunction = see separate description below. DeepCharList = [char()|DeepCharList] The same as form , but only for the guard test Guard . exprs(Expressions) -> DeepCharList exprs(Expressions, HookFunction) -> DeepCharList exprs(Expressions, Indent, HookFunction) -> DeepCharList Types Expressions = term() HookFunction = see separate description below. Indent = integer() DeepCharList = [char()|DeepCharList] The same as form , but only for the sequence of expressions in Expressions . expr(Expression) -> DeepCharList expr(Expression, HookFunction) -> DeepCharList expr(Expression, Indent, HookFunction) -> DeepCharList expr(Expression, Indent, Precedence, HookFunction) ->-> DeepCharList Types Expression = term() HookFunction = see separate description below. Indent = integer() Precedence = DeepCharList = [char()|DeepCharList] This function prints one expression. It is useful for implementing hooks (see below). UNKNOWN EXPRESSION HOOKS
The optional argument HookFunction , shown in the functions described above, defines a function which is called when an unknown form occurs where there should be a valid expression. It can have the following formats: Function : The hook function is called by: Function(Expr, CurrentIndentation, CurrentPrecedence, HookFunction) none : There is no hook function The called hook function should return a (possibly deep) list of characters. expr/4 is useful in a hook. If CurrentIndentation is negative, there will be no line breaks and only a space is used as a separator. BUGS
It should be possible to have hook functions for unknown forms at places other than expressions. SEE ALSO
io(3erl) , erl_parse(3erl) , erl_eval(3erl) Ericsson AB stdlib 1.17.3 erl_pp(3erl)

Check Out this Related Man Page

epp_dodger(3erl)					     Erlang Module Definition						  epp_dodger(3erl)

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) before the parser sees them), an extended syntax tree is created, using the erl_syntax mod- ule. DATA TYPES
errorinfo() = {ErrorLine::integer(), Module::atom(), Descriptor::term()} : This is a so-called Erlang I/O ErrorInfo structure; see the io(3erl) module for details. EXPORTS
parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()} Equivalent to parse(IODevice, 1) . parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Forms = [syntaxTree() (see module erl_syntax)] Equivalent to parse(IODevice, StartLine, []) . See also: parse/1 . parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Reads and parses program text from an I/O stream. Characters are read from IODevice until end-of-file; apart from this, the behav- iour is the same as for parse_file/2 . StartLine is the initial line number, which should be a positive integer. See also: parse/2 , parse_file/2 , parse_form/2 , quick_parse/3 . parse_file(File) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Forms = [syntaxTree() (see module erl_syntax)] Equivalent to parse_file(File, []) . parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] 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_syn- tax: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 oth- erwise 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::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Form = syntaxTree() (see module erl_syntax) LineNo = integer() Equivalent to parse_form(IODevice, StartLine, []) . See also: quick_parse_form/2 . parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Options = [term()] Form = syntaxTree() (see module erl_syntax) 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/3 , 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/3 , parse_form/2 , quick_parse_form/3 . quick_parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()} Equivalent to quick_parse(IODevice, 1) . quick_parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Forms = [syntaxTree() (see module erl_syntax)] Equivalent to quick_parse(IODevice, StartLine, []) . See also: quick_parse/1 . quick_parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()} Types IODevice = pid() StartLine = integer() Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] 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) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Forms = [syntaxTree() (see module erl_syntax)] Equivalent to quick_parse_file(File, []) . quick_parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()} Types File = filename() (see module file) Options = [term()] Forms = [syntaxTree() (see module erl_syntax)] Similar to parse_file/2 , but does a more quick-and-dirty processing of the code. Macro definitions and other preprocessor direc- tives 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::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Form = syntaxTree() (see module erl_syntax) | none LineNo = integer() Equivalent to quick_parse_form(IODevice, StartLine, []) . See also: parse_form/2 . quick_parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo} Types IODevice = pid() StartLine = integer() Options = [term()] Form = syntaxTree() (see module erl_syntax) LineNo = integer() 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(Tokens::[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 <richardc@it.uu.se > syntax_tools 1.6.7 epp_dodger(3erl)
Man Page