package odoc

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file names.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module type Name = sig

    type t

    val to_string : t -> string

    val to_string_unsafe : t -> string

    val of_string : string -> t

    val of_ident : Ident.t -> t

    val internal_of_string : string -> t

    val internal_of_ident : Ident.t -> t

    val is_internal : t -> bool

    val equal : t -> t -> bool

    val is_hidden : t -> bool

end

module Name : Name = struct

    type t =
        | Internal of string
        | Std of string

    let to_string = function
        | Std s -> s
        | Internal s -> Printf.sprintf "$%s" s

    let to_string_unsafe = function
        | Std s -> s
        | Internal s -> s

    let of_string s = Std s
    
    let of_ident id = of_string (Ident.name id)

    let internal_of_string id = Internal id

    let internal_of_ident id = internal_of_string (Ident.name id)

    let is_internal = function | Std _ -> false | Internal _ -> true

    let equal (x : t) (y : t) = x = y

    let is_hidden = function
        | Std s ->
            let len = String.length s in
            let rec aux i =
                if i > len - 2 then false else
                if s.[i] = '_' && s.[i + 1] = '_' then true
                else aux (i + 1)
            in aux 0
        | Internal _ -> true
end

module type SimpleName = sig

    type t

    val to_string : t -> string

    val of_string : string -> t

    val of_ident : Ident.t -> t

    val equal : t -> t -> bool

    val is_hidden : t -> bool

end

module SimpleName : SimpleName = struct

    type t = string

    let to_string s = s

    let of_string s = s
    
    let of_ident id = of_string (Ident.name id)

    let equal (x : t) (y : t) = x = y

    let is_hidden s =
        let len = String.length s in
        let rec aux i =
            if i > len - 2 then false else
            if s.[i] = '_' && s.[i + 1] = '_' then true
            else aux (i + 1)
        in aux 0
end

module ModuleName = Name

module ArgumentName = Name

module ModuleTypeName = Name

module TypeName = Name

module ConstructorName = SimpleName

module FieldName = SimpleName

module ExtensionName = SimpleName

module ExceptionName = SimpleName

module ValueName = SimpleName

module ClassName = Name

module ClassTypeName = Name

module MethodName = SimpleName

module InstanceVariableName = SimpleName

module UnitName = SimpleName

module LabelName = SimpleName

module PageName = SimpleName


OCaml

Innovation. Community. Security.