| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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 |
|
| 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) |