package ppx_open

  1. Overview
  2. Docs

Source file parser.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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803

module MenhirBasics = struct
  
  exception Error
  
  let _eRR =
    fun _s ->
      raise Error
  
  type token = 
    | UPPER_IDENT of (
# 20 "lib/parsing/parser.mly"
       (string)
# 15 "lib/parsing/parser.ml"
  )
    | TYPE
    | RPAREN
    | MODULE
    | LPAREN
    | LOWER_IDENT of (
# 19 "lib/parsing/parser.mly"
       (string)
# 24 "lib/parsing/parser.ml"
  )
    | EOF
    | DOT
    | COMMA
    | AS
  
end

include MenhirBasics

# 1 "lib/parsing/parser.mly"
  
open Ppxlib
open Parsed


# 41 "lib/parsing/parser.ml"

type ('s, 'r) _menhir_state = 
  | MenhirState08 : ('s _menhir_cell0_mod_longident, _menhir_box_open_payload) _menhir_state
    (** State 08.
        Stack shape : mod_longident.
        Start symbol: open_payload. *)

  | MenhirState09 : (('s, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_state
    (** State 09.
        Stack shape : TYPE.
        Start symbol: open_payload. *)

  | MenhirState17 : ((('s, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_type_ident _menhir_cell0_type_item_kind, _menhir_box_open_payload) _menhir_state
    (** State 17.
        Stack shape : TYPE type_ident type_item_kind.
        Start symbol: open_payload. *)

  | MenhirState21 : (('s, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_state
    (** State 21.
        Stack shape : MODULE.
        Start symbol: open_payload. *)

  | MenhirState23 : ((('s, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_state
    (** State 23.
        Stack shape : MODULE TYPE.
        Start symbol: open_payload. *)

  | MenhirState24 : (((('s, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_mod_ident, _menhir_box_open_payload) _menhir_state
    (** State 24.
        Stack shape : MODULE TYPE mod_ident.
        Start symbol: open_payload. *)

  | MenhirState25 : ((('s, _menhir_box_open_payload) _menhir_cell1_mod_ident, _menhir_box_open_payload) _menhir_cell1_AS, _menhir_box_open_payload) _menhir_state
    (** State 25.
        Stack shape : mod_ident AS.
        Start symbol: open_payload. *)

  | MenhirState29 : ((('s, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_mod_ident, _menhir_box_open_payload) _menhir_state
    (** State 29.
        Stack shape : MODULE mod_ident.
        Start symbol: open_payload. *)

  | MenhirState34 : (('s, _menhir_box_open_payload) _menhir_cell1_val_ident, _menhir_box_open_payload) _menhir_state
    (** State 34.
        Stack shape : val_ident.
        Start symbol: open_payload. *)

  | MenhirState41 : (('s, _menhir_box_open_payload) _menhir_cell1_open_item, _menhir_box_open_payload) _menhir_state
    (** State 41.
        Stack shape : open_item.
        Start symbol: open_payload. *)


and ('s, 'r) _menhir_cell1_mod_ident = 
  | MenhirCell1_mod_ident of 's * ('s, 'r) _menhir_state * (string)

and 's _menhir_cell0_mod_longident = 
  | MenhirCell0_mod_longident of 's * (Ppxlib.longident)

and ('s, 'r) _menhir_cell1_open_item = 
  | MenhirCell1_open_item of 's * ('s, 'r) _menhir_state * (Parsed.Item.t)

and ('s, 'r) _menhir_cell1_type_ident = 
  | MenhirCell1_type_ident of 's * ('s, 'r) _menhir_state * (string)

and 's _menhir_cell0_type_item_kind = 
  | MenhirCell0_type_item_kind of 's * (Parsed.Type.kind)

and ('s, 'r) _menhir_cell1_val_ident = 
  | MenhirCell1_val_ident of 's * ('s, 'r) _menhir_state * (string)

and ('s, 'r) _menhir_cell1_AS = 
  | MenhirCell1_AS of 's * ('s, 'r) _menhir_state

and ('s, 'r) _menhir_cell1_MODULE = 
  | MenhirCell1_MODULE of 's * ('s, 'r) _menhir_state

and ('s, 'r) _menhir_cell1_TYPE = 
  | MenhirCell1_TYPE of 's * ('s, 'r) _menhir_state

and _menhir_box_open_payload = 
  | MenhirBox_open_payload of (Parsed.Payload.t) [@@unboxed]

let _menhir_action_01 =
  fun _1 ->
    (
# 95 "lib/parsing/parser.mly"
                            ( _1 )
# 130 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_02 =
  fun _1 ->
    (
# 95 "lib/parsing/parser.mly"
                            ( _1 )
# 138 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_03 =
  fun _1 ->
    (
# 95 "lib/parsing/parser.mly"
                            ( _1 )
# 146 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_04 =
  fun _1 ->
    (
# 107 "lib/parsing/parser.mly"
                      ( Lident _1 )
# 154 "lib/parsing/parser.ml"
     : (Ppxlib.longident))

let _menhir_action_05 =
  fun _1 _3 ->
    (
# 108 "lib/parsing/parser.mly"
                      ( Ldot (_1, _3) )
# 162 "lib/parsing/parser.ml"
     : (Ppxlib.longident))

let _menhir_action_06 =
  fun () ->
    (
# 145 "<standard.mly>"
    ( [] )
# 170 "lib/parsing/parser.ml"
     : (Parsed.Item.t list))

let _menhir_action_07 =
  fun x ->
    (
# 148 "<standard.mly>"
    ( x )
# 178 "lib/parsing/parser.ml"
     : (Parsed.Item.t list))

let _menhir_action_08 =
  fun _1 ->
    (
# 118 "lib/parsing/parser.mly"
                ( _1 )
# 186 "lib/parsing/parser.ml"
     : (string))

let _menhir_action_09 =
  fun _2 _3 ->
    (
# 61 "lib/parsing/parser.mly"
                                      ( Module.{ mod_ident=_2; mod_alias=_3 } )
# 194 "lib/parsing/parser.ml"
     : (Parsed.Module.t))

let _menhir_action_10 =
  fun _1 ->
    (
# 121 "lib/parsing/parser.mly"
                                           ( _1 )
# 202 "lib/parsing/parser.ml"
     : (Ppxlib.longident))

let _menhir_action_11 =
  fun _3 _4 ->
    (
# 64 "lib/parsing/parser.mly"
                                          ( Module_type.{ mod_type_ident=_3; mod_type_alias=_4 } )
# 210 "lib/parsing/parser.ml"
     : (Parsed.Module_type.t))

let _menhir_action_12 =
  fun _1 ->
    (
# 48 "lib/parsing/parser.mly"
                  ( Item.Type _1 )
# 218 "lib/parsing/parser.ml"
     : (Parsed.Item.t))

let _menhir_action_13 =
  fun _1 ->
    (
# 49 "lib/parsing/parser.mly"
                  ( Item.Value _1 )
# 226 "lib/parsing/parser.ml"
     : (Parsed.Item.t))

let _menhir_action_14 =
  fun _1 ->
    (
# 50 "lib/parsing/parser.mly"
                  ( Item.Module _1 )
# 234 "lib/parsing/parser.ml"
     : (Parsed.Item.t))

let _menhir_action_15 =
  fun _1 ->
    (
# 51 "lib/parsing/parser.mly"
                  ( Item.Module_type _1 )
# 242 "lib/parsing/parser.ml"
     : (Parsed.Item.t))

let _menhir_action_16 =
  fun _1 ->
    (
# 42 "lib/parsing/parser.mly"
                            ( _1 )
# 250 "lib/parsing/parser.ml"
     : (Parsed.Payload.t))

let _menhir_action_17 =
  fun _1 xs ->
    let _4 = 
# 241 "<standard.mly>"
    ( xs )
# 258 "lib/parsing/parser.ml"
     in
    (
# 45 "lib/parsing/parser.mly"
                                                                     ( Payload.{ open_mod_ident=_1; open_items=_4 } )
# 263 "lib/parsing/parser.ml"
     : (Parsed.Payload.t))

let _menhir_action_18 =
  fun () ->
    (
# 111 "<standard.mly>"
    ( None )
# 271 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_19 =
  fun _2 ->
    let x = 
# 95 "lib/parsing/parser.mly"
                    ( _2 )
# 279 "lib/parsing/parser.ml"
     in
    (
# 114 "<standard.mly>"
    ( Some x )
# 284 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_20 =
  fun () ->
    (
# 111 "<standard.mly>"
    ( None )
# 292 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_21 =
  fun _2 ->
    let x = 
# 95 "lib/parsing/parser.mly"
                    ( _2 )
# 300 "lib/parsing/parser.ml"
     in
    (
# 114 "<standard.mly>"
    ( Some x )
# 305 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_22 =
  fun () ->
    (
# 111 "<standard.mly>"
    ( None )
# 313 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_23 =
  fun _2 ->
    let x = 
# 95 "lib/parsing/parser.mly"
                    ( _2 )
# 321 "lib/parsing/parser.ml"
     in
    (
# 114 "<standard.mly>"
    ( Some x )
# 326 "lib/parsing/parser.ml"
     : (string option))

let _menhir_action_24 =
  fun x ->
    (
# 250 "<standard.mly>"
    ( [ x ] )
# 334 "lib/parsing/parser.ml"
     : (Parsed.Item.t list))

let _menhir_action_25 =
  fun x xs ->
    (
# 253 "<standard.mly>"
    ( x :: xs )
# 342 "lib/parsing/parser.ml"
     : (Parsed.Item.t list))

let _menhir_action_26 =
  fun _1 ->
    (
# 115 "lib/parsing/parser.mly"
                ( _1 )
# 350 "lib/parsing/parser.ml"
     : (string))

let _menhir_action_27 =
  fun _2 _3 _4 ->
    (
# 58 "lib/parsing/parser.mly"
                                                    ( Type.{ type_ident=_2; type_kind=_3; type_alias=_4 } )
# 358 "lib/parsing/parser.ml"
     : (Parsed.Type.t))

let _menhir_action_28 =
  fun () ->
    (
# 81 "lib/parsing/parser.mly"
                            ( Type.Kind_closed )
# 366 "lib/parsing/parser.ml"
     : (Parsed.Type.kind))

let _menhir_action_29 =
  fun () ->
    (
# 82 "lib/parsing/parser.mly"
                            ( Type.Kind_open   )
# 374 "lib/parsing/parser.ml"
     : (Parsed.Type.kind))

let _menhir_action_30 =
  fun _1 ->
    (
# 111 "lib/parsing/parser.mly"
                ( _1 )
# 382 "lib/parsing/parser.ml"
     : (string))

let _menhir_action_31 =
  fun _1 _2 ->
    (
# 55 "lib/parsing/parser.mly"
                             ( Value.{ val_ident=_1; val_alias=_2 } )
# 390 "lib/parsing/parser.ml"
     : (Parsed.Value.t))

let _menhir_print_token : token -> string =
  fun _tok ->
    match _tok with
    | AS ->
        "AS"
    | COMMA ->
        "COMMA"
    | DOT ->
        "DOT"
    | EOF ->
        "EOF"
    | LOWER_IDENT _ ->
        "LOWER_IDENT"
    | LPAREN ->
        "LPAREN"
    | MODULE ->
        "MODULE"
    | RPAREN ->
        "RPAREN"
    | TYPE ->
        "TYPE"
    | UPPER_IDENT _ ->
        "UPPER_IDENT"

let _menhir_fail : unit -> 'a =
  fun () ->
    Printf.eprintf "Internal failure -- please contact the parser generator's developers.\n%!";
    assert false

include struct
  
  [@@@ocaml.warning "-4-37"]
  
  let _menhir_goto_loption_separated_nonempty_list_COMMA_open_item__ : type  ttv_stack. ttv_stack _menhir_cell0_mod_longident -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      let MenhirCell0_mod_longident (_menhir_stack, _1) = _menhir_stack in
      let xs = _v in
      let _v = _menhir_action_17 _1 xs in
      match (_tok : MenhirBasics.token) with
      | EOF ->
          let _1 = _v in
          let _v = _menhir_action_16 _1 in
          MenhirBox_open_payload _v
      | _ ->
          _eRR ()
  
  let _menhir_run_39 : type  ttv_stack. ttv_stack _menhir_cell0_mod_longident -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v ->
      let x = _v in
      let _v = _menhir_action_07 x in
      _menhir_goto_loption_separated_nonempty_list_COMMA_open_item__ _menhir_stack _menhir_lexbuf _menhir_lexer _v
  
  let rec _menhir_goto_separated_nonempty_list_COMMA_open_item_ : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      match _menhir_s with
      | MenhirState41 ->
          _menhir_run_42 _menhir_stack _menhir_lexbuf _menhir_lexer _v
      | MenhirState08 ->
          _menhir_run_39 _menhir_stack _menhir_lexbuf _menhir_lexer _v
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_42 : type  ttv_stack. (ttv_stack, _menhir_box_open_payload) _menhir_cell1_open_item -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v ->
      let MenhirCell1_open_item (_menhir_stack, _menhir_s, x) = _menhir_stack in
      let xs = _v in
      let _v = _menhir_action_25 x xs in
      _menhir_goto_separated_nonempty_list_COMMA_open_item_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
  
  let rec _menhir_run_09 : type  ttv_stack. ttv_stack -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
      let _menhir_stack = MenhirCell1_TYPE (_menhir_stack, _menhir_s) in
      let _menhir_s = MenhirState09 in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | LOWER_IDENT _v ->
          _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
      | _ ->
          _eRR ()
  
  and _menhir_run_10 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      let _1 = _v in
      let _v = _menhir_action_26 _1 in
      _menhir_goto_type_ident _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_type_ident : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState17 ->
          _menhir_run_18 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | MenhirState09 ->
          _menhir_run_11 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_18 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_type_ident _menhir_cell0_type_item_kind -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _2 = _v in
      let _v = _menhir_action_21 _2 in
      _menhir_goto_option___anonymous_0_type_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
  
  and _menhir_goto_option___anonymous_0_type_ident__ : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_type_ident _menhir_cell0_type_item_kind -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _1 = _v in
      let _v = _menhir_action_02 _1 in
      let MenhirCell0_type_item_kind (_menhir_stack, _3) = _menhir_stack in
      let MenhirCell1_type_ident (_menhir_stack, _, _2) = _menhir_stack in
      let MenhirCell1_TYPE (_menhir_stack, _menhir_s) = _menhir_stack in
      let _4 = _v in
      let _v = _menhir_action_27 _2 _3 _4 in
      let _1 = _v in
      let _v = _menhir_action_12 _1 in
      _menhir_goto_open_item _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_open_item : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match (_tok : MenhirBasics.token) with
      | COMMA ->
          let _menhir_stack = MenhirCell1_open_item (_menhir_stack, _menhir_s, _v) in
          let _menhir_s = MenhirState41 in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | TYPE ->
              _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
          | MODULE ->
              _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
          | LOWER_IDENT _v ->
              _menhir_run_31 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
          | _ ->
              _eRR ())
      | RPAREN ->
          let x = _v in
          let _v = _menhir_action_24 x in
          _menhir_goto_separated_nonempty_list_COMMA_open_item_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
      | _ ->
          _eRR ()
  
  and _menhir_run_21 : type  ttv_stack. ttv_stack -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
      let _menhir_stack = MenhirCell1_MODULE (_menhir_stack, _menhir_s) in
      let _menhir_s = MenhirState21 in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | UPPER_IDENT _v ->
          _menhir_run_22 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
      | TYPE ->
          let _menhir_stack = MenhirCell1_TYPE (_menhir_stack, _menhir_s) in
          let _menhir_s = MenhirState23 in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | UPPER_IDENT _v ->
              _menhir_run_22 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_run_22 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      let _1 = _v in
      let _v = _menhir_action_08 _1 in
      _menhir_goto_mod_ident _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_mod_ident : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState21 ->
          _menhir_run_29 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | MenhirState25 ->
          _menhir_run_26 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | MenhirState23 ->
          _menhir_run_24 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_29 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_MODULE as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _menhir_stack = MenhirCell1_mod_ident (_menhir_stack, _menhir_s, _v) in
      match (_tok : MenhirBasics.token) with
      | AS ->
          _menhir_run_25 _menhir_stack _menhir_lexbuf _menhir_lexer MenhirState29
      | COMMA | RPAREN ->
          let _menhir_s = MenhirState29 in
          let _v = _menhir_action_18 () in
          _menhir_goto_option___anonymous_0_mod_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_25 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_mod_ident as 'stack) -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s ->
      let _menhir_stack = MenhirCell1_AS (_menhir_stack, _menhir_s) in
      let _menhir_s = MenhirState25 in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | UPPER_IDENT _v ->
          _menhir_run_22 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
      | _ ->
          _eRR ()
  
  and _menhir_goto_option___anonymous_0_mod_ident__ : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_mod_ident as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _1 = _v in
      let _v = _menhir_action_01 _1 in
      _menhir_goto_as__mod_ident_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_as__mod_ident_ : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_mod_ident as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState29 ->
          _menhir_run_30 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | MenhirState24 ->
          _menhir_run_28 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
  
  and _menhir_run_30 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_mod_ident -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell1_mod_ident (_menhir_stack, _, _2) = _menhir_stack in
      let MenhirCell1_MODULE (_menhir_stack, _menhir_s) = _menhir_stack in
      let _3 = _v in
      let _v = _menhir_action_09 _2 _3 in
      let _1 = _v in
      let _v = _menhir_action_14 _1 in
      _menhir_goto_open_item _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_run_28 : type  ttv_stack. (((ttv_stack, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_mod_ident -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell1_mod_ident (_menhir_stack, _, _3) = _menhir_stack in
      let MenhirCell1_TYPE (_menhir_stack, _) = _menhir_stack in
      let MenhirCell1_MODULE (_menhir_stack, _menhir_s) = _menhir_stack in
      let _4 = _v in
      let _v = _menhir_action_11 _3 _4 in
      let _1 = _v in
      let _v = _menhir_action_15 _1 in
      _menhir_goto_open_item _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_run_26 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_mod_ident, _menhir_box_open_payload) _menhir_cell1_AS -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let MenhirCell1_AS (_menhir_stack, _menhir_s) = _menhir_stack in
      let _2 = _v in
      let _v = _menhir_action_19 _2 in
      _menhir_goto_option___anonymous_0_mod_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_run_24 : type  ttv_stack. (((ttv_stack, _menhir_box_open_payload) _menhir_cell1_MODULE, _menhir_box_open_payload) _menhir_cell1_TYPE as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _menhir_stack = MenhirCell1_mod_ident (_menhir_stack, _menhir_s, _v) in
      match (_tok : MenhirBasics.token) with
      | AS ->
          _menhir_run_25 _menhir_stack _menhir_lexbuf _menhir_lexer MenhirState24
      | COMMA | RPAREN ->
          let _menhir_s = MenhirState24 in
          let _v = _menhir_action_18 () in
          _menhir_goto_option___anonymous_0_mod_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_31 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      let _1 = _v in
      let _v = _menhir_action_30 _1 in
      _menhir_goto_val_ident _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_val_ident : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState34 ->
          _menhir_run_35 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | MenhirState41 ->
          _menhir_run_33 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | MenhirState08 ->
          _menhir_run_33 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_35 : type  ttv_stack. (ttv_stack, _menhir_box_open_payload) _menhir_cell1_val_ident -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _2 = _v in
      let _v = _menhir_action_23 _2 in
      _menhir_goto_option___anonymous_0_val_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
  
  and _menhir_goto_option___anonymous_0_val_ident__ : type  ttv_stack. (ttv_stack, _menhir_box_open_payload) _menhir_cell1_val_ident -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _1 = _v in
      let _v = _menhir_action_03 _1 in
      let MenhirCell1_val_ident (_menhir_stack, _menhir_s, _1) = _menhir_stack in
      let _2 = _v in
      let _v = _menhir_action_31 _1 _2 in
      let _1 = _v in
      let _v = _menhir_action_13 _1 in
      _menhir_goto_open_item _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_run_33 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _menhir_stack = MenhirCell1_val_ident (_menhir_stack, _menhir_s, _v) in
      match (_tok : MenhirBasics.token) with
      | AS ->
          let _menhir_s = MenhirState34 in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | LOWER_IDENT _v ->
              _menhir_run_31 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
          | _ ->
              _eRR ())
      | COMMA | RPAREN ->
          let _v = _menhir_action_22 () in
          _menhir_goto_option___anonymous_0_val_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_11 : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_TYPE as 'stack) -> _ -> _ -> _ -> ('stack, _menhir_box_open_payload) _menhir_state -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      let _menhir_stack = MenhirCell1_type_ident (_menhir_stack, _menhir_s, _v) in
      match (_tok : MenhirBasics.token) with
      | LPAREN ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | DOT ->
              let _tok = _menhir_lexer _menhir_lexbuf in
              (match (_tok : MenhirBasics.token) with
              | DOT ->
                  let _tok = _menhir_lexer _menhir_lexbuf in
                  (match (_tok : MenhirBasics.token) with
                  | RPAREN ->
                      let _tok = _menhir_lexer _menhir_lexbuf in
                      let _v = _menhir_action_29 () in
                      _menhir_goto_type_item_kind _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
                  | _ ->
                      _eRR ())
              | _ ->
                  _eRR ())
          | _ ->
              _eRR ())
      | AS | COMMA | RPAREN ->
          let _v = _menhir_action_28 () in
          _menhir_goto_type_item_kind _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _eRR ()
  
  and _menhir_goto_type_item_kind : type  ttv_stack. ((ttv_stack, _menhir_box_open_payload) _menhir_cell1_TYPE, _menhir_box_open_payload) _menhir_cell1_type_ident -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _menhir_stack = MenhirCell0_type_item_kind (_menhir_stack, _v) in
      match (_tok : MenhirBasics.token) with
      | AS ->
          let _menhir_s = MenhirState17 in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | LOWER_IDENT _v ->
              _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
          | _ ->
              _eRR ())
      | COMMA | RPAREN ->
          let _v = _menhir_action_20 () in
          _menhir_goto_option___anonymous_0_type_ident__ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _eRR ()
  
  let rec _menhir_goto_longident__mod_longident_UPPER_IDENT_ : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      let _1 = _v in
      let _v = _menhir_action_10 _1 in
      match (_tok : MenhirBasics.token) with
      | DOT ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | UPPER_IDENT _v_0 ->
              let _tok = _menhir_lexer _menhir_lexbuf in
              let (_1, _3) = (_v, _v_0) in
              let _v = _menhir_action_05 _1 _3 in
              _menhir_goto_longident__mod_longident_UPPER_IDENT_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
          | LPAREN ->
              let _menhir_stack = MenhirCell0_mod_longident (_menhir_stack, _v) in
              let _menhir_s = MenhirState08 in
              let _tok = _menhir_lexer _menhir_lexbuf in
              (match (_tok : MenhirBasics.token) with
              | TYPE ->
                  _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
              | MODULE ->
                  _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _menhir_s
              | LOWER_IDENT _v ->
                  _menhir_run_31 _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s
              | RPAREN ->
                  let _v = _menhir_action_06 () in
                  _menhir_goto_loption_separated_nonempty_list_COMMA_open_item__ _menhir_stack _menhir_lexbuf _menhir_lexer _v
              | _ ->
                  _eRR ())
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  let _menhir_run_00 : type  ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_open_payload =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | UPPER_IDENT _v ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          let _1 = _v in
          let _v = _menhir_action_04 _1 in
          _menhir_goto_longident__mod_longident_UPPER_IDENT_ _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _eRR ()
  
end

let open_payload =
  fun _menhir_lexer _menhir_lexbuf ->
    let _menhir_stack = () in
    let MenhirBox_open_payload v = _menhir_run_00 _menhir_stack _menhir_lexbuf _menhir_lexer in
    v
OCaml

Innovation. Community. Security.