package pfff

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

Source file meta_ast_ml.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
(* generated by ocamltarzan with: camlp4o -o /tmp/yyy.ml -I pa/ pa_type_conv.cmo pa_vof.cmo  pr_o.cmo /tmp/xxx.ml  *)

open Ast_ml

module M = Meta_ast_generic
module PI = Parse_info

let _current_precision = ref M.default_precision

let rec vof_info x =
  if !_current_precision.M.full_info
  then Parse_info.vof_info x
  else if !_current_precision.M.token_info
       then 
        Ocaml.VDict [
          "line", Ocaml.VInt (PI.line_of_info x);
          "col", Ocaml.VInt (PI.col_of_info x);
        ]
      else Ocaml.VUnit


and vof_tok v = vof_info v
and vof_wrap _of_a (v1, v2) =
  let v1 = _of_a v1 and v2 = vof_info v2 in Ocaml.VTuple [ v1; v2 ]
and vof_paren _of_a (v1, v2, v3) =
  let v1 = vof_tok v1
  and v2 = _of_a v2
  and v3 = vof_tok v3
  in Ocaml.VTuple [ v1; v2; v3 ]
and vof_brace _of_a (v1, v2, v3) =
  let v1 = vof_tok v1
  and v2 = _of_a v2
  and v3 = vof_tok v3
  in Ocaml.VTuple [ v1; v2; v3 ]
and vof_bracket _of_a (v1, v2, v3) =
  let v1 = vof_tok v1
  and v2 = _of_a v2
  and v3 = vof_tok v3
  in Ocaml.VTuple [ v1; v2; v3 ]
and vof_comma_list _of_a = Ocaml.vof_list (Ocaml.vof_either _of_a vof_tok)
and vof_and_list _of_a = Ocaml.vof_list (Ocaml.vof_either _of_a vof_tok)
and vof_pipe_list _of_a = Ocaml.vof_list (Ocaml.vof_either _of_a vof_tok)
and vof_semicolon_list _of_a =
  Ocaml.vof_list (Ocaml.vof_either _of_a vof_tok)
and vof_star_list _of_a = Ocaml.vof_list (Ocaml.vof_either _of_a vof_tok)
  
let rec vof_name =
  function
  | Name v1 ->
      let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Name", [ v1 ]))
and _vof_lname v = vof_name v
and vof_uname v = vof_name v
  
let rec vof_long_name (v1, v2) =
  let v1 = vof_qualifier v1 and v2 = vof_name v2 in Ocaml.VTuple [ v1; v2 ]
and vof_qualifier v =
  Ocaml.vof_list
    (fun (v1, v2) ->
       let v1 = vof_name v1 and v2 = vof_tok v2 in Ocaml.VTuple [ v1; v2 ])
    v
  
let rec vof_ty =
  function
  | TyName v1 -> let v1 = vof_long_name v1 in Ocaml.VSum (("TyName", [ v1 ]))
  | TyVar ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      in Ocaml.VSum (("TyVar", [ v1; v2 ]))
  | TyTuple v1 ->
      let v1 = vof_star_list vof_ty v1 in Ocaml.VSum (("TyTuple", [ v1 ]))
  | TyTuple2 v1 ->
      let v1 = vof_paren (vof_star_list vof_ty) v1
      in Ocaml.VSum (("TyTuple2", [ v1 ]))
  | TyFunction ((v1, v2, v3)) ->
      let v1 = vof_ty v1
      and v2 = vof_tok v2
      and v3 = vof_ty v3
      in Ocaml.VSum (("TyFunction", [ v1; v2; v3 ]))
  | TyApp ((v1, v2)) ->
      let v1 = vof_ty_args v1
      and v2 = vof_long_name v2
      in Ocaml.VSum (("TyApp", [ v1; v2 ]))
  | TyTodo -> Ocaml.VSum (("TyTodo", []))
and vof_type_declaration =
  function
  | TyAbstract ((v1, v2)) ->
      let v1 = vof_ty_params v1
      and v2 = vof_name v2
      in Ocaml.VSum (("TyAbstract", [ v1; v2 ]))
  | TyDef ((v1, v2, v3, v4)) ->
      let v1 = vof_ty_params v1
      and v2 = vof_name v2
      and v3 = vof_tok v3
      and v4 = vof_type_def_kind v4
      in Ocaml.VSum (("TyDef", [ v1; v2; v3; v4 ]))
