Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file spin_refmt.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107exceptionRefmt_errorofstringtypeast=|ImplofReason_toolchain_conf.Parsetree.structure|IntfofReason_toolchain_conf.Parsetree.signature_itemlisttypeparse_output={ast:ast;comments:Reason_comment.tlist;parsed_as_ml:bool}letparsefilename=ifFilename.check_suffixfilename".re"thenletlexbuf=Reason_toolchain.setup_lexbuffalsefilenameinletimpl=Reason_toolchain.RE.implementation_with_commentsinletast,comments=impllexbufin{ast=Implast;comments;parsed_as_ml=false}elseifFilename.check_suffixfilename".rei"thenletlexbuf=Reason_toolchain.setup_lexbuffalsefilenameinletintf=Reason_toolchain.RE.interface_with_commentsinletast,comments=intflexbufin{ast=Intfast;comments;parsed_as_ml=false}elseifFilename.check_suffixfilename".ml"thenletlexbuf=Reason_toolchain.setup_lexbuffalsefilenameinletimpl=Reason_toolchain.ML.implementation_with_commentsinletast,comments=impllexbufin{ast=Implast;comments;parsed_as_ml=false}elseifFilename.check_suffixfilename".mli"thenletlexbuf=Reason_toolchain.setup_lexbuffalsefilenameinletintf=Reason_toolchain.ML.interface_with_commentsinletast,comments=intflexbufin{ast=Intfast;comments;parsed_as_ml=false}elseraise(Refmt_error"The file extension is not valid.")letprintfilenameparse_outputoutput_formatter=ifFilename.check_suffixfilename".re"thenmatchparse_output.astwith|Implimpl->Reason_toolchain.RE.print_implementation_with_commentsoutput_formatter(impl,parse_output.comments)|Intf_->raise(Refmt_error"Cannot print an implementation from an interface")elseifFilename.check_suffixfilename".rei"thenmatchparse_output.astwith|Intfintf->Reason_toolchain.RE.print_interface_with_commentsoutput_formatter(intf,parse_output.comments)|Impl_->raise(Refmt_error"Cannot print an interface from an implementation")elseifFilename.check_suffixfilename".ml"thenmatchparse_output.astwith|Implimpl->Reason_toolchain.ML.print_implementation_with_commentsoutput_formatter(impl,parse_output.comments)|Intf_->raise(Refmt_error"Cannot print an implementation from an interface")elseifFilename.check_suffixfilename".mli"thenmatchparse_output.astwith|Intfintf->Reason_toolchain.ML.print_interface_with_commentsoutput_formatter(intf,parse_output.comments)|Impl_->raise(Refmt_error"Cannot print an interface from an implementation")elseraise(Refmt_error"The file extension is not valid.")letprepare_output_filename=open_out_binnameletclose_output_fileoutput_chan=close_outoutput_chanletoutput_of_input_filefilename=ifFilename.check_suffixfilename".re"thenFilename.chop_suffixfilename".re"^".ml"elseifFilename.check_suffixfilename".rei"thenFilename.chop_suffixfilename".rei"^".mli"elseifFilename.check_suffixfilename".ml"thenFilename.chop_suffixfilename".ml"^".re"elseifFilename.check_suffixfilename".mli"thenFilename.chop_suffixfilename".mli"^".rei"elseraise(Refmt_error"The file extension is not valid.")letconvertinput_file=Reason_config.configure~r:false;Location.input_name:=input_file;let_=Reason_pprint_ast.configure~width:80~assumeExplicitArity:true~constructorLists:[]inletoutput_file=output_of_input_fileinput_fileinletoutput_chan=prepare_output_fileoutput_fileinleteol=Eol_detect.get_eol_for_fileinput_fileinletoutput_formatter=Eol_convert.get_formatteroutput_chaneolinletparse_output=parseinput_fileinprintoutput_fileparse_outputoutput_formatter;(* Also closes all open boxes. *)Format.pp_print_flushoutput_formatter();flushoutput_chan;close_output_fileoutput_chan