aboutsummaryrefslogtreecommitdiffhomepage
path: root/parsing/entry.ml
blob: b7c6c23fa6b99faa52e162040886830a5a3bec5c (plain)
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
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2015     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

open Errors
open Util

type 'a t = string

(** Entries are registered with a unique name *)

let entries = ref String.Set.empty

let create name =
  let () =
    if String.Set.mem name !entries then
    anomaly (Pp.str ("Entry " ^ name ^ " already defined"))
  in
  let () = entries := String.Set.add name !entries in
  name

let unsafe_of_name name =
  assert (String.Set.mem name !entries);
  name

let repr s = s