and vof_type_def_kind =
  function
  | TyCore v1 -> let v1 = vof_ty v1 in Ocaml.VSum (("TyCore", [ v1 ]))
  | TyAlgebric v1 ->
      let v1 = vof_pipe_list vof_constructor_declaration v1
      in Ocaml.VSum (("TyAlgebric", [ v1 ]))
  | TyRecord v1 ->
      let v1 = vof_brace (vof_semicolon_list vof_field_declaration) v1
      in Ocaml.VSum (("TyRecord", [ v1 ]))
and vof_constructor_declaration (v1, v2) =
  let v1 = vof_name v1
  and v2 = vof_constructor_arguments v2
  in Ocaml.VTuple [ v1; v2 ]
and vof_constructor_arguments =
  function
  | NoConstrArg -> Ocaml.VSum (("NoConstrArg", []))
  | Of ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_star_list vof_ty v2
      in Ocaml.VSum (("Of", [ v1; v2 ]))
and
  vof_field_declaration {
                          fld_mutable = v_fld_mutable;
                          fld_name = v_fld_name;
                          fld_tok = v_fld_tok;
                          fld_type = v_fld_type
                        } =
  let bnds = [] in
  let arg = vof_ty v_fld_type in
  let bnd = ("fld_type", arg) in
  let bnds = bnd :: bnds in
  let arg = vof_tok v_fld_tok in
  let bnd = ("fld_tok", arg) in
  let bnds = bnd :: bnds in
  let arg = vof_name v_fld_name in
  let bnd = ("fld_name", arg) in
  let bnds = bnd :: bnds in
  let arg = Ocaml.vof_option vof_tok v_fld_mutable in
  let bnd = ("fld_mutable", arg) in
  let bnds = bnd :: bnds in Ocaml.VDict bnds
and vof_ty_args =
  function
  | TyArg1 v1 -> let v1 = vof_ty v1 in Ocaml.VSum (("TyArg1", [ v1 ]))
  | TyArgMulti v1 ->
      let v1 = vof_paren (vof_comma_list vof_ty) v1
      in Ocaml.VSum (("TyArgMulti", [ v1 ]))
and vof_ty_params =
  function
  | TyNoParam -> Ocaml.VSum (("TyNoParam", []))
  | TyParam1 v1 ->
      let v1 = vof_ty_parameter v1 in Ocaml.VSum (("TyParam1", [ v1 ]))
  | TyParamMulti v1 ->
      let v1 = vof_paren (vof_comma_list vof_ty_parameter) v1
      in Ocaml.VSum (("TyParamMulti", [ v1 ]))
and vof_ty_parameter (v1, v2) =
  let v1 = vof_tok v1 and v2 = vof_name v2 in Ocaml.VTuple [ v1; v2 ]
