Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file import.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310openStdunemoduleList=Stdune.ListmoduleHashtbl=Stdune.HashtblmoduleOption=Stdune.OptionmoduleEither=Stdune.EithermoduleInt=Stdune.IntmoduleDyn=Stdune.DynmoduleOrdering=Stdune.OrderingmoduleExn=Stdune.ExnmoduleCode_error=Code_errormoduleOr_exn=Or_exnmoduleTable=TablemoduleId=IdmoduleResult=Stdune.ResultmoduleExn_with_backtrace=Exn_with_backtracemoduleQueue=QueuemoduleString=structincludeStdune.Stringletfirst_double_underscore_ends=letlen=String.lengthsinletrecauxi=ifi>len-2thenraiseNot_foundelseifs.[i]='_'&&s.[i+1]='_'theni+1elseaux(i+1)inaux0letno_double_underscores=tryignore(first_double_underscore_ends);falsewithNot_found->truelettrim=function|""->""|str->letl=String.lengthstrinletis_space=function|' '|'\n'|'\t'|'\r'->true|_->falseinletr0=ref0andrl=reflinwhile!r0<l&&is_spacestr.[!r0]doincrr0done;letr0=!r0inwhile!rl>r0&&is_spacestr.[!rl-1]dodecrrldone;letrl=!rlinifr0=0&&rl=lthenstrelsesubstr~pos:r0~len:(rl-r0)letprint()s=Printf.sprintf"%S"sletnext_occurrence~patterntextfrom=letplen=String.lengthpatterninletlast=String.lengthtext-pleninleti=reffromandj=ref0inwhile!i<=last&&!j<plendoiftext.[!i+!j]<>pattern.[!j]then(incri;j:=0)elseincrjdone;if!j<plenthenraiseNot_foundelse!iletreplace_all~pattern~with_text=ifpattern=""thentextelsematchnext_occurrence~patterntext0with|exceptionNot_found->text|j0->letbuffer=Buffer.create(String.lengthtext)inletrecauxij=Buffer.add_substringbuffertexti(j-i);Buffer.add_stringbufferwith_;leti'=j+String.lengthpatterninmatchnext_occurrence~patterntexti'with|exceptionNot_found->Buffer.add_substringbuffertexti'(String.lengthtext-i')|j'->auxi'j'inaux0j0;Buffer.contentsbufferendletlet_refrvf=letv'=!rinr:=v;matchf()with|result->r:=v';result|exceptionexn->r:=v';raiseexnmoduleJson=structtypet=Ppx_yojson_conv_lib.Yojson.Safe.tletto_pretty_string(t:t)=Yojson.Safe.pretty_to_string~std:falsetletto_stringt=Yojson.Safe.to_stringtletof_strings=Yojson.Safe.from_stringsletyojson_of_tx=xlett_of_yojsonx=xleterror=Ppx_yojson_conv_lib.Yojson_conv.of_yojson_errorletyojson_of_list=Ppx_yojson_conv_lib.Yojson_conv.yojson_of_listletppppf(t:t)=Yojson.Safe.pretty_printppftmoduleJsonable=Ppx_yojson_conv_lib.Yojsonableletfieldfieldsnameconv=List.assoc_optnamefields|>Option.map~f:convletfield_exnfieldsnameconv=matchfieldfieldsnameconvwith|Somef->f|None->error"Jsonrpc.Result.t: missing field"(`Assocfields)letrecof_dyn(t:Dyn.t):t=matchtwith|Opaque->`String"<opaque>"|Unit->`String"()"|Inti->`Inti|Int64i->`Int(Int64.to_inti)|Boolb->`Boolb|Strings->`Strings|Bytess->`String(Bytes.to_strings)|Charc->`String(String.of_list[c])|Floatf->`Floatf|OptionNone->`String"<none>"|Option(Somes)->of_dyns|Listxs->`List(List.map~f:of_dynxs)|Arrayxs->`List(List.map~f:of_dyn(Array.to_listxs))|Tuplexs->`List(List.map~f:of_dynxs)|Recordr->`Assoc(List.mapr~f:(fun(k,v)->(k,of_dynv)))|Variant(name,args)->`Assoc[(name,of_dyn(Listargs))]|Setxs->`List(List.map~f:of_dynxs)|Mapmap->`List(List.mapmap~f:(fun(k,v)->`List[of_dynk;of_dynv]))moduleConv=structincludePpx_yojson_conv_lib.Yojson_convendmoduleO=structlet(<|>)c1c2json=matchc1jsonwith|s->s|exceptionConv.Of_yojson_error(_,_)->c2jsonendmoduleOption=structtype'at='aoptionletyojson_of_tf=function|None->`Null|Somex->fxlett_of_yojsonf=function|`Null->None|json->Some(fjson)endmoduleOf=structletlist=Ppx_yojson_conv_lib.Yojson_conv.list_of_yojsonletpairfgjson=matchjsonwith|`List[x;y]->(fx,gy)|json->error"pair"jsonletint_pair=letint=Ppx_yojson_conv_lib.Yojson_conv.int_of_yojsoninpairintintletuntagged_union(typea)name(xs:(t->a)list)(json:t):a=matchList.find_mapxs~f:(funconv->trySome(convjson)withPpx_yojson_conv_lib.Yojson_conv.Of_yojson_error(_,_)->None)with|None->errornamejson|Somex->xletliteral_field(typea)(name:string)(k:string)(v:string)(f:t->a)(json:t):a=matchjsonwith|`Assocxs->(letks,xs=List.partition_mapxs~f:(fun(k',v')->ifk=k'thenif`Stringv=v'thenLeftkelseerror(sprintf"%s: incorrect key %s"namek)jsonelseRight(k',v'))inmatchkswith|[]->error(sprintf"%s: key %s not found"namek)json|[_]->f(`Assocxs)|_::_->error(sprintf"%s: multiple keys %s"namek)json)|_->error(sprintf"%s: not a record (key: %s)"namek)jsonendmoduleTo=structletlistfxs=`List(List.map~fxs)letliteral_field(typea)(k:string)(v:string)(f:a->t)(t:a):t=matchftwith|`Assocxs->`Assoc((k,`Stringv)::xs)|_->Code_error.raise"To.literal_field"[]letint_pair(x,y)=`List[`Intx;`Inty]endmoduleNullable_option=structtype'at='aoptionlett_of_yojsonf=function|`Null->None|json->Some(fjson)letyojson_of_tf=function|None->assertfalse|Somes->fsendmoduleAssoc=structtype('a,'b)t=('a*'b)listconstraint'a=stringletyojson_of_tfgxs=letfk=matchfkwith|`Strings->s|json->error"Json.Assoc.yojson_of_t not a string key"jsonin`Assoc(List.mapxs~f:(fun(k,v)->(fk,gv)))lett_of_yojsonfgjson=letfs=f(`Strings)inmatchjsonwith|`Assocxs->List.mapxs~f:(fun(k,v)->(fk,gv))|_->error"Json.Assoc.t_of_yojson: not an object"jsonendmoduleVoid=structtypetlett_of_yojson=error"Void.t"letyojson_of_t(_:t)=assertfalseendendmoduleLog=structletlevel:(stringoption->bool)ref=ref(fun_->false)letout=refFormat.err_formattertypemessage={message:string;payload:(string*Json.t)list}letmsgmessagepayload={message;payload}letlog?sectionk=if!levelsectionthen(letmessage=k()in(matchsectionwith|None->Format.fprintf!out"%s@."message.message|Somesection->Format.fprintf!out"[%s] %s@."sectionmessage.message);(matchmessage.payloadwith|[]->()|fields->Format.fprintf!out"%a@."Json.pp(`Assocfields));Format.pp_print_flush!out())endletsprintf=Stdune.sprintf