Skip to content

Commit f2e240b

Browse files
authored
Remove ml parsing tests and conversion .ml to .res. (#6848)
* Remove `.ml` parsing tests. * Remove `.ml` conversion. * cleanup * Update CHANGELOG.md * Update input.js
1 parent 88f63f3 commit f2e240b

25 files changed

+15
-1094
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- Drop Node.js version <18 support, due to it reaching End-of-Life. https://github.com/rescript-lang/rescript-compiler/pull/6429
2929
- Remove deprecated -bs-super-errors option. https://github.com/rescript-lang/rescript-compiler/pull/6814
3030
- Some global names and old keywords are no longer prefixed. https://github.com/rescript-lang/rescript-compiler/pull/6831
31+
- Remove ml parsing tests and conversion from `.ml` to `.res` via format. https://github.com/rescript-lang/rescript-compiler/pull/6848
3132

3233
#### :bug: Bug Fix
3334

cli/rescript_format.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var specs = [
3232
[
3333
"-stdin",
3434
{ kind: "String", data: { kind: "String_set", data: stdin } },
35-
`[.res|.resi|.ml|.mli] Read the code from stdin and print
35+
`[.res|.resi] Read the code from stdin and print
3636
the formatted code to stdout in ReScript syntax`,
3737
],
3838
[
@@ -46,7 +46,7 @@ the formatted code to stdout in ReScript syntax`,
4646
"Check formatting for file or the whole project. Use `-all` to check the whole project",
4747
],
4848
];
49-
var formattedStdExtensions = [".res", ".resi", ".ml", ".mli"];
49+
var formattedStdExtensions = [".res", ".resi"];
5050
var formattedFileExtensions = [".res", ".resi"];
5151

5252
/**

jscomp/bsc/rescript_compiler_main.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ let format_file input =
195195
let ext = Ext_file_extensions.classify_input (Ext_filename.get_extension_maybe input) in
196196
let syntax =
197197
match ext with
198-
| Ml | Mli -> `ml
199198
| Res | Resi -> `res
200199
| _ -> Bsc_args.bad_arg ("don't know what to do with " ^ input) in
201200
let formatted = Res_multi_printer.print ~ignore_parse_errors:!Clflags.ignore_parse_errors syntax ~input in

jscomp/build_tests/cli_help/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const formatHelp =
5353
"`rescript format` formats the current directory\n" +
5454
"\n" +
5555
"Options:\n" +
56-
" -stdin [.res|.resi|.ml|.mli] Read the code from stdin and print\n" +
56+
" -stdin [.res|.resi] Read the code from stdin and print\n" +
5757
" the formatted code to stdout in ReScript syntax\n" +
5858
" -all Format the whole project \n" +
5959
" -check Check formatting for file or the whole project. Use `-all` to check the whole project\n";

jscomp/syntax/cli/res_cli.ml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ module ResClflags : sig
159159
val recover : bool ref
160160
val print : string ref
161161
val width : int ref
162-
val origin : string ref
163162
val file : string ref
164163
val interface : bool ref
165164
val jsx_version : int ref
@@ -173,7 +172,6 @@ end = struct
173172
let width = ref 100
174173

175174
let print = ref "res"
176-
let origin = ref ""
177175
let interface = ref false
178176
let jsx_version = ref (-1)
179177
let jsx_module = ref "react"
@@ -194,9 +192,6 @@ end = struct
194192
let spec =
195193
[
196194
("-recover", Arg.Unit (fun () -> recover := true), "Emit partial ast");
197-
( "-parse",
198-
Arg.String (fun txt -> origin := txt),
199-
"Parse ml or res. Default: res" );
200195
( "-print",
201196
Arg.String (fun txt -> print := txt),
202197
"Print either binary, ml, ast, sexp, comments or res. Default: res" );
@@ -229,26 +224,14 @@ module CliArgProcessor = struct
229224
type backend = Parser : 'diagnostics Res_driver.parsing_engine -> backend
230225
[@@unboxed]
231226

232-
let process_file ~is_interface ~width ~recover ~origin ~target ~jsx_version
227+
let process_file ~is_interface ~width ~recover ~target ~jsx_version
233228
~jsx_module ~jsx_mode ~typechecker filename =
234229
let len = String.length filename in
235230
let process_interface =
236231
is_interface
237232
|| (len > 0 && (String.get [@doesNotRaise]) filename (len - 1) = 'i')
238233
in
239-
let parsing_engine =
240-
match origin with
241-
| "ml" -> Parser Res_driver_ml_parser.parsing_engine
242-
| "res" -> Parser Res_driver.parsing_engine
243-
| "" -> (
244-
match Filename.extension filename with
245-
| ".ml" | ".mli" -> Parser Res_driver_ml_parser.parsing_engine
246-
| _ -> Parser Res_driver.parsing_engine)
247-
| origin ->
248-
print_endline
249-
("-parse needs to be either ml or res. You provided " ^ origin);
250-
exit 1
251-
in
234+
let parsing_engine = Parser Res_driver.parsing_engine in
252235
let print_engine =
253236
match target with
254237
| "binary" -> Res_driver_binary.print_engine
@@ -313,8 +296,7 @@ let () =
313296
ResClflags.parse ();
314297
CliArgProcessor.process_file ~is_interface:!ResClflags.interface
315298
~width:!ResClflags.width ~recover:!ResClflags.recover
316-
~target:!ResClflags.print ~origin:!ResClflags.origin
317-
~jsx_version:!ResClflags.jsx_version ~jsx_module:!ResClflags.jsx_module
318-
~jsx_mode:!ResClflags.jsx_mode ~typechecker:!ResClflags.typechecker
319-
!ResClflags.file)
299+
~target:!ResClflags.print ~jsx_version:!ResClflags.jsx_version
300+
~jsx_module:!ResClflags.jsx_module ~jsx_mode:!ResClflags.jsx_mode
301+
~typechecker:!ResClflags.typechecker !ResClflags.file)
320302
[@@raises exit]

0 commit comments

Comments
 (0)