text stringlengths 12 786k |
|---|
let module_type_classes ( ? trans = true ) m = classes ( module_type_elements ~ trans m ) |
let module_type_class_types ( ? trans = true ) m = class_types ( module_type_elements ~ trans m ) |
let module_type_modules ( ? trans = true ) m = modules ( module_type_elements ~ trans m ) |
let module_type_module_types ( ? trans = true ) m = mod_types ( module_type_elements ~ trans m ) |
let module_type_included_modules ( ? trans = true ) m = included_modules ( module_type_elements ~ trans m ) |
let module_type_comments ( ? trans = true ) m = comments ( module_type_elements ~ trans m ) |
let module_type_functions ( ? trans = true ) mt = List . filter ( fun v -> Odoc_value . is_function v ) ( values ( module_type_elements ~ trans mt ) ) |
let module_type_simple_values ( ? trans = true ) mt = List . filter ( fun v -> not ( Odoc_value . is_function v ) ) ( values ( module_type_elements ~ trans mt ) ) |
let rec module_all_classes ( ? trans = true ) m = List . fold_left ( fun acc -> fun m -> acc @ ( module_all_classes ~ trans m ) ) ( List . fold_left ( fun acc -> fun mtyp -> acc @ ( module_type_all_classes ~ trans mtyp ) ) ( module_classes ~ trans m ) ( module_module_types ~... |
let infix_chars = [ ' ' | ; ' ' < ; ' ' > ; ' ' @ ; ' ' ^ ; ' ' & ; ' ' + ; ' ' - ; ' ' * ; ' ' / ; ' ' $ ; ' ' % ; ' ' = ; ' ' : ; ' ' ~ ; ' ' ! ; ' . ' ; ' ' # ; ] |
let strip_string s = let len = String . length s in let rec iter_first n = if n >= len then None else match s . [ n ] with ' ' | ' \ t ' | ' \ n ' | ' \ r ' -> iter_first ( n + 1 ) | _ -> Some n in match iter_first 0 with None -> " " | Some first -> let rec iter_last ... |
let parens_if_infix name = match strip_string name with | " " -> " " | s when s . [ 0 ] = ' ' * || s . [ String . length s - 1 ] = ' ' * -> " ( " ^ s ^ " ) " | s when List . mem s . [ 0 ] infix_chars -> " ( " ^ s ^ " ) " | " or " | ... |
let cut name = match name with " " -> ( " " , " " ) | s -> let len = String . length s in match s . [ len - 1 ] with ' ) ' -> ( let j = ref 0 in let buf = [ | Buffer . create len ; Buffer . create len ] | in for i = 0 to len - 1 do match s . [ i ] with ... |
let simple name = snd ( cut name ) |
let father name = fst ( cut name ) |
let concat n1 n2 = n1 " . " ^^ n2 |
let normalize_name name = let ( p , s ) = cut name in let len = String . length s in let s = if len >= 2 && s . [ 0 ] = ' ( ' && s . [ len - 1 ] = ' ) ' then parens_if_infix ( strip_string ( String . sub s 1 ( len - 2 ) ) ) else s in match p with " " ->... |
let head_and_tail n = try let pos = String . index n ' . ' in if pos > 0 then let h = String . sub n 0 pos in try ignore ( String . index h ' ( ' ) ; ( n , " " ) with Not_found -> let len = String . length n in if pos >= ( len - 1 ) then ( h , " " ) else ( ... |
let head n = fst ( head_and_tail n ) |
let depth name = try List . length ( Str . split ( Str . regexp " . " ) \\ name ) with _ -> 1 |
let prefix n1 n2 = ( n1 <> n2 ) && ( try let len1 = String . length n1 in ( ( String . sub n2 0 len1 ) = n1 ) && ( n2 . [ len1 ] = ' . ' ) with _ -> false ) |
let rec get_relative_raw n1 n2 = let ( f1 , s1 ) = head_and_tail n1 in let ( f2 , s2 ) = head_and_tail n2 in if f1 = f2 then if f2 = s2 || s2 = " " then s2 else if f1 = s1 || s1 = " " then s2 else get_relative_raw s1 s2 else n2 |
let get_relative n1 n2 = if prefix n1 n2 then let len1 = String . length n1 in try String . sub n2 ( len1 + 1 ) ( ( String . length n2 ) - len1 - 1 ) with _ -> n2 else n2 |
let get_relative_opt n1 n2 = if n1 = " " then n2 else if prefix n1 n2 then let len1 = String . length n1 in try String . sub n2 ( len1 + 1 ) ( ( String . length n2 ) - len1 - 1 ) with _ -> n2 else n2 |
let alias_unprefix ln s = if ln = " " then s else let p = ln ^ " __ " in let n , k = String . ( length p , length s ) in if k > n && String . sub s 0 n = p then String . ( capitalize_ascii @@ sub s n ( k - n ) ) else s |
let hide_given_modules l s = let rec iter = function [ ] -> s | h :: q -> let s2 = get_relative h s in if s = s2 then iter q else s2 in iter l |
let qualified name = String . contains name ' . ' |
let from_ident ident = Ident . name ident |
let from_path path = Path . name path |
let to_path n = match List . fold_left ( fun acc_opt -> fun s -> match acc_opt with None -> Some ( Path . Pident ( Ident . create_local s ) ) | Some acc -> Some ( Path . Pdot ( acc , s ) ) ) None ( Str . split ( Str . regexp " . " ) \\ n ) with None -> raise ( F... |
type simple_name = { sn_name : string ; sn_type : Types . type_expr ; mutable sn_text : Odoc_types . text option ; } |
type param_info = | Simple_name of simple_name | Tuple of param_info list * Types . type_expr |
let complete_name p = let rec iter pi = match pi with Simple_name sn -> sn . sn_name | Tuple ( [ ] , _ ) -> " " ?? | Tuple ( pi_list , _ ) -> " ( " ( ^ String . concat " , " ( List . map iter pi_list ) ) " ) " ^ in iter p |
let typ pi = match pi with Simple_name sn -> sn . sn_type | Tuple ( _ , typ ) -> typ |
let update_parameter_text f p = let rec iter pi = match pi with Simple_name sn -> sn . sn_text <- f sn . sn_name | Tuple ( l , _ ) -> List . iter iter l in iter p |
let desc_by_name pi name = let rec iter acc pi = match pi with Simple_name sn -> ( sn . sn_name , sn . sn_text ) :: acc | Tuple ( pi_list , _ ) -> List . fold_left iter acc pi_list in let l = iter [ ] pi in List . assoc name l |
let names pi = let rec iter acc pi = match pi with Simple_name sn -> sn . sn_name :: acc | Tuple ( pi_list , _ ) -> List . fold_left iter acc pi_list in iter [ ] pi |
let type_by_name pi name = let rec iter acc pi = match pi with Simple_name sn -> ( sn . sn_name , sn . sn_type ) :: acc | Tuple ( pi_list , _ ) -> List . fold_left iter acc pi_list in let l = iter [ ] pi in List . assoc name l |
let desc_from_info_opt info_opt s = match info_opt with None -> None | Some i -> match s with " " -> None | _ -> try Some ( List . assoc s i . Odoc_types . i_params ) with Not_found -> None |
let ( ) = Printtyp . Naming_context . enable false |
let new_fmt ( ) = let buf = Buffer . create 512 in let fmt = formatter_of_buffer buf in let flush ( ) = pp_print_flush fmt ( ) ; let s = Buffer . contents buf in Buffer . reset buf ; s in ( fmt , flush ) |
let ( type_fmt , flush_type_fmt ) = new_fmt ( ) |
let _ = let outfuns = pp_get_formatter_out_functions type_fmt ( ) in pp_set_formatter_out_functions type_fmt { outfuns with out_newline = fun ( ) -> outfuns . out_string " \ n " 0 3 } |
let ( modtype_fmt , flush_modtype_fmt ) = new_fmt ( ) |
let string_of_type_expr t = Printtyp . mark_loops t ; Printtyp . type_scheme_max ~ b_reset_names : false type_fmt t ; flush_type_fmt ( ) |
let simpl_module_type ? code t = let open Types in let rec iter t = match t with Mty_ident _ | Mty_alias _ -> t | Mty_signature _ -> ( match code with None -> Mty_signature [ ] | Some s -> raise ( Use_code s ) ) | Mty_functor ( Unit , mt ) -> Mty_functor ( Unit , iter mt ) | Mty_... |
let string_of_module_type ? code ( ? complete = false ) t = try let t2 = if complete then t else simpl_module_type ? code t in Printtyp . modtype modtype_fmt t2 ; flush_modtype_fmt ( ) with Use_code s -> s |
let simpl_class_type t = let rec iter t = match t with Types . Cty_constr _ -> t | Types . Cty_signature cs -> let tnil = { Types . desc = Types . Tnil ; Types . level = 0 ; Types . scope = Btype . lowest_level ; Types . id = 0 } in Types . Cty_signature { Types . csig_self ... |
let string_of_class_type ( ? complete = false ) t = let t2 = if complete then t else simpl_class_type t in Printtyp . class_type modtype_fmt t2 ; flush_modtype_fmt ( ) |
object ( self ) method scan_value ( _ : Odoc_value . t_value ) = ( ) method scan_type_pre ( _ : Odoc_type . t_type ) = true method scan_type_recfield _t ( _ : Odoc_type . record_field ) = ( ) method scan_type_const _t ( _ : Odoc_type . variant_constructor ) = ( ) me... |
type result_element = Res_module of t_module | Res_module_type of t_module_type | Res_class of t_class | Res_class_type of t_class_type | Res_value of t_value | Res_type of t_type | Res_extension of t_extension_constructor | Res_exception of t_exception | Res_attribute of t_attribute | Res_method of t_method ... |
type result = result_element list |
module type Predicates = sig type t val p_module : t_module -> t -> bool * bool val p_module_type : t_module_type -> t -> bool * bool val p_class : t_class -> t -> bool * bool val p_class_type : t_class_type -> t -> bool * bool val p_value : t_value -> t -> bool val p_recfield : t_type -> record_f... |
module Search = functor ( P : Predicates ) -> struct let search_section t s v = if P . p_section s v then [ Res_section ( s , t ) ] else [ ] let rec search_text root t v = List . flatten ( List . map ( fun e -> search_text_ele root e v ) t ) and search_text_ele root e v = let modu... |
module P_name = struct type t = Str . regexp let ( ) =~ name regexp = Str . string_match regexp name 0 let p_module m r = ( true , m . m_name =~ r ) let p_module_type mt r = ( true , mt . mt_name =~ r ) let p_class c r = ( true , c . cl_name =~ r ) let p_class_type ct r = ( ... |
module Search_by_name = Search ( P_name ) |
module P_values = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = true let p_recfield _ _ _ = false let p_const _ _ _ = false ... |
module Search_values = Search ( P_values ) |
let values l = let l_ele = Search_values . search l ( ) in let p v1 v2 = v1 . val_name = v2 . val_name in let rec iter acc = function ( Res_value v ) :: q -> if List . exists ( p v ) acc then iter acc q else iter ( v :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in iter [ ] ... |
module P_extensions = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = f... |
module Search_extensions = Search ( P_extensions ) |
let extensions l = let l_ele = Search_extensions . search l ( ) in let p x1 x2 = x1 . xt_name = x2 . xt_name in let rec iter acc = function ( Res_extension x ) :: q -> if List . exists ( p x ) acc then iter acc q else iter ( x :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in i... |
module P_exceptions = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = f... |
module Search_exceptions = Search ( P_exceptions ) |
let exceptions l = let l_ele = Search_exceptions . search l ( ) in let p e1 e2 = e1 . ex_name = e2 . ex_name in let rec iter acc = function ( Res_exception t ) :: q -> if List . exists ( p t ) acc then iter acc q else iter ( t :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in i... |
module P_types = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = false ... |
module Search_types = Search ( P_types ) |
let types l = let l_ele = Search_types . search l ( ) in let p t1 t2 = t1 . ty_name = t2 . ty_name in let rec iter acc = function ( Res_type t ) :: q -> if List . exists ( p t ) acc then iter acc q else iter ( t :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in iter [ ] l_e... |
module P_attributes = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( true , false ) let p_class_type _ _ = ( true , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = fal... |
module Search_attributes = Search ( P_attributes ) |
let attributes l = let l_ele = Search_attributes . search l ( ) in let p a1 a2 = a1 . att_value . val_name = a2 . att_value . val_name in let rec iter acc = function ( Res_attribute t ) :: q -> if List . exists ( p t ) acc then iter acc q else iter ( t :: acc ) q | _ :: q -> iter... |
module P_methods = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( true , false ) let p_class_type _ _ = ( true , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = false ... |
module Search_methods = Search ( P_methods ) |
let methods l = let l_ele = Search_methods . search l ( ) in let p m1 m2 = m1 . met_value . val_name = m2 . met_value . val_name in let rec iter acc = function ( Res_method t ) :: q -> if List . exists ( p t ) acc then iter acc q else iter ( t :: acc ) q | _ :: q -> iter acc q |... |
module P_classes = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , true ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = false... |
module Search_classes = Search ( P_classes ) |
let classes l = let l_ele = Search_classes . search l ( ) in let p c1 c2 = c1 . cl_name = c2 . cl_name in let rec iter acc = function ( Res_class c ) :: q -> if List . exists ( p c ) acc then iter acc q else iter ( c :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in iter [ ] ... |
module P_class_types = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , true ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = f... |
module Search_class_types = Search ( P_class_types ) |
let class_types l = let l_ele = Search_class_types . search l ( ) in let p c1 c2 = c1 . clt_name = c2 . clt_name in let rec iter acc = function ( Res_class_type c ) :: q -> if List . exists ( p c ) acc then iter acc q else iter ( c :: acc ) q | _ :: q -> iter acc q | [ ] -> acc... |
module P_modules = struct type t = unit let p_module _ _ = ( true , true ) let p_module_type _ _ = ( true , false ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = false... |
module Search_modules = Search ( P_modules ) |
let modules l = let l_ele = Search_modules . search l ( ) in let p m1 m2 = m1 . m_name = m2 . m_name in let rec iter acc = function ( Res_module m ) :: q -> if List . exists ( p m ) acc then iter acc q else iter ( m :: acc ) q | _ :: q -> iter acc q | [ ] -> acc in iter [ ] ... |
module P_module_types = struct type t = unit let p_module _ _ = ( true , false ) let p_module_type _ _ = ( true , true ) let p_class _ _ = ( false , false ) let p_class_type _ _ = ( false , false ) let p_value _ _ = false let p_recfield _ _ _ = false let p_const _ _ _ = ... |
module Search_module_types = Search ( P_module_types ) |
let module_types l = let l_ele = Search_module_types . search l ( ) in let p m1 m2 = m1 . mt_name = m2 . mt_name in let rec iter acc = function ( Res_module_type m ) :: q -> if List . exists ( p m ) acc then iter acc q else iter ( m :: acc ) q | _ :: q -> iter acc q | [ ] -> ac... |
let type_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_type _ -> true | _ -> false ) l |
let value_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_value _ -> true | _ -> false ) l |
let class_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_class _ -> true | _ -> false ) l |
let class_type_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_class_type _ -> true | _ -> false ) l |
let module_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_module _ -> true | _ -> false ) l |
let module_type_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_module_type _ -> true | _ -> false ) l |
let extension_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_extension _ -> true | _ -> false ) l |
let exception_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_exception _ -> true | _ -> false ) l |
let attribute_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_attribute _ -> true | _ -> false ) l |
let method_exists mods regexp = let l = Search_by_name . search mods regexp in List . exists ( function Res_method _ -> true | _ -> false ) l |
let find_section mods regexp = let l = Search_by_name . search mods regexp in match List . find ( function Res_section _ -> true | _ -> false ) l with Res_section ( _ , t ) -> t | _ -> assert false |
module Signature_search = struct type ele = | M of string | MT of string | V of string | T of string | C of string | CT of string | X of string type tab = ( ele , Types . signature_item ) Hashtbl . t let add_to_hash table signat = match signat with Types . Sig_value ( ident , _ , _ ) -... |
module type Info_retriever = sig val all_special : string -> string -> int * ( Odoc_types . info list ) val blank_line_outside_simple : string -> string -> bool val just_after_special : string -> string -> ( int * Odoc_types . info option ) val first_special : string -> string -> ( int * O... |
module Analyser = functor ( My_ir : Info_retriever ) -> struct let file = ref " " let file_name = ref " " let get_string_of_file the_start the_end = try String . sub ! file the_start ( the_end - the_start ) with Invalid_argument _ -> " " let just_after_special start stop = let s = get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.