text
stringlengths
0
601k
let rec repeat loc e ( mini , maxoptopt ) = if mini < 0 then Messages . invalid_range loc else match maxoptopt with | Some ( Some maxi ) -> | Some None ->
let rec nocase = function Bind ( loc , e , s , conv ) -> Bind ( loc , nocase e , s , conv ) | Bind_pos _ | Epsilon _ | Backref _ | Nocase_variable _ | Special _ as e -> e | Characters ( loc , charset ) -> Characters ( loc , Charset . nocase charset ) | Sequence ( loc , e1 , e2 ) -> Sequence ( loc , nocase e1 , nocase e...
let explode s = let l = ref [ ] in for i = String . length s - 1 downto 0 do l := s . [ i ] :: ! l done ; ! l
let of_string loc s = let l = explode s in match l with [ c ] -> Characters ( loc , Charset . singleton c ) | _ ->
let as_charset _loc msg = function Characters ( _loc , set ) -> set | _ -> Messages . failure _loc msg
let rec warn_bindings w = function Bind ( loc , e , s , conv ) -> if w then Messages . not_visible loc [ s ] " context " ; warn_bindings w e | Bind_pos ( loc , s ) -> if w then Messages . not_visible loc [ s ] " context " | Epsilon _ | Characters _ | Backref _ | Variable _ | Nocase_variable _ | Special _ -> ( ) | Seque...
let warnings re = warn_bindings false re
let format_error regex = Printf . sprintf " failed to parse regex % s " regex
let compile_regex regex = try Re . Perl . compile_pat regex with Re__Perl . Parse_error | Re__Perl . Not_supported -> raise Bad_regex
module Raw = struct let get_matching_strings ~ regex str = let re = compile_regex regex in Re . matches re str let matches ~ regex str = let res = get_matching_strings ~ regex : regex str in match res with | [ ] -> false | _ -> true let replace ( ? all = false ) ~ regex ~ sub str = let re = compile_regex regex in Re . ...
module Internal = struct let get_matching_strings ~ regex str = try Raw . get_matching_strings ~ regex : regex str with Bad_regex -> internal_error @@ format_error regex let matches ~ regex string = try Raw . matches ~ regex : regex string with Bad_regex -> internal_error @@ format_error regex let replace ( ? all = fal...
module Public = struct let get_matching_strings ~ regex str = try Raw . get_matching_strings ~ regex : regex str with Bad_regex -> soupault_error @@ format_error regex let matches ~ regex string = try Raw . matches ~ regex : regex string with Bad_regex -> soupault_error @@ format_error regex let replace ( ? all = false...
type t = [ | ` Chromosome of string | ` Chromosome_interval of string * int * int | ` Full ]
let to_samtools_option r = match to_samtools_specification r with | Some s -> sprintf " - r % s " s | None -> " "
let to_gatk_option r = match to_samtools_specification r with | Some s -> sprintf " -- intervals % s " s | None -> " "
let parse_samtools s = match String . split ~ on ( ` : Character ' ' ) : s with | [ ] -> assert false | [ one ] -> ` Chromosome one | [ one ; two ] -> begin match String . split ~ on ( ` : Character ' ' ) - two with | [ left ; right ] -> begin match Int . of_string left , Int . of_string right with | Some b , Some e ->...
let cmdliner_term ( ) = let open Cmdliner in Term . ( pure ( function | None -> ` Full | Some s -> parse_samtools s ) $ Arg . ( value & opt ( some string ) None & info [ " R " ; " region " ] ~ docv " : REGION " ~ doc " : Specify a region ; using samtools ' format " ) )
let last_offset = ref 0
let check_empty name = let offs = local_stack_offset ( ) in if offs <> ! last_offset then begin Printf . printf " % 25s : % d bytes leaked \ n " %! name ( offs - ! last_offset ) end else begin Printf . printf " % 25s : OK \ n " %! name end ; last_offset := offs
let ( ) = check_empty " startup " let local_ r = ref x in let _ = opaque_identity r in ( )
let ( ) = uses_local 42 ; check_empty " function call " try let r = local_ ref x in if opaque_identity false then raise Exit ; let _ = opaque_identity r in ( ) with Exit -> ( )
let ( ) = uses_local_try 42 ; check_empty " exn function call " let local_ r = ref 42 in let _ = opaque_identity r in f ( )
let ( ) = do_tailcall ( fun ( ) -> check_empty " during indirect tailcall " ) ; check_empty " after indirect tailcall " check_empty " during direct tailcall " let local_ r = ref 42 in let _ = opaque_identity r in tailcalled_function ( )
let ( ) = do_direct_tailcall ( ) ; check_empty " after direct tailcall " let local_ r = ref 42 in let _ = opaque_identity r in f ( ) ( )
let ( ) = do_overtailcall ( fun ( ) -> let local_ r = ref 42 in let _ = opaque_identity r in fun ( ) -> check_empty " during indirect overtail " ) ; check_empty " after indirect overtail " let local_ r = ref 42 in let _ = opaque_identity r in fun ( ) -> check_empty " during direct overtail " let local_ r = ref 42 in le...
let ( ) = do_direct_overtailcall ( ) ; check_empty " after direct overtail " let local_ r = ( local_ret 1 ) 2 in let ( ) = ignore_local r in ( )
let ( ) = calls_local_ret ( ) ; check_empty " apply merging "
let ( ) = let local_ z = ref 1000 in let _ = opaque_identity z in ( )
let ( ) = check_empty " toplevel binding "
let rec foo = 1 :: bar let local_ z = ref 1000 in let _ = opaque_identity z in 1 :: foo
let ( ) = check_empty " toplevel rec binding " ; ; let _ = opaque_identity z in ( ) ) ; ;
let ( ) = check_empty " toplevel eval "
module type T = sig val x : int end
let _ = let module M : T = ( val ( let local_ r = ref 42 in let _ = opaque_identity r in ( ( module struct let x = ! r + 1 end ) : ( module T ) ) ) ) in M . x
let ( ) = check_empty " first class mod " let z = let r = local_ ref 1000 in let _ = opaque_identity r in ! r + 1 in object val p = let r = opaque_identity ( local_ ref 42 ) in ! r initializer let r = local_ ref 42 in let _ = opaque_identity r in ( ) method getd = z + p + x end
let ( ) = check_empty " class d definition " let z = let r = local_ ref 1000 in let _ = opaque_identity r in ! r + 1 in object initializer let r = local_ ref 42 in let _ = opaque_identity r in ( ) val q = let r = opaque_identity ( local_ ref 42 ) in ! r inherit d ( let r = local_ ref 42 in let _ = opaque_identity r in ...
let ( ) = check_empty " class definitions "
let o1 = new c
let o2 = new d 42
let o3 = new e
let ( ) = check_empty " class instantiation "
let glob = ref 0 incr glob ; fun x -> Gc . minor ( ) ; string_of_int x ^ s
let globstr = ref " "
let unknown_fn = ref local_fn_ret
let gpart_fn = ref ( local_fn_ret ( ) )
let obj = ref ( object method local_ret s = local_ incr glob ; fun x -> Gc . minor ( ) ; string_of_int x ^ s end )
let check s = globstr := s ; assert ( s = " 5 " ) !
let ( ) = check ( local_fn_ret ( ) " " ! 5 ) ; check_empty " static overapply " ; check ( ! unknown_fn ( ) " " ! 5 ) ; check_empty " dynamic overapply " ; let part_fn = local_fn_ret ( ) in check ( part_fn " " ! 5 ) ; check_empty " static / partial overapply " ; gpart_fn := local_fn_ret ( ) ; check ( ! gpart_fn " " ! 5 ...
let ( ) = Gc . compact ( )
type parser_fun ' a = ? directive_handler ( ' : a -> option ' a ) -> PreCast . Loc . t -> Stream . t char -> ' a ;
type printer_fun ' a = ? input_file : string -> ? output_file : string -> ' a -> unit ; let rec loop ( ) = loop ( f ( Queue . take callbacks ) ) in try loop ( ) with [ Queue . Empty -> ( ) ] ; begin loaded_modules . val := [ m :: loaded_modules . val ] ; Queue . add ( m , f ) callbacks ; end ; do { str_item_parser . va...
module Plugin ( Id : Sig . Id ) ( Maker : functor ( Unit : sig end ) -> sig end ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker ( struct end ) in ( ) ) ; end ;
module SyntaxExtension ( Id : Sig . Id ) ( Maker : Sig . SyntaxExtension ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker Syntax in ( ) ) ; end ;
module OCamlSyntaxExtension ( Id : Sig . Id ) ( Maker : functor ( Syn : Sig . Camlp4Syntax ) -> Sig . Camlp4Syntax ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker Syntax in ( ) ) ; end ;
module SyntaxPlugin ( Id : Sig . Id ) ( Maker : functor ( Syn : Sig . Syntax ) -> sig end ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker Syntax in ( ) ) ; end ;
module Printer ( Id : Sig . Id ) ( Maker : functor ( Syn : Sig . Syntax ) -> ( Sig . Printer Syn . Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker Syntax in register_printer M . print_implem M . print_interf ) ; end ;
module OCamlPrinter ( Id : Sig . Id ) ( Maker : functor ( Syn : Sig . Camlp4Syntax ) -> ( Sig . Printer Syn . Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker Syntax in register_printer M . print_implem M . print_interf ) ; end ;
module OCamlPreCastPrinter ( Id : Sig . Id ) ( P : ( Sig . Printer PreCast . Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> register_printer P . print_implem P . print_interf ) ; end ;
module Parser ( Id : Sig . Id ) ( Maker : functor ( Ast : Sig . Ast ) -> ( Sig . Parser Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker PreCast . Ast in register_parser M . parse_implem M . parse_interf ) ; end ;
module OCamlParser ( Id : Sig . Id ) ( Maker : functor ( Ast : Sig . Camlp4Ast ) -> ( Sig . Parser Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker PreCast . Ast in register_parser M . parse_implem M . parse_interf ) ; end ;
module OCamlPreCastParser ( Id : Sig . Id ) ( P : ( Sig . Parser PreCast . Ast ) . S ) = struct declare_dyn_module Id . name ( fun _ -> register_parser P . parse_implem P . parse_interf ) ; end ;
module AstFilter ( Id : Sig . Id ) ( Maker : functor ( F : Sig . AstFilters ) -> sig end ) = struct declare_dyn_module Id . name ( fun _ -> let module M = Maker AstFilters in ( ) ) ; end ;
module CurrentParser = struct module Ast = Ast ; value parse_interf ? directive_handler loc strm = sig_item_parser . val ? directive_handler loc strm ; value parse_implem ? directive_handler loc strm = str_item_parser . val ? directive_handler loc strm ; end ;
module CurrentPrinter = struct module Ast = Ast ; value print_interf ? input_file ? output_file ast = sig_item_printer . val ? input_file ? output_file ast ; value print_implem ? input_file ? output_file ast = str_item_printer . val ? input_file ? output_file ast ; end ; let module M = OCamlPrinter PP . OCaml . Id PP ....
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2014 - 10 - 31 " ] ) ; ( " Action " , [ " RegisterDBProxyTargets " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query ....
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Util . option_bind ( Xml . member " RegisterDBProxyTargetsResponse " ( snd xml ) ) ( Xml . member " RegisterDBProxyTargetsResult " ) in try Util . or_error ( Util . option_bind resp RegisterDBProxyTargetsResponse . parse ) ( let open Error in BadR...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
module type T = sig module P : sig val hash : Protocol_hash . t include Tezos_protocol_environment . PROTOCOL end include module type of struct include P end val complete_b58prefix : Tezos_protocol_environment . Context . t -> string -> string list Lwt . t end
type t = ( module T )
let build hash = match Tezos_protocol_registerer . Registerer . get hash with | None -> None | Some ( V0 protocol ) -> let ( module F ) = protocol in let module Name = struct let name = Protocol_hash . to_b58check hash end in let module Env = Tezos_protocol_environment . MakeV0 ( Name ) ( ) in Some ( module struct modu...
let versions : ( module T ) VersionTable . t = VersionTable . create 20
let sources : Protocol . t VersionTable . t = VersionTable . create 20
let mem hash = VersionTable . mem versions hash || Tezos_protocol_registerer . Registerer . mem hash
let get hash = match VersionTable . find versions hash with | Some proto -> Some proto | None -> ( match build hash with | Some proto -> VersionTable . add versions hash proto ; Some proto | None -> None )
type error += Unregistered_protocol of Protocol_hash . t
let ( ) = register_error_kind ` Permanent ~ id " : registered_protocol . unregistered_protocol " ~ title " : Unregistered protocol " ~ description " : No protocol was registered with the requested hash . " ~ pp ( : fun fmt hash -> Format . fprintf fmt " [ @< hov > No registered protocol with hash :@ % a ] " @ Protocol_...
let get_result hash = match get hash with | Some hash -> return hash | None -> fail ( Unregistered_protocol hash )
let seq ( ) = VersionTable . to_seq_values versions
let seq_embedded ( ) = VersionTable . to_seq_keys sources
let get_embedded_sources hash = VersionTable . find sources hash
module type Source_sig = sig val hash : Protocol_hash . t option val sources : Protocol . t end
module Register_embedded_V0 ( Env : Tezos_protocol_environment . V0 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module Register_embedded_V1 ( Env : Tezos_protocol_environment . V1 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module Register_embedded_V2 ( Env : Tezos_protocol_environment . V2 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module Register_embedded_V3 ( Env : Tezos_protocol_environment . V3 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module Register_embedded_V4 ( Env : Tezos_protocol_environment . V4 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module Register_embedded_V5 ( Env : Tezos_protocol_environment . V5 ) ( Proto : Env . Updater . PROTOCOL ) ( Source : Source_sig ) = struct let hash = match Source . hash with | None -> Protocol . hash Source . sources | Some hash -> hash module Self = struct module P = struct let hash = hash include Env . Lift ( Proto...
module type PROTOCOL_V0 = functor ( Env : Tezos_protocol_environment_sigs . V0 . T ) -> Env . Updater . PROTOCOL
module type PROTOCOL_V1 = functor ( Env : Tezos_protocol_environment_sigs . V1 . T ) -> Env . Updater . PROTOCOL
module type PROTOCOL_V2 = functor ( Env : Tezos_protocol_environment_sigs . V2 . T ) -> Env . Updater . PROTOCOL
module type PROTOCOL_V3 = functor ( Env : Tezos_protocol_environment_sigs . V3 . T ) -> Env . Updater . PROTOCOL
module type PROTOCOL_V4 = functor ( Env : Tezos_protocol_environment_sigs . V4 . T ) -> Env . Updater . PROTOCOL
module type PROTOCOL_V5 = functor ( Env : Tezos_protocol_environment_sigs . V5 . T ) -> Env . Updater . PROTOCOL
type proto_env = | V0 of ( module PROTOCOL_V0 ) | V1 of ( module PROTOCOL_V1 ) | V2 of ( module PROTOCOL_V2 ) | V3 of ( module PROTOCOL_V3 ) | V4 of ( module PROTOCOL_V4 ) | V5 of ( module PROTOCOL_V5 )
let versions : proto_env VersionTable . t = VersionTable . create 20
let register hash proto = let hash = Protocol_hash . of_b58check_exn hash in VersionTable . add versions hash proto
let mem hash = VersionTable . mem versions hash
let get hash = VersionTable . find versions hash
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " RegisterImage " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . render (...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " RegisterImageResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp RegisterImageResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed RegisterImageResult . " } ) with | Xm...