package merlin-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c5e91975f3df56849e1b306f356c31709a2b139d7d57634b8d21e473266fcf2d
sha512=1d2db379b496dc0b95874f312011cce1a48f6808e098f1aff768de0eef0caff222adc17ab61b85c7aac8d889bf9d829fb5d0211267c7a85572ce201c1cbcb990
doc/merlin-lib.ocaml_typing/Ocaml_typing/Cmt_format/index.html
Module Ocaml_typing.Cmt_formatSource
cmt and cmti files format.
The layout of a cmt file is as follows: <cmt> := {<cmi>} <cmt magic> {cmt infos} {<source info>} where <cmi> is the cmi file format: <cmi> := <cmi magic> <cmi info>. More precisely, the optional <cmi> part must be present if and only if the file is:
- a cmti, or
- a cmt, for a ml file which has no corresponding mli (hence no corresponding cmti).
Thus, we provide a common reading function for cmi and cmt(i) files which returns an option for each of the three parts: cmi info, cmt info, source info.
type binary_annots = | Packed of Types.signature * string list| Implementation of Typedtree.structure| Interface of Typedtree.signature| Partial_implementation of binary_part array| Partial_interface of binary_part array
and binary_part = | Partial_structure of Typedtree.structure| Partial_structure_item of Typedtree.structure_item| Partial_expression of Typedtree.expression| Partial_pattern : 'k Typedtree.pattern_category * 'k Typedtree.general_pattern -> binary_part| Partial_class_expr of Typedtree.class_expr| Partial_signature of Typedtree.signature| Partial_signature_item of Typedtree.signature_item| Partial_module_type of Typedtree.module_type
type cmt_infos = {cmt_modname : Merlin_utils.Misc.modname;cmt_annots : binary_annots;cmt_value_dependencies : (Types.value_description * Types.value_description) list;cmt_comments : (string * Ocaml_parsing.Location.t) list;cmt_args : string array;cmt_sourcefile : string option;cmt_builddir : string;cmt_loadpath : string list;cmt_source_digest : string option;cmt_initial_env : Env.t;cmt_imports : Merlin_utils.Misc.crcs;cmt_interface_digest : Digest.t option;cmt_use_summaries : bool;cmt_uid_to_loc : Ocaml_parsing.Location.t Shape.Uid.Tbl.t;cmt_impl_shape : Shape.t option;
}read filename opens filename, and extract both the cmi_infos, if it exists, and the cmt_infos, if it exists. Thus, it can be used with .cmi, .cmt and .cmti files.
.cmti files always contain a cmi_infos at the beginning. .cmt files only contain a cmi_infos at the beginning if there is no associated .cmti file.
val save_cmt :
string ->
string ->
binary_annots ->
string option ->
Env.t ->
Cmi_format.cmi_infos option ->
Shape.t option ->
unitsave_cmt filename modname binary_annots sourcefile initial_env cmi writes a cmt(i) file.