Module steamroller_algebra

An implementation of "Strictly Pretty" (2000) by Christian Lindig [0].

Description

An implementation of "Strictly Pretty" (2000) by Christian Lindig [0].

Inspired by the Elixir implementation of the same paper in Inspect.Algebra. Thanks to the core team for their hard work!

Includes plenty of Erlang-specific additions.

[0] https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.34.2200

Data Types

doc()

doc() = doc_nil | {doc_cons, doc(), doc()} | {doc_text, binary()} | {doc_nest, integer(), doc()} | {doc_underneath, integer(), doc()} | {doc_break, binary()} | {doc_group, doc(), inherit()} | {doc_force_break, doc()}

inherit()

inherit() = self | inherit

tokens()

tokens() = steamroller_ast:tokens()

Function Index

format_tokens/1
format_tokens/2
from_the_paper/2
generate_doc/1
pretty/1
pretty/2
repeat/2

Function Details

format_tokens/1

format_tokens(Tokens::tokens()) -> binary()

format_tokens/2

format_tokens(Tokens::tokens(), Width::integer()) -> binary()

from_the_paper/2

from_the_paper(Width::integer(), Indent::integer()) -> binary()

generate_doc/1

generate_doc(Tokens::tokens()) -> doc()

pretty/1

pretty(Doc::doc()) -> binary()

pretty/2

pretty(Doc::doc(), Width::integer()) -> binary()

repeat/2

repeat(Bin::binary(), Times::integer()) -> binary()


Generated by EDoc