Debian Codegraph @

tools/coqdep/lib/error.ml

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 exception CannotParseFile of string * (int * int)
12 exception CannotParseProjectFile of string * string
13
14 exception CannotOpenFile of string * string
15 exception CannotOpenProjectFile of string
16
17
18 let () = CErrors.register_handler @@ function
19 | CannotParseFile (s,(i,j)) ->
20 Some Pp.(str "File \"" ++ str s ++ str "\"," ++ str "characters" ++ spc ()
21 ++ int i ++ str "-" ++ int j ++ str ":" ++ spc () ++ str "Syntax error")
22
23 | CannotParseProjectFile (file, msg) ->
24 Some Pp.(str "Project file" ++ spc () ++ str "\"" ++ str file ++ str "\":" ++ spc ()
25 ++ str "Syntax error:" ++ str msg)
26
27 | CannotOpenFile (s, msg) ->
28 Some Pp.(str s ++ str ":" ++ spc () ++ str msg)
29
30 | CannotOpenProjectFile msg ->
31 (* TODO: more info? *)
32 Some Pp.(str msg)
33
34 | _ -> None
35
36 let cannot_parse s ij = raise @@ CannotParseFile (s, ij)
37 let cannot_open_project_file msg = raise @@ CannotOpenProjectFile msg
38 let cannot_parse_project_file file msg = raise @@ CannotParseProjectFile (file, msg)
39 let cannot_open s msg = raise @@ CannotOpenFile (s, msg)