thrift_generator_emitter_syntax (thrift_generator v0.7.0)

View Source

The erl_syntax helper layer the emitters build forms with: module headers, attributes, function forms, -doc attributes, literal terms and the rendering to source text.

Everything here is pure and descriptor-free — no #tg_* records and no resolution context — so the core emitter and the service emitter share one vocabulary for building and printing abstract forms. Callback and spec attributes carry raw erl_parse type nodes (erl_prettypr cannot lay them), so those are rendered as raw forms (erl_pp), while everything else stays trees.

Summary

Functions

abstract/1

-spec abstract(term()) -> erl_syntax:syntaxTree().

application(Module, Name, Args)

-spec application(module(), atom(), [erl_syntax:syntaxTree()]) -> erl_syntax:syntaxTree().

attribute(Name, Payload)

-spec attribute(atom(), term() | erl_syntax:syntaxTree()) -> erl_syntax:syntaxTree().

base_erlang_type/1

-spec base_erlang_type(atom()) -> erl_syntax:syntaxTree().

doc_form(IdlDoc, BuiltIn)

-spec doc_form(binary() | undefined, binary()) -> erl_syntax:forms().

error_term_type(Anno)

-spec error_term_type(erl_anno:anno()) -> erl_syntax:syntaxTree().

export_form(Entries)

-spec export_form([{atom(), arity()}]) -> erl_syntax:syntaxTree().

export_type_form(Entries)

-spec export_type_form([{atom(), arity()}]) ->
                          {attribute, erl_anno:anno(), export_type, [{atom(), arity()}]}.

exports_forms/1

-spec exports_forms([{atom(), arity()}]) -> erl_syntax:forms().

fn_clause(Patterns, Body)

fn_form(Name, Clauses)

-spec fn_form(atom(), [erl_syntax:syntaxTree()]) -> erl_syntax:forms().

format(Forms)

-spec format(erl_syntax:forms()) -> binary().

fun_type(ParamTypes, RetType)

function_atom(Name)

-spec function_atom(binary()) -> atom().

header(ModuleName, SourcePath)

-spec header(module(), binary()) -> erl_syntax:forms().

map_field(Key, Value)

-spec map_field(atom(), erl_syntax:syntaxTree()) -> erl_syntax:syntaxTree().

moduledoc_form(Doc)

-spec moduledoc_form(binary()) -> erl_syntax:forms().

nowarn_unused_record_form()

-spec nowarn_unused_record_form() -> erl_syntax:syntaxTree().

ok_error_type(Anno, OkInner, ErrorArm)

raw_type/1

-spec raw_type(atom()) -> erl_syntax:syntaxTree().

remote_type(Module, Name)

-spec remote_type(module(), atom()) -> erl_syntax:syntaxTree().

section_form(Label)

-spec section_form(string()) -> erl_syntax:syntaxTree().

term_type()

-spec term_type() -> erl_syntax:syntaxTree().

undefined_union(Type)

-spec undefined_union(erl_syntax:syntaxTree()) -> erl_syntax:syntaxTree().

user_type(Name)

-spec user_type(atom()) -> erl_syntax:syntaxTree().

var_fun()

-spec var_fun() -> fun((string()) -> erl_syntax:syntaxTree()).

wildcard()

-spec wildcard() -> erl_syntax:syntaxTree().