Module rebar3_prettypr

Rebar3 Pretty Printing of abstract Erlang syntax trees, based on original erl_prettypr.

Description

Rebar3 Pretty Printing of abstract Erlang syntax trees, based on original erl_prettypr.

It was taken verbatim from erl_prettypr and it was modified to meet our specific needs.

This module is a front end to the pretty-printing library module prettypr, for text formatting of abstract syntax trees defined by the module erl_syntax.

Function Index

format/3Prettyprint-formats an abstract Erlang syntax tree as text.

Function Details

format/3

format(Node::erl_syntax:syntaxTree(), EmptyLines::[pos_integer()], Options::[term()]) -> string()

Prettyprint-formats an abstract Erlang syntax tree as text. For example, if you have a .beam file that has been compiled with debug_info, the following should print the source code for the module (as it looks in the debug info representation):

     {ok,{_,[{abstract_code,{_,AC}}]}} =
             beam_lib:chunks("myfile.beam",[abstract_code]),
     io:put_chars(rebar3_prettypr:format(erl_syntax:form_list(AC), [], []))
Available options:
{paper, integer()}
Specifies the preferred maximum number of characters on any line, including indentation. The default value is 80.
{ribbon, integer()}
Specifies the preferred maximum number of characters on any line, not counting indentation. The default value is 65.
{break_indent, integer()}
Specifies the number of spaces to use for breaking indentation. The default value is 4.
{sub_indent, integer()}
Specifies the number of spaces to use for breaking indentation. The default value is 2.
{inline_expressions, boolean()}
Specifies wether multiple sequential expressions within the same clause can be placed in the same line (if paper/ribbon permits). The default value is true.
{encoding, epp:source_encoding()}
Specifies the encoding of the generated file.

See also: erl_syntax, format/1, layout/2.


Generated by EDoc