2016-02-18 07:11:59 -08:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* 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. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
1995-08-09 08:06:35 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Identifiers (unique names) *)
|
|
|
|
|
2018-04-09 02:19:23 -07:00
|
|
|
type t
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2016-03-09 02:40:16 -08:00
|
|
|
include Identifiable.S with type t := t
|
|
|
|
(* Notes:
|
|
|
|
- [equal] compares identifiers by name
|
|
|
|
- [compare x y] is 0 if [same x y] is true.
|
|
|
|
- [compare] compares identifiers by binding location
|
|
|
|
*)
|
|
|
|
|
2018-09-14 02:29:21 -07:00
|
|
|
val print_with_scope : Format.formatter -> t -> unit
|
|
|
|
(** Same as {!print} except that it will also add a "[n]" suffix
|
|
|
|
if the scope of the argument is [n]. *)
|
|
|
|
|
2016-03-09 02:40:16 -08:00
|
|
|
|
2018-08-28 09:07:01 -07:00
|
|
|
val create_scoped: scope:int -> string -> t
|
|
|
|
val create_local: string -> t
|
1996-04-22 04:15:41 -07:00
|
|
|
val create_persistent: string -> t
|
2018-08-28 09:07:11 -07:00
|
|
|
val create_predef: string -> t
|
|
|
|
|
2000-05-15 23:27:44 -07:00
|
|
|
val rename: t -> t
|
2018-08-28 09:07:11 -07:00
|
|
|
(** Creates an identifier with the same name as the input, a fresh
|
|
|
|
stamp, and no scope.
|
2020-06-03 02:25:25 -07:00
|
|
|
@raise [Fatal_error] if called on a persistent / predef ident. *)
|
2018-08-28 09:07:11 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
val name: t -> string
|
1995-07-02 09:50:08 -07:00
|
|
|
val unique_name: t -> string
|
2003-05-12 02:09:16 -07:00
|
|
|
val unique_toplevel_name: t -> string
|
1995-05-04 03:15:53 -07:00
|
|
|
val persistent: t -> bool
|
|
|
|
val same: t -> t -> bool
|
2018-08-28 09:07:11 -07:00
|
|
|
(** Compare identifiers by binding location.
|
|
|
|
Two identifiers are the same either if they are both
|
|
|
|
non-persistent and have been created by the same call to
|
2018-09-13 02:41:45 -07:00
|
|
|
[create_*], or if they are both persistent and have the same
|
2018-08-28 09:07:11 -07:00
|
|
|
name. *)
|
|
|
|
|
2016-01-12 09:01:25 -08:00
|
|
|
val compare: t -> t -> int
|
2018-08-05 06:46:32 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
val global: t -> bool
|
2018-08-28 09:07:11 -07:00
|
|
|
val is_predef: t -> bool
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2018-08-28 09:06:45 -07:00
|
|
|
val scope: t -> int
|
|
|
|
|
2018-09-13 02:45:37 -07:00
|
|
|
val lowest_scope : int
|
|
|
|
val highest_scope: int
|
|
|
|
|
2003-05-12 02:34:05 -07:00
|
|
|
val reinit: unit -> unit
|
1996-07-15 09:35:35 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
type 'a tbl
|
|
|
|
(* Association tables from identifiers to type 'a. *)
|
|
|
|
|
|
|
|
val empty: 'a tbl
|
|
|
|
val add: t -> 'a -> 'a tbl -> 'a tbl
|
|
|
|
val find_same: t -> 'a tbl -> 'a
|
2016-10-03 07:02:37 -07:00
|
|
|
val find_name: string -> 'a tbl -> t * 'a
|
|
|
|
val find_all: string -> 'a tbl -> (t * 'a) list
|
2012-10-29 00:54:06 -07:00
|
|
|
val fold_name: (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
|
|
|
|
val fold_all: (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
|
2012-04-10 22:50:08 -07:00
|
|
|
val iter: (t -> 'a -> unit) -> 'a tbl -> unit
|
2018-09-18 06:49:18 -07:00
|
|
|
val remove: t -> 'a tbl -> 'a tbl
|
2014-04-07 08:43:20 -07:00
|
|
|
|
|
|
|
(* Idents for sharing keys *)
|
|
|
|
|
|
|
|
val make_key_generator : unit -> (t -> t)
|