blob: ee04c2367d5dde6cb4aa3a74644ecd7d43483684 (
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
31
32
33
34
35
36
37
38
39
40
|
module Message =
struct
type t =
| IllegalCharacter
| SyntaxError
| UnboundVariable
| IllTyped
| CannotInferType
| Bug
let default_severity : t -> Asai.Diagnostic.severity =
function
| IllegalCharacter -> Error
| SyntaxError -> Error
| UnboundVariable -> Error
| IllTyped -> Error
| CannotInferType -> Error
| Bug -> Bug
let short_code : t -> string =
function
(* parser errors *)
| IllegalCharacter -> "E101"
| SyntaxError -> "E102"
(* elaboration errors *)
| UnboundVariable -> "E201"
| IllTyped -> "E202"
| CannotInferType -> "E202"
(* misc *)
| Bug -> "E900"
end
include Asai.Reporter.Make(Message)
let illegal_character ~loc char = fatalf ~loc IllegalCharacter "illegal character '%s'" (Char.escaped char)
let syntax_error ~loc = fatalf ~loc SyntaxError "syntax error"
let unbound_variable id = fatalf UnboundVariable "unbound variable '%a'" Ident.pp id
let expected_universe fmt x = fatalf IllTyped "expected a universe but got %a" fmt x
let bug msg = fatalf Bug msg
|