12345678910111213141516171819202122232425262728293031323334353637383940openFlecheletpp_jsonfmt(ast:Doc.Node.Ast.t)=letjast=Lsp.JCoq.Ast.to_yojsonast.vinYojson.Safe.pretty_printfmtjastletpp_sexpfmt(ast:Doc.Node.Ast.t)=letsast=Serlib.Ser_vernacexpr.sexp_of_vernac_control(Coq.Ast.to_coqast.v)inSexplib.Sexp.pp_humfmtsastletpwppfmtast=Format.fprintffmt"@[%a@]"ppastletdump_asts~out_fileppasts=letout=Stdlib.open_outout_fileinletfmt=Format.formatter_of_out_channeloutinList.iter(pwppfmt)asts;Format.pp_print_flushfmt();Stdlib.close_outoutletdump_ast~io~token:_~(doc:Doc.t)=leturi=doc.uriinleturi_str=Lang.LUri.File.to_string_uriuriinletout_file_j=Lang.LUri.File.to_string_fileuri^".json.astdump"inletout_file_s=Lang.LUri.File.to_string_fileuri^".sexp.astdump"inletlvl=Io.Level.infoinletmessage=Format.asprintf"[ast plugin] dumping ast for %s ..."uri_strinIo.Report.message~io~lvl~message;letasts=Doc.astsdocinlet()=dump_asts~out_file:out_file_jpp_jsonastsinlet()=dump_asts~out_file:out_file_spp_sexpastsinletmessage=Format.asprintf"[ast plugin] dumping ast for %s was completed!"uri_strinIo.Report.message~io~lvl~message;()letmain()=Theory.Register.Completed.adddump_astlet()=main()