Skip to content

Commit 5bd99ff

Browse files
committed
Remove unused stuff from Syntaxerr module
1 parent d240933 commit 5bd99ff

File tree

2 files changed

+2
-79
lines changed

2 files changed

+2
-79
lines changed

compiler/ml/syntaxerr.ml

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,66 +15,6 @@
1515

1616
(* Auxiliary type for reporting syntax errors *)
1717

18-
type error =
19-
| Unclosed of Location.t * string * Location.t * string
20-
| Expecting of Location.t * string
21-
| Not_expecting of Location.t * string
22-
| Applicative_path of Location.t
23-
| Variable_in_scope of Location.t * string
24-
| Other of Location.t
25-
| Ill_formed_ast of Location.t * string
26-
| Invalid_package_type of Location.t * string
18+
type error = Variable_in_scope of Location.t * string
2719

2820
exception Error of error
29-
exception Escape_error
30-
31-
let prepare_error = function
32-
| Unclosed (opening_loc, opening, closing_loc, closing) ->
33-
Location.errorf ~loc:closing_loc
34-
~sub:
35-
[
36-
Location.errorf ~loc:opening_loc "This '%s' might be unmatched" opening;
37-
]
38-
~if_highlight:
39-
(Printf.sprintf
40-
"Syntax error: '%s' expected, the highlighted '%s' might be \
41-
unmatched"
42-
closing opening)
43-
"Syntax error: '%s' expected" closing
44-
| Expecting (loc, nonterm) ->
45-
Location.errorf ~loc "Syntax error: %s expected." nonterm
46-
| Not_expecting (loc, nonterm) ->
47-
Location.errorf ~loc "Syntax error: %s not expected." nonterm
48-
| Applicative_path loc ->
49-
Location.errorf ~loc
50-
"Syntax error: applicative paths of the form F(X).t are not supported \
51-
when the option -no-app-func is set."
52-
| Variable_in_scope (loc, var) ->
53-
Location.errorf ~loc
54-
"In this scoped type, variable '%s is reserved for the local type %s." var
55-
var
56-
| Other loc -> Location.errorf ~loc "Syntax error"
57-
| Ill_formed_ast (loc, s) ->
58-
Location.errorf ~loc "broken invariant in parsetree: %s" s
59-
| Invalid_package_type (loc, s) ->
60-
Location.errorf ~loc "invalid package type: %s" s
61-
62-
let () =
63-
Location.register_error_of_exn (function
64-
| Error err -> Some (prepare_error err)
65-
| _ -> None)
66-
67-
let report_error ppf err = Location.report_error ppf (prepare_error err)
68-
69-
let location_of_error = function
70-
| Unclosed (l, _, _, _)
71-
| Applicative_path l
72-
| Variable_in_scope (l, _)
73-
| Other l
74-
| Not_expecting (l, _)
75-
| Ill_formed_ast (l, _)
76-
| Invalid_package_type (l, _)
77-
| Expecting (l, _) ->
78-
l
79-
80-
let ill_formed_ast loc s = raise (Error (Ill_formed_ast (loc, s)))

compiler/ml/syntaxerr.mli

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,6 @@
1515

1616
(** Auxiliary type for reporting syntax errors *)
1717

18-
open Format
19-
20-
type error =
21-
| Unclosed of Location.t * string * Location.t * string
22-
| Expecting of Location.t * string
23-
| Not_expecting of Location.t * string
24-
| Applicative_path of Location.t
25-
| Variable_in_scope of Location.t * string
26-
| Other of Location.t
27-
| Ill_formed_ast of Location.t * string
28-
| Invalid_package_type of Location.t * string
18+
type error = Variable_in_scope of Location.t * string
2919

3020
exception Error of error
31-
exception Escape_error
32-
33-
val report_error : formatter -> error -> unit
34-
(** @deprecated Use {!Location.error_of_exn}, {!Location.report_error}. *)
35-
36-
val location_of_error : error -> Location.t
37-
val ill_formed_ast : Location.t -> string -> 'a

0 commit comments

Comments
 (0)