File: asttypes.ml

package info (click to toggle)
ocamlformat 0.28.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,436 kB
  • sloc: ml: 63,321; pascal: 4,769; lisp: 229; sh: 217; makefile: 121
file content (96 lines) | stat: -rw-r--r-- 2,825 bytes parent folder | download
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
93
94
95
96
(**************************************************************************)
(*                                                                        *)
(*                                 OCaml                                  *)
(*                                                                        *)
(*             Xavier Leroy, projet Cristal, INRIA Rocquencourt           *)
(*                                                                        *)
(*   Copyright 1996 Institut National de Recherche en Informatique et     *)
(*     en Automatique.                                                    *)
(*                                                                        *)
(*   All rights reserved.  This file is distributed under the terms of    *)
(*   the GNU Lesser General Public License version 2.1, with the          *)
(*   special exception on linking described in the file LICENSE.          *)
(*                                                                        *)
(**************************************************************************)

(** Auxiliary AST types used by parsetree and typedtree.

  {b Warning:} this module is unstable and part of
  {{!Compiler_libs}compiler-libs}.

*)

type 'a loc = 'a Location.loc = {
  txt : 'a;
  loc : Location.t;
}

type constant =
    Const_int of int
  | Const_char of char
  | Const_string of string * Location.t * string option
  | Const_float of string
  | Const_int32 of int32
  | Const_int64 of int64
  | Const_nativeint of nativeint

type rec_flag = Nonrecursive | Recursive

type direction_flag = Upto | Downto

(* Order matters, used in polymorphic comparison *)
type private_flag = Private of Location.t | Public

type mutable_flag = Immutable | Mutable of Location.t

type atomic_flag = Nonatomic | Atomic of Location.t

type virtual_flag = Virtual of Location.t | Concrete

type private_virtual = {pv_priv: Location.t option; pv_virt: Location.t option}

type mutable_virtual = {mv_mut: Location.t option; mv_virt: Location.t option}

type override_flag = Override | Fresh

type closed_flag = Closed | Open

type obj_closed_flag =
  | OClosed
  | OOpen of Location.t

type label = string

type arg_label =
    Nolabel
  | Labelled of string loc (** [label:T -> ...] *)
  | Optional of string loc (** [?label:T -> ...] *)

(* Moved to the top of the file
type 'a loc = 'a Location.loc = {
  txt : 'a;
  loc : Location.t;
}
*)

type variant_var = string loc loc  (** [`A] *)

type variance_and_injectivity = string loc list
(*
type variance =
  | Covariant
  | Contravariant
  | NoVariance
  | Bivariant

type injectivity =
  | Injective
  | NoInjectivity
*)
let string_of_label = function
    Nolabel -> ""
  | Labelled s -> s.txt
  | Optional s -> "?"^s.txt

(* For Pexp_indexop_access *)
type paren_kind = Paren | Brace | Bracket