diff --git a/src/driver.ml b/src/driver.ml index e9a66cc2..b41f8fd9 100644 --- a/src/driver.ml +++ b/src/driver.ml @@ -913,7 +913,7 @@ let load_source_file fn = type output_mode = | Pretty_print - | Pp_simple + | Pp_ast | Dump_ast | Dparsetree | Reconcile of Reconcile.mode @@ -1150,7 +1150,7 @@ let process_file (kind : Kind.t) fn ~input_name ~relocate ~output_mode Ast_io.write oc { input_name; input_version; ast } ~add_ppx_context:true) - | Pp_simple -> + | Pp_ast -> with_output output ~binary:false ~f:(fun oc -> let ppf = Stdlib.Format.formatter_of_out_channel oc in let ast = add_cookies ast in @@ -1200,12 +1200,12 @@ let set_output_mode mode = match (!output_mode, mode) with | Pretty_print, _ -> output_mode := mode | _, Pretty_print -> assert false - | Dump_ast, Dump_ast | Pp_simple, Pp_simple | Dparsetree, Dparsetree -> () + | Dump_ast, Dump_ast | Pp_ast, Pp_ast | Dparsetree, Dparsetree -> () | Reconcile a, Reconcile b when Poly.equal a b -> () | x, y -> let arg_of_output_mode = function | Pretty_print -> assert false - | Pp_simple -> "-pp-simple" + | Pp_ast -> "-pp-ast" | Dump_ast -> "-dump-ast" | Dparsetree -> "-dparsetree" | Reconcile Using_line_directives -> "-reconcile" @@ -1353,13 +1353,13 @@ let standalone_args = Arg.Unit (fun () -> set_output_mode Dump_ast), " Dump the marshaled ast to the output file instead of pretty-printing it" ); - ( "-pp-simple", - Arg.Unit (fun () -> set_output_mode Pp_simple), + ( "-pp-ast", + Arg.Unit (fun () -> set_output_mode Pp_ast), " Pretty-print a simple version of the AST using the internal Pp_ast \ module. This is useful for comparing ASTs. For more configuration see \ the ppxlib-tools package." ); - ( "--pp-simple", - Arg.Unit (fun () -> set_output_mode Pp_simple), + ( "--pp-ast", + Arg.Unit (fun () -> set_output_mode Pp_ast), " Same as -pp-simple" ); ( "--dump-ast", Arg.Unit (fun () -> set_output_mode Dump_ast), diff --git a/test/501_migrations/one_migration.t b/test/501_migrations/one_migration.t index 9a90200a..3f76d4c7 100644 --- a/test/501_migrations/one_migration.t +++ b/test/501_migrations/one_migration.t @@ -3,70 +3,11 @@ as the ppxlib AST is either 5.0.0 or 5.1.0. While the ppxlib AST is on 5.0.0, th test checks whether parsing on 5.0.0 (result of test running on 5.0.0) is the same as parsing on 5.1.0 and then migrating down to 5.0.0 (result of test running on 5.1.0). -The test is mostly useful for debuggung problems in a full round-trip. Since Ppxlib's -`pp-simple` option doesn't compactify or strip locations, its output is very long. -So let's only keep one example. +The test is mostly useful for debuggung problems in a full round-trip. $ echo "let x : int = 5" > file.ml - $ ./identity_driver.exe -pp-simple file.ml - [ Pstr_attribute - { attr_name = "ocaml.ppx.context" - ; attr_payload = - PStr - [ Pstr_eval - ( Pexp_record - ( [ ( Lident "tool_name" - , Pexp_constant - (Pconst_string ( "ppxlib_driver", __loc, None)) - ) - ; ( Lident "include_dirs" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "load_path" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "open_modules" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "for_package" - , Pexp_construct ( Lident "None", None) - ) - ; ( Lident "debug" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "use_threads" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "use_vmthreads" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "recursive_types" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "principal" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "transparent_modules" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "unboxed_types" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "unsafe_string" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "cookies" - , Pexp_construct ( Lident "[]", None) - ) - ] - , None - ) - , __attrs - ) - ] - ; attr_loc = __loc - } - ; Pstr_value + $ ./identity_driver.exe -pp-ast file.ml + [ Pstr_value ( Nonrecursive , [ { pvb_pat = Ppat_constraint @@ -89,65 +30,8 @@ So let's only keep one example. > module F () = struct end > module M = F () > EOF - $ ./identity_driver.exe -pp-simple file.ml - [ Pstr_attribute - { attr_name = "ocaml.ppx.context" - ; attr_payload = - PStr - [ Pstr_eval - ( Pexp_record - ( [ ( Lident "tool_name" - , Pexp_constant - (Pconst_string ( "ppxlib_driver", __loc, None)) - ) - ; ( Lident "include_dirs" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "load_path" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "open_modules" - , Pexp_construct ( Lident "[]", None) - ) - ; ( Lident "for_package" - , Pexp_construct ( Lident "None", None) - ) - ; ( Lident "debug" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "use_threads" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "use_vmthreads" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "recursive_types" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "principal" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "transparent_modules" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "unboxed_types" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "unsafe_string" - , Pexp_construct ( Lident "false", None) - ) - ; ( Lident "cookies" - , Pexp_construct ( Lident "[]", None) - ) - ] - , None - ) - , __attrs - ) - ] - ; attr_loc = __loc - } - ; Pstr_module + $ ./identity_driver.exe -pp-ast file.ml + [ Pstr_module { pmb_name = Some "F" ; pmb_expr = Pmod_functor ( Unit, Pmod_structure []) ; pmb_attributes = __attrs