this repo has no description
1(* Env.mli *)
2
3open Odoc_model
4open Odoc_model.Paths
5
6type lookup_unit_result = Forward_reference | Found of Lang.Compilation_unit.t
7
8type path_query = [ `Path of Reference.Hierarchy.t | `Name of string ]
9
10type lookup_error = [ `Not_found ]
11
12type resolver = {
13 open_units : string list;
14 lookup_unit : path_query -> (lookup_unit_result, lookup_error) result;
15 lookup_page : path_query -> (Lang.Page.t, lookup_error) result;
16 lookup_asset : path_query -> (Lang.Asset.t, lookup_error) result;
17 lookup_impl : string -> Lang.Implementation.t option;
18}
19
20type root =
21 | Resolved of (Root.t * Identifier.Module.t * Component.Module.t)
22 | Forward
23
24type lookup_type =
25 | Module of Identifier.Path.Module.t
26 | ModuleType of Identifier.ModuleType.t
27 | RootModule of
28 Odoc_model.Names.ModuleName.t
29 * [ `Forward | `Resolved of Digest.t ] option
30 | ModuleByName of string * Identifier.Path.Module.t
31 | FragmentRoot of int
32
33module LookupTypeSet : Set.S with type elt = lookup_type
34
35val pp_lookup_type_list : Format.formatter -> lookup_type list -> unit
36
37type t
38
39val is_linking : t -> bool
40
41val with_recorded_lookups : t -> (t -> 'a) -> LookupTypeSet.t * 'a
42
43val set_resolver : t -> resolver -> t
44
45val has_resolver : t -> bool
46
47val id : t -> int
48
49val empty : t
50
51val add_fragment_root : Component.Signature.t -> t -> t
52
53val add_module :
54 Identifier.Path.Module.t ->
55 Component.Module.t Component.Delayed.t ->
56 Component.CComment.docs ->
57 t ->
58 t
59
60val add_type : Identifier.Type.t -> Component.TypeDecl.t -> t -> t
61
62val add_module_type :
63 Identifier.Path.ModuleType.t -> Component.ModuleType.t -> t -> t
64
65val add_value : Identifier.Value.t -> Component.Value.t -> t -> t
66
67val add_label : Identifier.Label.t -> Component.Label.t -> t -> unboxed:bool -> t
68
69val add_class : Identifier.Class.t -> Component.Class.t -> t -> t
70
71val add_class_type : Identifier.ClassType.t -> Component.ClassType.t -> t -> t
72
73val add_exception : Identifier.Exception.t -> Component.Exception.t -> t -> t
74
75val add_extension_constructor :
76 Identifier.Extension.t ->
77 Component.Extension.Constructor.t ->
78 Component.Extension.t ->
79 t ->
80 t
81
82val add_docs : Comment.docs -> t -> t
83
84val add_comment : Comment.docs_or_stop -> t -> t
85
86val add_method : Identifier.Method.t -> Component.Method.t -> t -> t
87
88val add_module_functor_args :
89 Component.Module.t -> Identifier.Path.Module.t -> t -> t
90
91val add_module_type_functor_args :
92 Component.ModuleType.t -> Identifier.ModuleType.t -> t -> t
93
94val lookup_fragment_root : t -> (int * Component.Signature.t) option
95
96val lookup_page_by_name : string -> t -> (Lang.Page.t, lookup_error) result
97val lookup_page_by_path :
98 Reference.Hierarchy.t -> t -> (Lang.Page.t, lookup_error) result
99
100val lookup_asset_by_path :
101 Reference.Hierarchy.t -> t -> (Lang.Asset.t, lookup_error) result
102
103val lookup_asset_by_name : string -> t -> (Lang.Asset.t, lookup_error) result
104
105val lookup_impl : string -> t -> Lang.Implementation.t option
106
107val lookup_unit_by_path :
108 Reference.Hierarchy.t -> t -> (Component.Element.module_, lookup_error) result
109
110val module_of_unit : Lang.Compilation_unit.t -> Component.Module.t
111
112val lookup_root_module : Odoc_model.Names.ModuleName.t -> t -> root option
113
114type 'a scope constraint 'a = [< Component.Element.any ]
115(** Target of a lookup *)
116
117type 'a maybe_ambiguous =
118 ('a, [ `Ambiguous of 'a * 'a list | `Not_found ]) result
119
120val lookup_by_name : 'a scope -> string -> t -> 'a maybe_ambiguous
121(** Lookup an element in Env depending on the given [scope]. Return
122 [Error (`Ambiguous _)] when two or more elements match the given scope and
123 name. *)
124
125val lookup_by_id :
126 'a scope -> [< Identifier.t_pv ] Paths.Identifier.id -> t -> 'a option
127(** Like [lookup_by_name] but use an identifier as key. *)
128
129val s_any : Component.Element.any scope
130
131val s_signature : Component.Element.signature scope
132
133val s_module : Component.Element.module_ scope
134
135val s_module_type : Component.Element.module_type scope
136
137val s_type : Component.Element.type_ scope
138
139val s_datatype : Component.Element.datatype scope
140
141val s_class : Component.Element.class_ scope
142
143val s_class_type : Component.Element.class_type scope
144
145val s_value : Component.Element.value scope
146
147val s_label : Component.Element.label scope
148
149val s_constructor : Component.Element.constructor scope
150
151val s_exception : Component.Element.exception_ scope
152
153val s_extension : Component.Element.extension scope
154
155val s_field : Component.Element.field scope
156
157val s_unboxed_field : Component.Element.unboxed_field scope
158
159val s_label_parent : Component.Element.label_parent scope
160
161val s_fragment_type_parent : Component.Element.fragment_type_parent scope
162
163(* val open_component_signature :
164 Paths_types.Identifier.signature -> Component.Signature.t -> t -> t *)
165
166val add_functor_parameter : Lang.FunctorParameter.t -> t -> t
167
168val open_class_signature : Lang.ClassSignature.t -> t -> t
169
170val open_signature : Lang.Signature.t -> t -> t
171
172val open_type_substitution : Lang.TypeDecl.t -> t -> t
173
174val open_module_substitution : Lang.ModuleSubstitution.t -> t -> t
175
176val open_module_type_substitution : Lang.ModuleTypeSubstitution.t -> t -> t
177
178val open_page : Lang.Page.t -> t -> t
179(** Add a page content to the env. *)
180
181val env_of_unit : Lang.Compilation_unit.t -> linking:bool -> resolver -> t
182(** Create a new env with a module initially opened. *)
183
184val env_of_page : Lang.Page.t -> resolver -> t
185(** Create a new env for a page. *)
186
187val env_of_impl : Lang.Implementation.t -> resolver -> t
188(** Create a new env for an implementation. *)
189
190val env_for_reference : resolver -> t
191(** Create a new env for a reference. *)
192
193val env_for_testing : linking:bool -> t
194(** Create a new env for testing purposes *)
195
196val inherit_resolver : t -> t
197(** Create an empty environment reusing the same resolver. *)
198
199val len : int ref
200
201val n : int ref
202
203val should_suppress_warnings : t -> string option -> bool
204
205val set_warnings_tags : t -> string list -> t
206
207val verify_lookups : t -> LookupTypeSet.t -> bool