module Make: functor (
A
:
sig
end
) ->
sig
.. end
Parameters: |
A |
: |
sig
val env : env;;
val target : Target.target;;
val dir : string;;
val id_format_args : (bool -> Output.id_annot -> Ulib.Text.t -> Output.t) * Ulib.Text.t
end
|
|
val open_to_open_target : Path.t Types.id list -> (Typed_ast.lskips * string) list * Typed_ast.lskips
val function_application_to_output : Ast.l ->
(Typed_ast.exp -> Output.t) ->
bool ->
Typed_ast.exp ->
Types.const_descr_ref Types.id -> Typed_ast.exp list -> bool -> Output.t list
function_application_to_output l exp inf full_exp c_id args
tries to format
a function application as output. It gets an expression full_ex
of the from
c arg1 ... argn
. The id c_id
corresponds to constant c
. The arguments arg1, ... argn
are
handed over as args
. The description corresponding to c
is looked up in A.env
. Depending on
this description and the backend-specific formats therein, the
function and its arguments are formated as output. In the
simplest case the representation is an identifier (Ident.t
),
which is formated using A.id_format_args
and the information,
whether it the whole expression is an infix one inf
. In more complicated
cases, formating of expressions is needed, which is done via the
callback exp
. In particular if some arguments are not needed by
the formating of the function application, the function exp
is
called on these remaining arguments. The original expression full_exp
is
needed, if not enough parameters are present to format the definition correctly.
In this case, eta-expansion is applied and the resulting expression formatting via exp
.
ascii_alternative
denotes whether an ascii alternative representation for this
function name is required.
val pattern_application_to_output : Ast.l ->
(Typed_ast.pat -> Output.t) ->
Types.const_descr_ref Types.id -> Typed_ast.pat list -> bool -> Output.t list
pattern_application_to_output l pat c_id args
tries to
format a function application in a pattern as output. It does otherwise the same as
function_application_to_output. However, since there are no infix patterns, the
parameter inf
is always set to false
.
val const_id_to_ident : Types.const_descr_ref Types.id -> bool -> Ident.t
const_id_to_ident c_id use_ascii
tries to format a constant, constructor or field
c_id
as an identifier for target A.target
using the rules stored
in environment A.env
. If the flag use_ascii
is set, the ascii representation of the
constant should be used, if there is one. Depending on the formating rules for the
constant, const_id_to_ident
might raise an exception.
val const_ref_to_name : Name.lskips_t -> bool -> Types.const_descr_ref -> Name.lskips_t
const_ref_to_name n use_ascii c
tries to format a constant
c
for target A.target
using the rules stored
in environment A.env
. If use_ascii
is set, the ascii-representation is
returned. const_ref_to_name
always returns a name n'
. If special formatting
rules are installed, this name might not be the one used by function_application_to_output
, though.
The argument n
is the name used in the original input. It's whitespace is used to
format n'
.
val type_path_to_name : Name.lskips_t -> Path.t -> Name.lskips_t
type_path_to_name n p
tries to format a type-path
p
for target A.target
using the rules stored
in environment A.env
. It always returns a name n'
. If special formatting
rules are installed, this name might not be the one used by function_application_to_output
, though.
The argument n
is the name used in the original input. It's whitespace is used to
format n'
.
val type_id_to_ident : Path.t Types.id -> Ident.t
type_id_to_ident ty_id
tries to format a type
ty_id
as an identifier for target A.target
using the rules stored
in environment A.env
.
val type_id_to_output : Path.t Types.id -> Output.t
type_id_to_output ty_id
tries to format a type
ty_id
as an identifier for target A.target
using the rules stored
in environment A.env
.
val type_id_to_ident_no_modify : Path.t Types.id -> Ident.t
type_id_to_ident_no_modify ty_id
formats ty_id
as an identifier.
In contrast to type_id_to_ident
neither the target A.target
nor the rules stored
in environment A.env
are used. Instead the type is translated without any
modifications. This method is intended to be used for backend types, which
are already formatted.
val type_app_to_output : (Types.src_t -> Output.t) ->
Path.t Types.id -> Types.src_t list -> Types.src_t list * Output.t
val module_id_to_ident : Path.t Types.id -> Ident.t
module_id_to_ident m_id
tries to format a module
m_id
as an identifier for target A.target
using the rules stored
in environment A.env
.