Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / testasmcomp / parsecmmaux.ml
blob8c46888c6b67683e40470d9be5ce669a80154c22
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
10 (* *)
11 (***********************************************************************)
13 (* $Id$ *)
15 (* Auxiliary functions for parsing *)
17 type error =
18 Unbound of string
20 exception Error of error
22 let tbl_ident = (Hashtbl.create 57 : (string, Ident.t) Hashtbl.t)
24 let bind_ident s =
25 let id = Ident.create s in
26 Hashtbl.add tbl_ident s id;
29 let find_ident s =
30 try
31 Hashtbl.find tbl_ident s
32 with Not_found ->
33 raise(Error(Unbound s))
35 let unbind_ident id =
36 Hashtbl.remove tbl_ident (Ident.name id)
38 let report_error = function
39 Unbound s ->
40 prerr_string "Unbound identifier "; prerr_string s; prerr_endline "."