123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475openMigrate_parsetreeopenAst_407.Parsetreeletrewriter_name="ppx_obus"letraise_errorf?sub?locmessage=message|>Printf.kprintf(funstr->leterr=Location.error?sub?locstrinraise(Location.Errorerr))letfind_attr_exprsattrs=letexpr_of_payload=function|PStr[{pstr_desc=Pstr_eval(e,_);_}]->Somee|_->Noneintryexpr_of_payload(snd(List.find(fun(x,_)->x.Asttypes.txt=s)attrs))withNot_found->Noneletregister_obus_exception=function|{pstr_desc=Pstr_exceptionexn;pstr_loc}->(matchfind_attr_expr"obus"exn.pext_attributeswith|Someexpr->letregisterertyp=letloc=pstr_locinifFilename.basenamepstr_loc.loc_start.pos_fname="oBus_error.ml"then[%strilet()=letmoduleM=Register(structletname=[%eexpr]exceptionEof[%ttyp]end)in()]else[%strilet()=letmoduleM=OBus_error.Register(structletname=[%eexpr]exceptionEof[%ttyp]end)in()]in(matchexn.pext_kindwith|Pext_decl(Pcstr_tuple[typ],None)->Some(registerertyp)|_->raise_errorf~loc:pstr_loc"%s: OBus exceptions take a single string argument"rewriter_name)|_->None)|_->Noneletobus_mapper={Ast_407.Ast_mapper.default_mapperwithstructure=funmapperitems->List.fold_right(funitemacc->letitem'=Ast_407.Ast_mapper.default_mapper.structure_itemmapperiteminmatchregister_obus_exceptionitemwith|Somereg->item'::reg::acc|None->item'::acc)items[]}let()=Driver.register~name:rewriter_nameVersions.ocaml_407(fun__->obus_mapper)