package js_of_ocaml-webidl

  1. Overview
  2. Docs

Source file ast.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
open Core

type primitive =
  [ `Boolean
  | `Byte
  | `Octet
  | `Unrestricted of [ `Float | `Double ]
  | `Float
  | `Double
  | `Unsigned of [ `Short | `Long | `LongLong ]
  | `Short
  | `Long
  | `LongLong
  ]
[@@deriving sexp]

type string_type =
  [ `ByteString
  | `DOMString
  | `USVString
  ]
[@@deriving sexp]

type buffer =
  [ `ArrayBuffer
  | `DataView
  | `Int8Array
  | `Int16Array
  | `Int32Array
  | `Uint8Array
  | `Uint16Array
  | `Uint32Array
  | `Uint8Clampedarray
  | `Float32Array
  | `Float64Array
  ]
[@@deriving sexp]

type 'type_with_ext nullable_non_any_aux =
  [ primitive
  | string_type
  | `Ident of string
  | `Sequence of 'type_with_ext
  | `Object
  | `Error
  | `DomException
  | buffer
  | `FrozenArray of 'type_with_ext
  | `Record of string_type * 'type_with_ext
  ]
[@@deriving sexp]

type ('type_with_ext, 'union_type) nullable_union_aux =
  [ 'type_with_ext nullable_non_any_aux
  | `Union of 'union_type
  ]
[@@deriving sexp]

type ('type_with_ext, 'return_type) non_any_aux =
  [ `Promise of 'return_type
  | `Nullable of 'type_with_ext nullable_non_any_aux
  | 'type_with_ext nullable_non_any_aux
  ]
[@@deriving sexp]

type ('type_with_ext, 'return_type, 'union_type, 'extends) union_member_aux =
  [ `NonAny of 'extends * ('type_with_ext, 'return_type) non_any_aux
  | `Union of 'union_type
  | `Nullable of [ `Union of 'union_type ]
  ]
[@@deriving sexp]

type ('type_with_ext, 'return_type, 'union_type, 'extends) union_type_aux =
  ('type_with_ext, 'return_type, 'union_type, 'extends) union_member_aux
  list
[@@deriving sexp]

type ('type_with_ext, 'return_type, 'union_type) type_aux =
  [ `Promise of 'return_type
  | 'type_with_ext nullable_non_any_aux
  | `Any
  | `Nullable of ('type_with_ext, 'union_type) nullable_union_aux
  | `Union of 'union_type
  ]
[@@deriving sexp]

type ('type_with_ext, 'return_type, 'union_type) return_type_aux =
  [ ('type_with_ext, 'return_type, 'union_type) type_aux
  | `Void
  ]
[@@deriving sexp]

type type_with_ext = extends * type_ [@@deriving sexp]

and type_ = (type_with_ext, return_type, union_type) type_aux
[@@deriving sexp]

and return_type = (type_with_ext, return_type, union_type) return_type_aux
[@@deriving sexp]

and union_type =
  (type_with_ext, return_type, union_type, extends) union_type_aux
[@@deriving sexp]

and nullable_non_any = type_with_ext nullable_non_any_aux [@@deriving sexp]

and non_any = (type_with_ext, return_type) non_any_aux [@@deriving sexp]

and const_value =
  [ `Bool of bool
  | `Float of float
  | `Int of int
  | `Null
  ]
[@@deriving sexp]

and const =
  [ primitive
  | `Ident of string
  ]
[@@deriving sexp]

and default_value =
  [ `Const of const_value
  | `String of string
  | `EmptySequence
  ]
[@@deriving sexp]

and argument =
  [ `Optional of type_with_ext * string * default_value option
  | `Variadic of type_ * string
  | `Fixed of type_ * string
  ]
[@@deriving sexp]

and extended_argument = extends * argument

and extended_attribute =
  [ `Custom of string
  | `NoArgs of string
  | `ArgumentList of string * extended_argument list
  | `NamedArgList of string * string * extended_argument list
  | `Ident of string * string
  | `IdentList of string * string list
  ]
[@@deriving sexp]

and extends = extended_attribute list [@@deriving sexp]

type special =
  [ `Getter
  | `Setter
  | `Deleter
  | `Legacycaller
  ]
[@@deriving sexp]

type operation_rest = string option * (extends * argument) list
[@@deriving sexp]

type no_special_operation =
  [ `NoSpecialOperation of return_type * operation_rest ]
[@@deriving sexp]

type operation =
  [ no_special_operation
  | `SpecialOperation of special list * return_type * operation_rest
  ]
[@@deriving sexp]

type dictionary_member =
  [ `Required of type_with_ext * string * default_value option
  | `NotRequired of type_ * string * default_value option
  ]
[@@deriving sexp]

type dictionary =
  string * string option * (extends * dictionary_member) list
[@@deriving sexp]

type attribute_rest = [ `AttributeRest of type_with_ext * string ]
[@@deriving sexp]

type operation_or_attribute =
  [ no_special_operation
  | attribute_rest
  ]
[@@deriving sexp]

type namespace_member =
  [ no_special_operation
  | `ReadOnly of attribute_rest
  ]
[@@deriving sexp]

type namespace = string * (extends * namespace_member) list
[@@deriving sexp]

type maplike = type_with_ext * type_with_ext [@@deriving sexp]
type setlike = type_with_ext [@@deriving sexp]

type const_type =
  [ const
  | `Nullable of const
  ]
[@@deriving sexp]

type static_member =
  [ operation_or_attribute
  | `ReadOnly of attribute_rest
  ]
[@@deriving sexp]

type readonly_member =
  [ `Maplike of maplike
  | `Setlike of setlike
  | attribute_rest
  ]
[@@deriving sexp]

type attribute =
  [ `Inherit of attribute_rest
  | attribute_rest
  ]
[@@deriving sexp]

type interface_member =
  [ `ReadOnly of readonly_member
  | `Static of static_member
  | `Const of const_type * string * const_value
  | `Operation of operation
  | `Stringifier of [ static_member | `None ]
  | `Iterable of type_with_ext * type_with_ext option
  | `Attribute of attribute
  | `Maplike of maplike
  | `Setlike of setlike
  ]
[@@deriving sexp]

type interface = string * string option * (extends * interface_member) list
[@@deriving sexp]

type mixin_member =
  [ `Attribute of attribute
  | `ReadOnly of readonly_member
  | `Const of const_type * string * const_value
  | `Operation of operation
  | `Stringifier of [ static_member | `None ]
  ]
[@@deriving sexp]

type mixin = string * (extends * mixin_member) list [@@deriving sexp]

type partial =
  [ `PartialInterface of string * (extends * interface_member) list
  | `Mixin of mixin
  | `PartialDictionary of string * (extends * dictionary_member) list
  | `Namespace of namespace
  ]
[@@deriving sexp]

type callback =
  [ `CallbackRest of string * return_type * (extends * argument) list
  | `Interface of interface
  ]
[@@deriving sexp]

type definition =
  [ `Callback of callback
  | `Interface of interface
  | `Mixin of mixin
  | `Namespace of namespace
  | `Partial of partial
  | `Dictionary of dictionary
  | `Enum of string * string list
  | `Typedef of type_with_ext * string
  | `Includes of string * string
  | `Implements of string * string
  ]
[@@deriving sexp]

type definitions = (extends * definition) list [@@deriving sexp]
OCaml

Innovation. Community. Security.