and vof_expr =
  function
  | C v1 -> let v1 = vof_constant v1 in Ocaml.VSum (("C", [ v1 ]))
  | L v1 -> let v1 = vof_long_name v1 in Ocaml.VSum (("L", [ v1 ]))
  | Constr ((v1, v2)) ->
      let v1 = vof_long_name v1
      and v2 = Ocaml.vof_option vof_expr v2
      in Ocaml.VSum (("Constr", [ v1; v2 ]))
  | Tuple v1 ->
      let v1 = vof_comma_list vof_expr v1 in Ocaml.VSum (("Tuple", [ v1 ]))
  | List v1 ->
      let v1 = vof_bracket (vof_semicolon_list vof_expr) v1
      in Ocaml.VSum (("List", [ v1 ]))
  | ParenExpr v1 ->
      let v1 = vof_paren vof_expr v1 in Ocaml.VSum (("ParenExpr", [ v1 ]))
  | Sequence v1 ->
      let v1 = vof_paren vof_seq_expr v1 in Ocaml.VSum (("Sequence", [ v1 ]))
  | Prefix ((v1, v2)) ->
      let v1 = vof_wrap Ocaml.vof_string v1
      and v2 = vof_expr v2
      in Ocaml.VSum (("Prefix", [ v1; v2 ]))
  | Infix ((v1, v2, v3)) ->
      let v1 = vof_expr v1
      and v2 = vof_wrap Ocaml.vof_string v2
      and v3 = vof_expr v3
      in Ocaml.VSum (("Infix", [ v1; v2; v3 ]))
  | FunCallSimple ((v1, v2)) ->
      let v1 = vof_long_name v1
      and v2 = Ocaml.vof_list vof_argument v2
      in Ocaml.VSum (("FunCallSimple", [ v1; v2 ]))
  | FunCall ((v1, v2)) ->
      let v1 = vof_expr v1
      and v2 = Ocaml.vof_list vof_argument v2
      in Ocaml.VSum (("FunCall", [ v1; v2 ]))
  | RefAccess ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_expr v2
      in Ocaml.VSum (("RefAccess", [ v1; v2 ]))
  | RefAssign ((v1, v2, v3)) ->
      let v1 = vof_expr v1
      and v2 = vof_tok v2
      and v3 = vof_expr v3
      in Ocaml.VSum (("RefAssign", [ v1; v2; v3 ]))
  | FieldAccess ((v1, v2, v3)) ->
      let v1 = vof_expr v1
      and v2 = vof_tok v2
      and v3 = vof_long_name v3
      in Ocaml.VSum (("FieldAccess", [ v1; v2; v3 ]))
  | FieldAssign ((v1, v2, v3, v4, v5)) ->
      let v1 = vof_expr v1
      and v2 = vof_tok v2
      and v3 = vof_long_name v3
      and v4 = vof_tok v4
      and v5 = vof_expr v5
      in Ocaml.VSum (("FieldAssign", [ v1; v2; v3; v4; v5 ]))
  | Record v1 ->
      let v1 = vof_brace vof_record_expr v1
      in Ocaml.VSum (("Record", [ v1 ]))
  | ObjAccess ((v1, v2, v3)) ->
      let v1 = vof_expr v1
      and v2 = vof_tok v2
      and v3 = vof_name v3
      in Ocaml.VSum (("ObjAccess", [ v1; v2; v3 ]))
  | New ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_long_name v2
      in Ocaml.VSum (("New", [ v1; v2 ]))
  | LetIn ((v1, v2, v3, v4, v5)) ->
      let v1 = vof_tok v1
      and v2 = vof_rec_opt v2
      and v3 = vof_and_list vof_let_binding v3
      and v4 = vof_tok v4
      and v5 = vof_seq_expr v5
      in Ocaml.VSum (("LetIn", [ v1; v2; v3; v4; v5 ]))
  | Fun ((v1, v2, v3)) ->
      let v1 = vof_tok v1
      and v2 = Ocaml.vof_list vof_parameter v2
      and v3 = vof_match_action v3
      in Ocaml.VSum (("Fun", [ v1; v2; v3 ]))
  | Function ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_pipe_list vof_match_case v2
      in Ocaml.VSum (("Function", [ v1; v2 ]))
  | If ((v1, v2, v3, v4, v5)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      and v3 = vof_tok v3
      and v4 = vof_expr v4
      and v5 =
        Ocaml.vof_option
          (fun (v1, v2) ->
             let v1 = vof_tok v1
             and v2 = vof_expr v2
             in Ocaml.VTuple [ v1; v2 ])
          v5
      in Ocaml.VSum (("If", [ v1; v2; v3; v4; v5 ]))
  | Match ((v1, v2, v3, v4)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      and v3 = vof_tok v3
      and v4 = vof_pipe_list vof_match_case v4
      in Ocaml.VSum (("Match", [ v1; v2; v3; v4 ]))
  | Try ((v1, v2, v3, v4)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      and v3 = vof_tok v3
      and v4 = vof_pipe_list vof_match_case v4
      in Ocaml.VSum (("Try", [ v1; v2; v3; v4 ]))
  | While ((v1, v2, v3, v4, v5)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      and v3 = vof_tok v3
      and v4 = vof_seq_expr v4
      and v5 = vof_tok v5
      in Ocaml.VSum (("While", [ v1; v2; v3; v4; v5 ]))
  | For ((v1, v2, v3, v4, v5, v6, v7, v8, v9)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      and v3 = vof_tok v3
      and v4 = vof_seq_expr v4
      and v5 = vof_for_direction v5
      and v6 = vof_seq_expr v6
      and v7 = vof_tok v7
      and v8 = vof_seq_expr v8
      and v9 = vof_tok v9
      in Ocaml.VSum (("For", [ v1; v2; v3; v4; v5; v6; v7; v8; v9 ]))
  | ExprTodo -> Ocaml.VSum (("ExprTodo", []))
and vof_seq_expr v = vof_semicolon_list vof_expr v
and vof_constant =
  function
  | Int v1 ->
      let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Int", [ v1 ]))
  | Float v1 ->
      let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Float", [ v1 ]))
  | Char v1 ->
      let v1 = vof_wrap Ocaml.vof_string v1 in Ocaml.VSum (("Char", [ v1 ]))
  | String v1 ->
      let v1 = vof_wrap Ocaml.vof_string v1
      in Ocaml.VSum (("String", [ v1 ]))
and vof_record_expr =
  function
  | RecordNormal v1 ->
      let v1 = vof_semicolon_list vof_field_and_expr v1
      in Ocaml.VSum (("RecordNormal", [ v1 ]))
  | RecordWith ((v1, v2, v3)) ->
      let v1 = vof_expr v1
      and v2 = vof_tok v2
      and v3 = vof_semicolon_list vof_field_and_expr v3
      in Ocaml.VSum (("RecordWith", [ v1; v2; v3 ]))
and vof_field_and_expr =
  function
  | FieldExpr ((v1, v2, v3)) ->
      let v1 = vof_long_name v1
      and v2 = vof_tok v2
      and v3 = vof_expr v3
      in Ocaml.VSum (("FieldExpr", [ v1; v2; v3 ]))
  | FieldImplicitExpr v1 ->
      let v1 = vof_long_name v1 in Ocaml.VSum (("FieldImplicitExpr", [ v1 ]))
and vof_argument =
  function
  | ArgExpr v1 -> let v1 = vof_expr v1 in Ocaml.VSum (("ArgExpr", [ v1 ]))
  | ArgLabelTilde ((v1, v2)) ->
      let v1 = vof_name v1
      and v2 = vof_expr v2
      in Ocaml.VSum (("ArgLabelTilde", [ v1; v2 ]))
  | ArgImplicitTildeExpr ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      in Ocaml.VSum (("ArgImplicitTildeExpr", [ v1; v2 ]))
  | ArgLabelQuestion ((v1, v2)) ->
      let v1 = vof_name v1
      and v2 = vof_expr v2
      in Ocaml.VSum (("ArgLabelQuestion", [ v1; v2 ]))
  | ArgImplicitQuestionExpr ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      in Ocaml.VSum (("ArgImplicitQuestionExpr", [ v1; v2 ]))
and vof_match_action =
  function
  | Action ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      in Ocaml.VSum (("Action", [ v1; v2 ]))
  | WhenAction ((v1, v2, v3, v4)) ->
      let v1 = vof_tok v1
      and v2 = vof_seq_expr v2
      and v3 = vof_tok v3
      and v4 = vof_seq_expr v4
      in Ocaml.VSum (("WhenAction", [ v1; v2; v3; v4 ]))
and vof_match_case (v1, v2) =
  let v1 = vof_pattern v1
  and v2 = vof_match_action v2
  in Ocaml.VTuple [ v1; v2 ]
and vof_for_direction =
  function
  | To v1 -> let v1 = vof_tok v1 in Ocaml.VSum (("To", [ v1 ]))
  | Downto v1 -> let v1 = vof_tok v1 in Ocaml.VSum (("Downto", [ v1 ]))
and vof_pattern =
  function
  | PatVar v1 -> let v1 = vof_name v1 in Ocaml.VSum (("PatVar", [ v1 ]))
  | PatConstant v1 ->
      let v1 = vof_signed_constant v1 in Ocaml.VSum (("PatConstant", [ v1 ]))
  | PatConstr ((v1, v2)) ->
      let v1 = vof_long_name v1
      and v2 = Ocaml.vof_option vof_pattern v2
      in Ocaml.VSum (("PatConstr", [ v1; v2 ]))
  | PatConsInfix ((v1, v2, v3)) ->
      let v1 = vof_pattern v1
      and v2 = vof_tok v2
      and v3 = vof_pattern v3
      in Ocaml.VSum (("PatConsInfix", [ v1; v2; v3 ]))
  | PatTuple v1 ->
      let v1 = vof_comma_list vof_pattern v1
      in Ocaml.VSum (("PatTuple", [ v1 ]))
  | PatList v1 ->
      let v1 = vof_bracket (vof_semicolon_list vof_pattern) v1
      in Ocaml.VSum (("PatList", [ v1 ]))
  | PatUnderscore v1 ->
      let v1 = vof_tok v1 in Ocaml.VSum (("PatUnderscore", [ v1 ]))
  | PatRecord v1 ->
      let v1 = vof_brace (vof_semicolon_list vof_field_pattern) v1
      in Ocaml.VSum (("PatRecord", [ v1 ]))
  | PatAs ((v1, v2, v3)) ->
      let v1 = vof_pattern v1
      and v2 = vof_tok v2
      and v3 = vof_name v3
      in Ocaml.VSum (("PatAs", [ v1; v2; v3 ]))
  | PatDisj ((v1, v2, v3)) ->
      let v1 = vof_pattern v1
      and v2 = vof_tok v2
      and v3 = vof_pattern v3
      in Ocaml.VSum (("PatDisj", [ v1; v2; v3 ]))
  | PatTyped ((v1, v2, v3, v4, v5)) ->
      let v1 = vof_tok v1
      and v2 = vof_pattern v2
      and v3 = vof_tok v3
      and v4 = vof_ty v4
      and v5 = vof_tok v5
      in Ocaml.VSum (("PatTyped", [ v1; v2; v3; v4; v5 ]))
  | ParenPat v1 ->
      let v1 = vof_paren vof_pattern v1 in Ocaml.VSum (("ParenPat", [ v1 ]))
  | PatTodo -> Ocaml.VSum (("PatTodo", []))
and _vof_labeled_simple_pattern v = vof_parameter v
and vof_parameter =
  function
  | ParamPat v1 ->
      let v1 = vof_pattern v1 in Ocaml.VSum (("ParamPat", [ v1 ]))
  | ParamTodo -> Ocaml.VSum (("ParamTodo", []))

and vof_signed_constant =
  function
  | C2 v1 -> let v1 = vof_constant v1 in Ocaml.VSum (("C2", [ v1 ]))
  | CMinus ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_constant v2
      in Ocaml.VSum (("CMinus", [ v1; v2 ]))
  | CPlus ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_constant v2
      in Ocaml.VSum (("CPlus", [ v1; v2 ]))
and vof_field_pattern =
  function
  | PatField ((v1, v2, v3)) ->
      let v1 = vof_long_name v1
      and v2 = vof_tok v2
      and v3 = vof_pattern v3
      in Ocaml.VSum (("PatField", [ v1; v2; v3 ]))
  | PatImplicitField v1 ->
      let v1 = vof_long_name v1 in Ocaml.VSum (("PatImplicitField", [ v1 ]))
and vof_let_binding =
  function
  | LetClassic v1 ->
      let v1 = vof_let_def v1 in Ocaml.VSum (("LetClassic", [ v1 ]))
  | LetPattern ((v1, v2, v3)) ->
      let v1 = vof_pattern v1
      and v2 = vof_tok v2
      and v3 = vof_seq_expr v3
      in Ocaml.VSum (("LetPattern", [ v1; v2; v3 ]))
and
  vof_let_def {
                l_name = v_l_name;
                l_params = v_l_args;
                l_tok = v_l_tok;
                l_body = v_l_body
              } =
  let bnds = [] in
  let arg = vof_seq_expr v_l_body in
  let bnd = ("l_body", arg) in
  let bnds = bnd :: bnds in
  let arg = vof_tok v_l_tok in
  let bnd = ("l_tok", arg) in
  let bnds = bnd :: bnds in
  let arg = Ocaml.vof_list vof_parameter v_l_args in
  let bnd = ("l_args", arg) in
  let bnds = bnd :: bnds in
  let arg = vof_name v_l_name in
  let bnd = ("l_name", arg) in let bnds = bnd :: bnds in Ocaml.VDict bnds
and _vof_function_def v = Ocaml.vof_unit v
and _vof_module_type v = Ocaml.vof_unit v
and vof_module_expr = function
  | ModuleName v1 ->
      let v1 = vof_long_name v1 in
      Ocaml.VSum(("ModuleName", [ v1 ]))
  | ModuleStruct (v1, v2, v3) ->
      let v1 = vof_tok v1 in
      let v2 = Ocaml.vof_list vof_item v2 in
      let v3 = vof_tok v3 in
      Ocaml.VSum("ModuleStruct", [v1; v2; v3])
  | ModuleTodo ->
      Ocaml.VSum(("ModuleTodo", []))

and vof_item =
  function
  | Type ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_and_list vof_type_declaration v2
      in Ocaml.VSum (("Type", [ v1; v2 ]))
  | Exception ((v1, v2, v3)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      and v3 = vof_constructor_arguments v3
      in Ocaml.VSum (("Exception", [ v1; v2; v3 ]))
  | External ((v1, v2, v3, v4, v5, v6)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      and v3 = vof_tok v3
      and v4 = vof_ty v4
      and v5 = vof_tok v5
      and v6 = Ocaml.vof_list (vof_wrap Ocaml.vof_string) v6
      in Ocaml.VSum (("External", [ v1; v2; v3; v4; v5; v6 ]))
  | Open ((v1, v2)) ->
      let v1 = vof_tok v1
      and v2 = vof_long_name v2
      in Ocaml.VSum (("Open", [ v1; v2 ]))
  | Val ((v1, v2, v3, v4)) ->
      let v1 = vof_tok v1
      and v2 = vof_name v2
      and v3 = vof_tok v3
      and v4 = vof_ty v4
      in Ocaml.VSum (("Val", [ v1; v2; v3; v4 ]))
  | Let ((v1, v2, v3)) ->
      let v1 = vof_tok v1
      and v2 = vof_rec_opt v2
      and v3 = vof_and_list vof_let_binding v3
      in Ocaml.VSum (("Let", [ v1; v2; v3 ]))
  | Module ((v1, v2, v3, v4)) ->
      let v1 = vof_tok v1
      and v2 = vof_uname v2
      and v3 = vof_tok v3
      and v4 = vof_module_expr v4
      in Ocaml.VSum (("Module", [v1; v2; v3; v4]))
      

  | ItemTodo v1 -> let v1 = vof_info v1 in Ocaml.VSum (("ItemTodo", [ v1 ]))
and _vof_sig_item v = vof_item v
and _vof_struct_item v = vof_item v
and vof_rec_opt v = Ocaml.vof_option vof_tok v
and vof_toplevel =
  function
  | TopItem v1 -> let v1 = vof_item v1 in Ocaml.VSum (("TopItem", [ v1 ]))
  | ScSc v1 -> let v1 = vof_info v1 in Ocaml.VSum (("ScSc", [ v1 ]))
  | TopSeqExpr v1 ->
      let v1 = vof_seq_expr v1 in Ocaml.VSum (("TopSeqExpr", [ v1 ]))
  | TopDirective v1 ->
      let v1 = vof_info v1 in Ocaml.VSum (("TopDirective", [ v1 ]))
and vof_program v = Ocaml.vof_list vof_toplevel v
  
let vof_any =
  function
  | Ty v1 -> let v1 = vof_ty v1 in Ocaml.VSum (("Ty", [ v1 ]))
  | Expr v1 -> let v1 = vof_expr v1 in Ocaml.VSum (("Expr", [ v1 ]))
  | Pattern v1 -> let v1 = vof_pattern v1 in Ocaml.VSum (("Pattern", [ v1 ]))
  | Item v1 -> let v1 = vof_item v1 in Ocaml.VSum (("Item", [ v1 ]))
  | Toplevel v1 ->
      let v1 = vof_toplevel v1 in Ocaml.VSum (("Toplevel", [ v1 ]))
  | Program v1 -> let v1 = vof_program v1 in Ocaml.VSum (("Program", [ v1 ]))
  | TypeDeclaration v1 ->
      let v1 = vof_type_declaration v1
      in Ocaml.VSum (("TypeDeclaration", [ v1 ]))
  | TypeDefKind v1 ->
      let v1 = vof_type_def_kind v1 in Ocaml.VSum (("TypeDefKind", [ v1 ]))
  | FieldDeclaration v1 ->
      let v1 = vof_field_declaration v1
      in Ocaml.VSum (("FieldDeclaration", [ v1 ]))
  | MatchCase v1 ->
      let v1 = vof_match_case v1 in Ocaml.VSum (("MatchCase", [ v1 ]))
  | LetBinding v1 ->
      let v1 = vof_let_binding v1 in Ocaml.VSum (("LetBinding", [ v1 ]))
  | Constant v1 ->
      let v1 = vof_constant v1 in Ocaml.VSum (("Constant", [ v1 ]))
  | Argument v1 ->
      let v1 = vof_argument v1 in Ocaml.VSum (("Argument", [ v1 ]))
  | Body v1 -> let v1 = vof_seq_expr v1 in Ocaml.VSum (("Body", [ v1 ]))
  | Info v1 -> let v1 = vof_info v1 in Ocaml.VSum (("Info", [ v1 ]))
  | InfoList v1 ->
      let v1 = Ocaml.vof_list vof_info v1
      in Ocaml.VSum (("InfoList", [ v1 ]))
  
OCaml

Innovation. Community. Security.