1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374openPpxlibletrewriter_name="ppx_obus"letfind_attr_exprsattrs=letexpr_of_payload=function|PStr[{pstr_desc=Pstr_eval(e,_);_}]->Somee|_->Noneintryexpr_of_payload(letpayload=List.find(funattr->attr.attr_name.txt=s)attrsinpayload.attr_payload)withNot_found->Noneletregister_obus_exception=function|{pstr_desc=Pstr_exceptionexn;pstr_loc}->(matchfind_attr_expr"obus"exn.ptyexn_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.ptyexn_constructor.pext_kindwith|Pext_decl(_,Pcstr_tuple[typ],None)->Some(registerertyp)|_->Location.raise_errorf~loc:pstr_loc"%s: OBus exceptions take a single string argument"rewriter_name)|_->None)|_->Noneletobus_mapper=object(self)inheritAst_traverse.mapmethod!structureitems=List.fold_right(funitemacc->letitem'=self#structure_itemiteminmatchregister_obus_exceptionitemwith|Somereg->item'::reg::acc|None->item'::acc)items[]endlet()=Driver.register_transformation~impl:(funstructure->obus_mapper#structurestructure)rewriter_name