Source file syntaxerr.ml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
type invalid_package_type =
| Parameterized_types
| Constrained_types
| Private_types
| Not_with_type
| Neither_identifier_nor_with_type
| Misplaced_attribute
type error =
Unclosed of Location.t * string * Location.t * string
| Expecting of Location.t * string
| Not_expecting of Location.t * string
| Applicative_path of Location.t
| Variable_in_scope of Location.t * string
| Other of Location.t
| Ill_formed_ast of Location.t * string
| Invalid_package_type of Location.t * invalid_package_type
| Removed_string_set of Location.t
| Missing_unboxed_literal_suffix of Location.t
| Malformed_instance_identifier of Location.t
| Quotation_reserved of Location.t * string
| Unspliceable of Location.t
| Let_mutable_not_allowed_at_structure_level of Location.t
| Let_mutable_not_allowed_in_class_definition of Location.t
| Let_mutable_not_allowed_with_function_bindings of Location.t
| Block_access_bad_paren of Location.t
exception Error of error
exception Escape_error
let location_of_error = function
| Unclosed(l,_,_,_)
| Applicative_path l
| Variable_in_scope(l,_)
| Other l
| Not_expecting (l, _)
| Ill_formed_ast (l, _)
| Invalid_package_type (l, _)
| Expecting (l, _)
| Removed_string_set l -> l
| Missing_unboxed_literal_suffix l -> l
| Malformed_instance_identifier l -> l
| Quotation_reserved (l, _) -> l
| Unspliceable l -> l
| Let_mutable_not_allowed_at_structure_level l -> l
| Let_mutable_not_allowed_in_class_definition l -> l
| Let_mutable_not_allowed_with_function_bindings l -> l
| Block_access_bad_paren l -> l
let ill_formed_ast loc s =
raise (Error (Ill_formed_ast (loc, s)))