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.

Data Types

syntaxTree()

syntaxTree() = erl_syntax:syntaxTree()

An abstract syntax tree. See the erl_syntax module for details.

Function Index

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

Function Details

format/2

format(Tree::syntaxTree(), 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.
{encoding, epp:source_encoding()}
Specifies the encoding of the generated file.

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


Generated by EDoc