Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
erl_pp(3)		   Erlang Module Definition		     erl_pp(3)

NAME
       erl_pp -	The Erlang Pretty Printer

DESCRIPTION
       The functions in	this module are	used to	generate aesthetically attrac-
       tive representations of abstract	forms, which are suitable  for	print-
       ing.  All functions return (possibly deep) lists	of characters and gen-
       erate 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.

DATA TYPES
       hook_function() = none
		       | fun((Expr :: erl_parse:abstract_expr(),
			      CurrentIndentation :: integer(),
			      CurrentPrecedence	:: integer() >=	0,
			      Options :: options()) ->
				 io_lib:chars())

	      The  optional  argument HookFunction, shown in the functions de-
	      scribed below, defines a function	which is called	 when  an  un-
	      known form occurs	where there should be a	valid expression.

	      If HookFunction is equal to 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.

       option()	= {hook, hook_function()}
		| {encoding, latin1 | unicode |	utf8}

       options() = hook_function() | [option()]

EXPORTS
       form(Form) -> io_lib:chars()

       form(Form, Options) -> io_lib:chars()

	      Types:

		 Form =	erl_parse:abstract_form()
		 Options = options()

	      Pretty  prints  a	Form which is an abstract form of a type which
	      is returned by erl_parse:parse_form/1.

       attribute(Attribute) -> io_lib:chars()

       attribute(Attribute, Options) ->	io_lib:chars()

	      Types:

		 Attribute = erl_parse:abstract_form()
		 Options = options()

	      The same as form,	but only for the attribute Attribute.

       function(Function) -> io_lib:chars()

       function(Function, Options) -> io_lib:chars()

	      Types:

		 Function = erl_parse:abstract_form()
		 Options = options()

	      The same as form,	but only for the function Function.

       guard(Guard) -> io_lib:chars()

       guard(Guard, Options) ->	io_lib:chars()

	      Types:

		 Guard = [erl_parse:abstract_expr()]
		 Options = options()

	      The same as form,	but only for the guard test Guard.

       exprs(Expressions) -> io_lib:chars()

       exprs(Expressions, Options) -> io_lib:chars()

       exprs(Expressions, Indent, Options) -> io_lib:chars()

	      Types:

		 Expressions = [erl_parse:abstract_expr()]
		 Indent	= integer()
		 Options = options()

	      The same as form,	but only for the sequence  of  expressions  in
	      Expressions.

       expr(Expression)	-> io_lib:chars()

       expr(Expression,	Options) -> io_lib:chars()

       expr(Expression,	Indent,	Options) -> io_lib:chars()

       expr(Expression,	Indent,	Precedence, Options) ->	io_lib:chars()

	      Types:

		 Expression = erl_parse:abstract_expr()
		 Indent	= integer()
		 Precedence = integer()	>= 0
		 Options = options()

	      This function prints one expression. It is useful	for implement-
	      ing hooks	(see below).

BUGS
       It should be possible to	have  hook  functions  for  unknown  forms  at
       places other than expressions.

SEE ALSO
       io(3), erl_parse(3), erl_eval(3)

Ericsson AB			  stdlib 2.4			     erl_pp(3)

NAME | DESCRIPTION | DATA TYPES | EXPORTS | BUGS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=erl_pp&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help