123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130(**************************************************************************)(* *)(* 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_astmoduleLeft=structletreccore_typetyp=matchtyp.ptyp_descwith|Ptyp_arrow(t::_,_)->core_typet.pap_type|Ptyp_tuplel->core_type(List.hd_exnl).lte_elt|Ptyp_object_->true|Ptyp_alias(typ,_)->core_typetyp|_->falseendmoduleRight=structletlist~eltl=matchList.lastlwithNone->false|Somex->eltxletreccore_type=function|{ptyp_attributes=_::_;_}->false|{ptyp_desc;_}->(matchptyp_descwith|Ptyp_arrow(_,t)->core_typet|Ptyp_tuplel->core_type(List.last_exnl).lte_elt|Ptyp_object_->true|_->false)letconstructor_arguments=function|Pcstr_record_->false|Pcstr_tupleargs->(matchList.lastargswith|Some{ptyp_desc=Ptyp_arrow_;_}->(* Arrows are wrapped in parens in this position:
type a = A of (t -> <..>) *)false|Somelast->core_typelast|None->false)letextension_constructor=function|{pext_attributes=_::_;_}->false|{pext_kind;_}->(matchpext_kindwith|Pext_rebind_->false|Pext_decl(_,_,Some_result)->false|Pext_decl(_,args,None)->constructor_argumentsargs)letconstructor_declaration=function|{pcd_attributes=_::_;_}->false|{pcd_res=Some_;_}->false|{pcd_args=args;_}->constructor_argumentsargslettype_declaration=function|{ptype_attributes={attrs_after=_::_;_};_}->false|{ptype_cstrs=_::_ascstrs;_}->(* type a = ... constraint left = < ... > *)list~elt:(fun(_left,right,_loc)->core_typeright)cstrs|{ptype_kind=Ptype_open|Ptype_record_;_}->false|{ptype_kind=Ptype_abstract;ptype_manifest=None;_}->false|{ptype_kind=Ptype_abstract;ptype_manifest=Somemanifest;_}->(* type a = < ... > *)core_typemanifest|{ptype_kind=Ptype_variantcdecls;_}->(* type a = ... | C of < ... > *)list~elt:constructor_declarationcdeclslettype_extension=function|{ptyext_attributes={attrs_after=_::_;_};_}->false(* type a += A of ... * ... * < ... > *)|{ptyext_constructors;_}->list~elt:extension_constructorptyext_constructorsletlabel_declaration=function|{pld_attributes=_::_;_}->false|{pld_type;_}->core_typepld_typeletrow_field=function|{prf_attributes=_::_;_}->false|{prf_desc=Rinherit_;_}->false|{prf_desc=Rtag(_,_,cs);_}->(matchList.lastcswithNone->false|Somex->core_typex)(* exception C of ... * ... * < ... > *)lettype_exception=function|{ptyexn_attributes={attrs_after=_::_;_};_}->false|{ptyexn_constructor;_}->extension_constructorptyexn_constructor(* val x : < ... > *)letvalue_description=function|{pval_attributes={attrs_after=_::_;_};_}->false|{pval_prim=_::_;_}->false|{pval_type=ct;_}->core_typectletstructure_item{pstr_desc;pstr_loc=_}=matchpstr_descwith|Pstr_type(_recflag,typedecls)->list~elt:type_declarationtypedecls|Pstr_typextte->type_extensionte|Pstr_exceptionte->type_exceptionte|Pstr_primitivevd->value_descriptionvd|Pstr_module_|Pstr_recmodule_|Pstr_modtype_|Pstr_open_|Pstr_class_|Pstr_class_type_|Pstr_include_|Pstr_attribute_|Pstr_extension_|Pstr_value_|Pstr_eval_->falseletsignature_item{psig_desc;psig_loc=_}=matchpsig_descwith|Psig_valuevd->value_descriptionvd|Psig_type(_recflag,typedecls)->list~elt:type_declarationtypedecls|Psig_typesubsttypedecls->list~elt:type_declarationtypedecls|Psig_typextte->type_extensionte|Psig_exceptionte->type_exceptionte|Psig_module_|Psig_modsubst_|Psig_recmodule_|Psig_modtype_|Psig_modtypesubst_|Psig_open_|Psig_include_|Psig_class_|Psig_class_type_|Psig_attribute_|Psig_extension_->falseletpayload=function|PStritems->list~elt:structure_itemitems|PSigitems->list~elt:signature_itemitems|PTypt->core_typet|PPat_->falseend