1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768(**************************************************************************)(* *)(* OCamlFormat *)(* *)(* Copyright (c) Facebook, Inc. and its affiliates. *)(* *)(* This source code is licensed under the MIT license found in *)(* the LICENSE file in the root directory of this source tree. *)(* *)(**************************************************************************)openExtended_asttypestate=Enable|DisableofLocation.ttype'at=|Structure:structuret|Signature:signaturet|Use_file:use_filetletupdate_conf?quietcl=List.fold~init:cl~f:(Conf.update?quiet)letdisabling(c:Conf.t)attr=(notc.opr_opts.disable.v)&&(update_conf~quiet:truec[attr]).opr_opts.disable.vletenabling(c:Conf.t)attr=c.opr_opts.disable.v&¬(update_conf~quiet:truec[attr]).opr_opts.disable.vletinit_loc=letpos=Lexing.{pos_cnum=0;pos_bol=0;pos_lnum=0;pos_fname=!Location.input_name}inLocation.{loc_ghost=false;loc_start=pos;loc_end=pos}letis_attr(typea)(fg:alistt)(x:a)=match(fg,x)with|Structure,{pstr_desc=Pstr_attributex;pstr_loc}->Some(x,pstr_loc)|Signature,{psig_desc=Psig_attributex;psig_loc}->Some(x,psig_loc)|Use_file,Ptop_def({pstr_desc=Pstr_attributex;pstr_loc}::_)->Some(x,pstr_loc)|_->Noneletis_state_attrfg~fcx=matchis_attrfgxwith|Some(attr,loc)whenfcattr->Someloc|_->Noneletsplitfgcl=List.fold_leftl~init:([],c)~f:(fun(acc,c)x->matchis_state_attrfg~f:disablingcxwith|Someloc->((Disableloc,[x])::acc,Conf.update_statec`Disable)|None->(matchis_state_attrfg~f:enablingcxwith|Some_->((Enable,[x])::acc,Conf.update_statec`Enable)|None->(matchaccwith|[]->letchunk=ifc.opr_opts.disable.vthen(Disableinit_loc,[x])else(Enable,[x])in(chunk::acc,c)|(st,h)::t->((st,x::h)::t,c))))|>fst|>List.rev_map~f:(functionstate,lx->(state,List.revlx))