-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhump.mli
92 lines (79 loc) · 2.89 KB
/
hump.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(** Abstraction of *.ml/mli, saved to *.hump files. *)
open Spotlib.Spot
open Utils
open Sig
type path = Sig.out_ident [@@deriving conv{ocaml_of}, typerep]
val string_of_path : path -> string
val format_path : Format.t -> path -> unit
type position = [%import: Lexing.position]
and location = Location.t = { loc_start: position; loc_end: position; loc_ghost: bool }
[@@deriving conv{ocaml_of}, typerep]
type v =
| Def of def
| Aliased of v * v (** [Aliased (v1, v2)]: thing defined originally at v2 is aliased at v1 *)
| Coerced of v * v (** [Coerced (v1, v2)]: [v1] is coerced by [v2] *)
| LocNone
| Prim of string (** ex. "%addint" *)
and def = { kind : k
; path : path
; loc : location
; digest : Digest.t option (** source file digest *)
; doc : string option
}
and id = k * string
and expr =
| EGVar of path
(** Persistent global module *)
| EVar of k * string
(** Variable *)
| EDot of expr * k * string
(** Field access *)
| ELet of bool * (id * expr) list * expr
(** Let binding. The bool indicates recursion. *)
| ESignature of (id * expr) list
(** Signature *)
| EApply of expr * expr
(** Functor application *)
| EFunctor of id * expr option * expr
(** Functor *)
| ECoerce of expr * expr
(** Signature coercion. [ECoerce (m, n)]: [m] is coerced by [n] *)
| EWith of expr * expr
(** Signature constraints. [EWith (m, n)]: module type m = n with ... m must be a subtype of n *)
| EModule of v * expr
(** [module M = ..] *)
| EModtype of v * expr option
(** [module type S = ..] *)
| EType of v * (id * expr) list
(** [type t = ..] *)
| ETypext of v
(** [type t += ..] *)
| EValue of v
(** [val x : ...] *)
| EClass of v * (id * expr) list
(** [class c = object .. end] *)
| EClasstype of v * (id * expr) list
(** [class type ct = object .. end] *)
| EConstructor of v
(** Variant constructor *)
| EField of v
(** Record field *)
| EMethod of v
(** Class method *)
| EUnknownPath of path
(** Unresolved path *)
| EAnnotate of string * expr
(** Annotate a string to an expression, mainly for debugging. *)
| ERecM of id * (id * expr option) list * (id * expr) list
(** Recursive module: [module rec M : sig .. end = struct .. end] *)
| EAddAlias of v * expr
(** [EddAlias (v,e)] explicitly adds [(Aliased (v,_)] *)
| EError of string
[@@deriving conv{ocaml_of}, typerep]
val format : Format.t -> expr -> unit
val get_doc : v -> string option
(** Get the best docstring. *) (* XXX not well tested *)
val get_doc' : v -> string option
(** Get the docstring directly associated this [v]. *) (* XXX not well tested *)
val print_v : Format.t -> v -> unit
(** Human friendly printer of [v] *)