From 229d0d8ca88bc344bed89e46541b325c1d267996 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 6 May 2011 15:58:09 +0200 Subject: r Use Erlang specs and types for documentation --- lib/stdlib/doc/src/erl_pp.xml | 123 +++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 80 deletions(-) (limited to 'lib/stdlib/doc/src/erl_pp.xml') diff --git a/lib/stdlib/doc/src/erl_pp.xml b/lib/stdlib/doc/src/erl_pp.xml index 1fdda48893..57b5828bcd 100644 --- a/lib/stdlib/doc/src/erl_pp.xml +++ b/lib/stdlib/doc/src/erl_pp.xml @@ -43,125 +43,88 @@

All functions can have an optional argument which specifies a hook that is called if an attempt is made to print an unknown form.

+ + + + +

The optional argument + HookFunction, shown in the functions described below, + defines a function which is called when an unknown 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.

+
+
+
- form(Form) -> DeepCharList - form(Form, HookFunction) -> DeepCharList + + Pretty print a form - - 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.

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

- attribute(Attribute) -> DeepCharList - attribute(Attribute, HookFunction) -> DeepCharList + + Pretty print an attribute - - Attribute = term() - HookFunction = see separate description below. - DeepCharList = [char()|DeepCharList] -

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

+ Attribute.

- function(Function) -> DeepCharList - function(Function, HookFunction) -> DeepCharList + + Pretty print a function - - Function = term() - HookFunction = see separate description below. - DeepCharList = [char()|DeepCharList] -

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

+ Function.

- guard(Guard) -> DeepCharList - guard(Guard, HookFunction) -> DeepCharList + + Pretty print a guard - - Form = term() - HookFunction = see separate description below. - DeepCharList = [char()|DeepCharList] -

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

+ Guard.

- exprs(Expressions) -> DeepCharList - exprs(Expressions, HookFunction) -> DeepCharList - exprs(Expressions, Indent, HookFunction) -> DeepCharList + + + Pretty print Expressions - - 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.

+ expressions in Expressions.

- expr(Expression) -> DeepCharList - expr(Expression, HookFunction) -> DeepCharList - expr(Expression, Indent, HookFunction) -> DeepCharList - expr(Expression, Indent, Precedence, HookFunction) ->-> DeepCharList + + + + Pretty print one Expression - - 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 -- cgit v1.2.3