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
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
# 10 "src/pps.mll"
(** Kinds of space:
- [Large] is one that would detach a documentation from a value in the
OCaml compiler, i.e. one with at least one blank line (a newline
followed by zero, one or more blanks and then a newline)
- [Nl] is some space which is not large but ends with a newline
- [Comment] is some space which is not large but ends with a comment
- [Blk] is some space which is not large but ends with blanks without a
newline just before *)
type space_kind = Nl | Blk | Large
type t =
| Ghost of Lexing.position * Lexing.position * string
| Spec of Lexing.position * Lexing.position * string
| Documentation of Lexing.position * Lexing.position * string
| Empty_documentation of Lexing.position
| Other of string
| Spaces of space_kind * string
let stdlib_file = "stdlib.mli"
let queue = Queue.create ()
let buf = Buffer.create 1024
let clear () = Queue.clear queue
let push () =
if Buffer.length buf > 0 then (
Queue.push (Other (Buffer.contents buf)) queue;
Buffer.clear buf)
let print_directive where pos ppf =
let open Lexing in
match where with
| `Open ->
Fmt.pf ppf "\n# %d \"%s\"\n%s" pos.pos_lnum pos.pos_fname
(String.make (pos.pos_cnum - pos.pos_bol) ' ')
| `Close ->
Fmt.pf ppf "\n# %d \"%s\"\n%s" pos.pos_lnum pos.pos_fname
(String.make (pos.pos_cnum - pos.pos_bol - 1) ' ')
| `Beginning -> Fmt.pf ppf "# %d \"%s\"\n" pos.pos_lnum pos.pos_fname
let print_gospel (lvl : [ `TwoAt | `ThreeAt ]) start_p end_p s ppf =
Fmt.pf ppf "[%sgospel%t {|%s|}%t]"
(match lvl with `TwoAt -> "@@" | `ThreeAt -> "@@@")
(print_directive `Open start_p)
s
(print_directive `Close end_p)
let print_nested_gospel start_p inner_start_p end_p outer_s inner_s ppf =
Fmt.pf ppf "[@@@@@@gospel%t {|%s|}[@@@@gospel%t {|%s|}]%t]"
(print_directive `Open start_p)
outer_s
(print_directive `Open inner_start_p)
inner_s
(print_directive `Close end_p)
let print_documentation_attribute lvl start_p end_p s ppf =
Fmt.pf ppf "[%s%t {|%s|}%t]"
(match lvl with `TwoAt -> "@@ocaml.doc" | `ThreeAt -> "@@@ocaml.text")
(print_directive `Open start_p)
s
(print_directive `Close end_p)
let print_empty_documentation end_p ppf =
Fmt.pf ppf "[@@@ocaml.doc%t]" (print_directive `Close end_p)
let print_triplet o sp doc sp' start_p end_p s ppf =
let docstring =
match doc with
| Documentation (start_p, end_p, d) ->
print_documentation_attribute `TwoAt start_p end_p d
| Empty_documentation end_p -> print_empty_documentation end_p
| _ -> assert false
in
Fmt.pf ppf "%s%s%t%s%t" o sp docstring sp'
(print_gospel `TwoAt start_p end_p s)
let rec print ppf = function
| Documentation (doc_start_p, doc_end_p, d)
:: Spaces (k, sp)
:: Ghost (start_p, _, g)
:: Spaces (k', sp')
:: Spec (inner_start_p, end_p, s)
:: l
when k <> Large && k' <> Large ->
Fmt.pf ppf "%t%s%t%s"
(print_documentation_attribute `ThreeAt doc_start_p doc_end_p d)
sp
(print_nested_gospel start_p inner_start_p end_p g s)
sp';
print ppf l
| Documentation (doc_start_p, doc_end_p, d)
:: Spaces (k, sp)
:: Ghost (start_p, end_p, g)
:: l
when k <> Large ->
Fmt.pf ppf "%t%s%t"
(print_documentation_attribute `ThreeAt doc_start_p doc_end_p d)
sp
(print_gospel `ThreeAt start_p end_p g);
print ppf l
| Ghost (start_p, _, g)
:: Spaces (k, _)
:: Spec (inner_start_p, end_p, s)
:: Spaces (k', sp')
:: Documentation (doc_start_p, doc_end_p, d)
:: l
when k <> Large && k' <> Large ->
Fmt.pf ppf "%t%s%t"
(print_documentation_attribute `ThreeAt doc_start_p doc_end_p d)
sp'
(print_nested_gospel start_p inner_start_p end_p g s);
print ppf l
| Ghost (start_p, _, g)
:: Spaces (k, _)
:: Documentation (doc_start_p, doc_end_p, d)
:: Spaces (k', _)
:: Spec (inner_start_p, end_p, s)
:: l
when k <> Large && k' <> Large ->
Fmt.pf ppf "%t%t"
(print_nested_gospel start_p inner_start_p end_p g s)
(print_documentation_attribute `ThreeAt doc_start_p doc_end_p d);
print ppf l
| Ghost (start_p, end_p, g)
:: Spaces (k, sp)
:: Documentation (doc_start_p, doc_end_p, d)
:: l
when k <> Large ->
Fmt.pf ppf "%t%s%t"
(print_gospel `ThreeAt start_p end_p g)
sp
(print_documentation_attribute `ThreeAt doc_start_p doc_end_p d);
print ppf l
| Ghost (start_p, _, g)
:: Spaces (k, _)
:: Spec (inner_start_p, end_p, s)
:: l
when k <> Large ->
print_nested_gospel start_p inner_start_p end_p g s ppf;
print ppf l
| Ghost (start_p, end_p, g) :: l ->
print_gospel `ThreeAt start_p end_p g ppf;
print ppf l
| Spec (start_p, end_p, s) :: l ->
print_gospel `TwoAt start_p end_p s ppf;
print ppf l
| Other o :: Spaces (_, sp) :: Spec (start_p, end_p, s) :: l ->
Fmt.pf ppf "%s%s%t" o sp (print_gospel `TwoAt start_p end_p s);
print ppf l
| Other o
:: Spaces (_, sp)
:: ((Documentation (_, _, _) | Empty_documentation _) as doc)
:: Spaces (_, sp')
:: Spec (start_p, end_p, s)
:: l ->
print_triplet o sp doc sp' start_p end_p s ppf;
print ppf l
| (Other s | Spaces (_, s)) :: l ->
Fmt.pf ppf "%s" s;
print ppf l
| Documentation (_, _, s) :: l ->
Fmt.pf ppf "(**%s*)" s;
print ppf l
| Empty_documentation _ :: l ->
Fmt.pf ppf "(**)";
print ppf l
| [] -> ()
(** Collapse spaces and hence computes the space kind *)
let collapse_spaces l =
let b = Buffer.create 1024 and curk = ref Blk in
let update_curk k =
curk :=
match (!curk, k) with
| Large, _ | _, Large -> Large
| Blk, x | Comment, x -> x
| Nl, Nl -> Large
| Nl, Blk -> Nl
| Nl, Comment -> Comment
in
let rec loop acc = function
| Spaces (k, s) :: l' ->
Buffer.add_string b s;
update_curk k;
loop acc l'
| elt :: l' ->
let sp = Buffer.contents b in
Buffer.clear b;
let k = !curk in
curk := Blk;
loop (elt :: Spaces (k, sp) :: acc) l'
| [] ->
List.rev
(if Buffer.length b > 0 then
Spaces (!curk, Buffer.contents b) :: acc
else acc)
in
loop [] l
let flush ppf =
push ();
let l = Queue.fold (fun acc t -> t :: acc) [] queue in
print ppf (collapse_spaces (List.rev l))
# 238 "src/pps.ml"
let __ocaml_lex_tables = {
Lexing.lex_base =
"\000\000\246\255\247\255\248\255\000\000\001\000\254\255\005\000\
\001\000\000\000\000\000\253\255\252\255\000\000\000\000\000\000\
\000\000\000\000\001\000\001\000\000\000\002\000\000\000\001\000\
\001\000\002\000\004\000\250\255\006\000\000\000\000\000\000\000\
\000\000\000\000\002\000\002\000\254\255\014\000\000\000\000\000\
\000\000\000\000\000\000\003\000\015\000\016\000\003\000\000\000\
\001\000\000\000\001\000\005\000\001\000\007\000\006\000\004\000\
\014\000\017\000\019\000\027\000\019\000\016\000\250\255\007\000\
\251\255\252\255\043\000\007\000\010\000\255\255\254\255\253\255\
\071\000\185\000\195\000\244\000\018\000\021\000\008\000\023\000\
\253\255\010\000\254\255\255\255\076\000\253\255\012\000\254\255\
\208\000\255\255\239\000";
Lexing.lex_backtrk =
"\255\255\255\255\255\255\255\255\008\000\008\000\255\255\000\000\
\006\000\255\255\004\000\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\003\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\000\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\002\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\005\000\
\255\255\255\255\005\000\005\000\005\000\255\255\255\255\255\255\
\255\255\001\000\255\255\255\255\255\255\255\255\000\000\255\255\
\255\255\002\000\255\255\255\255\255\255\255\255\002\000\255\255\
\002\000\255\255\255\255";
Lexing.lex_default =
"\002\000\000\000\000\000\000\000\255\255\255\255\000\000\255\255\
\255\255\255\255\255\255\000\000\000\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\000\000\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\000\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\062\000\000\000\255\255\
\000\000\000\000\255\255\255\255\255\255\000\000\000\000\000\000\
\255\255\255\255\255\255\255\255\076\000\255\255\078\000\080\000\
\000\000\255\255\000\000\000\000\085\000\000\000\255\255\000\000\
\255\255\000\000\255\255";
Lexing.lex_trans =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\007\000\006\000\006\000\036\000\005\000\007\000\037\000\
\036\000\064\000\255\255\035\000\082\000\255\255\087\000\037\000\
\045\000\045\000\064\000\000\000\255\255\063\000\077\000\255\255\
\007\000\082\000\000\000\003\000\081\000\007\000\037\000\000\000\
\004\000\012\000\008\000\010\000\026\000\027\000\037\000\045\000\
\045\000\070\000\065\000\069\000\078\000\077\000\000\000\076\000\
\067\000\083\000\068\000\000\000\000\000\000\000\000\000\000\000\
\000\000\011\000\019\000\022\000\014\000\017\000\024\000\000\000\
\000\000\021\000\000\000\000\000\016\000\020\000\009\000\013\000\
\000\000\000\000\000\000\023\000\025\000\015\000\087\000\000\000\
\000\000\086\000\000\000\000\000\000\000\000\000\000\000\018\000\
\000\000\058\000\053\000\040\000\050\000\044\000\049\000\031\000\
\052\000\042\000\051\000\044\000\034\000\056\000\039\000\043\000\
\059\000\044\000\048\000\047\000\041\000\029\000\032\000\038\000\
\055\000\046\000\033\000\054\000\030\000\057\000\044\000\044\000\
\060\000\044\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\072\000\066\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\071\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\075\000\071\000\000\000\000\000\000\000\000\000\
\088\000\000\000\000\000\000\000\077\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\075\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\077\000\000\000\076\000\000\000\000\000\
\000\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\
\074\000\074\000\074\000\074\000\074\000\074\000\074\000\074\000\
\074\000\074\000\074\000\074\000\074\000\075\000\000\000\000\000\
\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\255\255\000\000\255\255\000\000\075\000\000\000\000\000\255\255\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\074\000\074\000\074\000\074\000\
\074\000\074\000\074\000\074\000\074\000\074\000\000\000\090\000\
\000\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\000\000\255\255\089\000\090\000\000\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\000\000\000\000\089\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000";
Lexing.lex_check =
"\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\000\000\000\000\005\000\035\000\000\000\007\000\028\000\
\028\000\063\000\078\000\028\000\081\000\078\000\086\000\037\000\
\044\000\045\000\061\000\255\255\076\000\061\000\077\000\076\000\
\000\000\079\000\255\255\000\000\079\000\007\000\028\000\255\255\
\000\000\010\000\004\000\008\000\025\000\026\000\037\000\044\000\
\045\000\067\000\061\000\068\000\076\000\077\000\255\255\077\000\
\061\000\079\000\061\000\255\255\255\255\255\255\255\255\255\255\
\255\255\008\000\018\000\021\000\013\000\016\000\023\000\255\255\
\255\255\020\000\255\255\255\255\015\000\019\000\008\000\009\000\
\255\255\255\255\255\255\022\000\024\000\014\000\084\000\255\255\
\255\255\084\000\255\255\255\255\255\255\255\255\255\255\017\000\
\255\255\030\000\052\000\039\000\049\000\047\000\048\000\028\000\
\051\000\041\000\050\000\054\000\028\000\055\000\038\000\042\000\
\029\000\043\000\032\000\046\000\040\000\028\000\028\000\034\000\
\031\000\033\000\028\000\053\000\028\000\056\000\057\000\058\000\
\059\000\060\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\066\000\061\000\066\000\066\000\066\000\066\000\
\066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\
\066\000\066\000\066\000\066\000\066\000\066\000\066\000\066\000\
\066\000\066\000\066\000\066\000\066\000\066\000\072\000\066\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\072\000\072\000\072\000\072\000\072\000\072\000\
\072\000\072\000\073\000\072\000\255\255\255\255\255\255\255\255\
\084\000\255\255\255\255\255\255\074\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\073\000\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\074\000\255\255\074\000\255\255\255\255\
\255\255\073\000\073\000\073\000\073\000\073\000\073\000\073\000\
\073\000\073\000\073\000\074\000\074\000\074\000\074\000\074\000\
\074\000\074\000\074\000\074\000\074\000\075\000\255\255\255\255\
\000\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\078\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\061\000\255\255\076\000\255\255\075\000\255\255\255\255\079\000\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\075\000\075\000\075\000\075\000\
\075\000\075\000\075\000\075\000\075\000\075\000\255\255\088\000\
\255\255\088\000\088\000\088\000\088\000\088\000\088\000\088\000\
\088\000\088\000\088\000\088\000\088\000\088\000\088\000\088\000\
\088\000\088\000\088\000\088\000\088\000\088\000\088\000\088\000\
\088\000\088\000\088\000\255\255\084\000\088\000\090\000\255\255\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\090\000\090\000\090\000\090\000\090\000\090\000\
\090\000\090\000\255\255\255\255\090\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255";
Lexing.lex_base_code =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\010\000\036\000\000\000\001\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000";
Lexing.lex_backtrk_code =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000";
Lexing.lex_default_code =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\012\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000";
Lexing.lex_trans_code =
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\001\000\000\000\000\000\015\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\007\000\001\000\000\000\000\000\
\004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
\004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
\004\000\004\000\004\000\004\000\001\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\004\000\004\000\004\000\004\000\
\004\000\004\000\004\000\004\000\004\000\004\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
\000\000\000\000\000\000\000\000\000\000";
Lexing.lex_check_code =
"\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\073\000\076\000\255\255\255\255\076\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\073\000\255\255\076\000\077\000\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\074\000\075\000\255\255\255\255\
\073\000\073\000\073\000\073\000\073\000\073\000\073\000\073\000\
\073\000\073\000\074\000\074\000\074\000\074\000\074\000\074\000\
\074\000\074\000\074\000\074\000\075\000\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\075\000\075\000\075\000\075\000\
\075\000\075\000\075\000\075\000\075\000\075\000\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\076\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
\255\255\255\255\255\255\255\255\255\255";
Lexing.lex_code =
"\255\004\255\255\005\255\255\007\255\006\255\255\007\255\255\006\
\255\007\255\255\000\004\001\005\002\006\003\007\255";
}
let rec scan ppf lexbuf =
__ocaml_lex_scan_rec ppf lexbuf 0
and __ocaml_lex_scan_rec ppf lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 252 "src/pps.mll"
s
# 535 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 252 "src/pps.mll"
(
push ();
Queue.push (Spaces (Blk, s)) queue;
scan ppf lexbuf
)
# 543 "src/pps.ml"
| 1 ->
let
# 257 "src/pps.mll"
nl
# 549 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 257 "src/pps.mll"
(
push ();
Lexing.new_line lexbuf;
Queue.push (Spaces (Nl, nl)) queue;
scan ppf lexbuf
)
# 558 "src/pps.ml"
| 2 ->
# 263 "src/pps.mll"
(
push ();
gospel ppf (Lexing.lexeme_start_p lexbuf) lexbuf
)
# 566 "src/pps.ml"
| 3 ->
# 267 "src/pps.mll"
(
push ();
let end_pos = Lexing.lexeme_end_p lexbuf in
Queue.push (Empty_documentation end_pos) queue;
scan ppf lexbuf
)
# 576 "src/pps.ml"
| 4 ->
# 273 "src/pps.mll"
(
push ();
let start_pos = Lexing.lexeme_start_p lexbuf in
comment lexbuf;
let s = Buffer.contents buf in
Buffer.clear buf;
let end_pos = Lexing.lexeme_end_p lexbuf in
Queue.push (Documentation (start_pos, end_pos, s)) queue;
scan ppf lexbuf
)
# 590 "src/pps.ml"
| 5 ->
let
# 284 "src/pps.mll"
s
# 596 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos (lexbuf.Lexing.lex_start_pos + 18) in
# 284 "src/pps.mll"
(
if
Filename.basename (Lexing.lexeme_start_p lexbuf).pos_fname = stdlib_file
then flush ppf
else (
Buffer.add_string buf s;
scan ppf lexbuf)
)
# 607 "src/pps.ml"
| 6 ->
# 292 "src/pps.mll"
(
push ();
Buffer.add_string buf "(*";
comment lexbuf;
Buffer.add_string buf "*)";
Queue.push (Spaces (Comment, Buffer.contents buf)) queue;
Buffer.clear buf;
scan ppf lexbuf
)
# 620 "src/pps.ml"
| 7 ->
let
# 301 "src/pps.mll"
c
# 626 "src/pps.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 301 "src/pps.mll"
(
Buffer.add_char buf c;
let pos = Lexing.lexeme_start_p lexbuf in
if pos.pos_cnum = pos.pos_bol then directive ppf lexbuf
else scan ppf lexbuf
)
# 635 "src/pps.ml"
| 8 ->
let
# 307 "src/pps.mll"
c
# 641 "src/pps.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 307 "src/pps.mll"
(
Buffer.add_char buf c;
scan ppf lexbuf
)
# 648 "src/pps.ml"
| 9 ->
# 311 "src/pps.mll"
(
flush ppf
)
# 655 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_scan_rec ppf lexbuf __ocaml_lex_state
and gospel ppf start_pos lexbuf =
__ocaml_lex_gospel_rec ppf start_pos lexbuf 28
and __ocaml_lex_gospel_rec ppf start_pos lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 316 "src/pps.mll"
s
# 668 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 316 "src/pps.mll"
(
Buffer.add_string buf s;
gospel ppf start_pos lexbuf
)
# 675 "src/pps.ml"
| 1 ->
let
# 320 "src/pps.mll"
nl
# 681 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 320 "src/pps.mll"
(
Buffer.add_string buf nl;
Lexing.new_line lexbuf;
gospel ppf start_pos lexbuf
)
# 689 "src/pps.ml"
| 2 ->
let
# 325 "src/pps.mll"
k
# 695 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 325 "src/pps.mll"
(
Buffer.add_string buf k;
comment lexbuf;
let s = Buffer.contents buf in
Buffer.clear buf;
let end_pos = Lexing.lexeme_end_p lexbuf in
Queue.push (Ghost (start_pos, end_pos, s)) queue;
scan ppf lexbuf
)
# 707 "src/pps.ml"
| 3 ->
# 334 "src/pps.mll"
(
comment lexbuf;
let s = Buffer.contents buf in
Buffer.clear buf;
let end_pos = Lexing.lexeme_end_p lexbuf in
Queue.push (Spec (start_pos, end_pos, s)) queue;
scan ppf lexbuf
)
# 719 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_gospel_rec ppf start_pos lexbuf __ocaml_lex_state
and lexbuf =
__ocaml_lex_comment_rec lexbuf 61
and lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 344 "src/pps.mll"
()
# 731 "src/pps.ml"
| 1 ->
# 345 "src/pps.mll"
(
Buffer.add_string buf "(*";
comment lexbuf;
Buffer.add_string buf "*)";
comment lexbuf
)
# 741 "src/pps.ml"
| 2 ->
let
# 351 "src/pps.mll"
delim
# 747 "src/pps.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_curr_pos + -1) in
# 351 "src/pps.mll"
(
Buffer.add_char buf '{';
Buffer.add_string buf delim;
Buffer.add_char buf '|';
quoted_string delim lexbuf;
Buffer.add_char buf '|';
Buffer.add_string buf delim;
Buffer.add_char buf '}';
comment lexbuf
)
# 760 "src/pps.ml"
| 3 ->
# 361 "src/pps.mll"
(
Buffer.add_char buf '"';
string lexbuf;
Buffer.add_char buf '"';
comment lexbuf
)
# 770 "src/pps.ml"
| 4 ->
let
# 367 "src/pps.mll"
nl
# 776 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 367 "src/pps.mll"
(
Buffer.add_string buf nl;
Lexing.new_line lexbuf;
comment lexbuf
)
# 784 "src/pps.ml"
| 5 ->
let
# 372 "src/pps.mll"
c
# 790 "src/pps.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 372 "src/pps.mll"
(
Buffer.add_char buf c;
comment lexbuf
)
# 797 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_comment_rec lexbuf __ocaml_lex_state
and directive ppf lexbuf =
lexbuf.Lexing.lex_mem <- Array.make 8 (-1);
lexbuf.Lexing.lex_mem.(4) <- lexbuf.Lexing.lex_curr_pos ;
__ocaml_lex_directive_rec ppf lexbuf 73
and __ocaml_lex_directive_rec ppf lexbuf __ocaml_lex_state =
match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 379 "src/pps.mll"
line
# 812 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) lexbuf.Lexing.lex_mem.(1)
and
# 381 "src/pps.mll"
file
# 817 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(2) lexbuf.Lexing.lex_mem.(3)
and
# 383 "src/pps.mll"
directive
# 822 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 383 "src/pps.mll"
(
Buffer.add_string buf directive;
match int_of_string_opt line with
| Some line ->
let pos = lexbuf.lex_curr_p in
let pos =
{
pos with
pos_fname = file;
pos_lnum = line - 1;
pos_bol = pos.pos_cnum;
}
in
lexbuf.lex_curr_p <- pos;
scan ppf lexbuf
| None -> scan ppf lexbuf
)
# 842 "src/pps.ml"
| 1 ->
# 400 "src/pps.mll"
(
scan ppf lexbuf
)
# 849 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_directive_rec ppf lexbuf __ocaml_lex_state
and string lexbuf =
__ocaml_lex_string_rec lexbuf 79
and __ocaml_lex_string_rec lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
# 405 "src/pps.mll"
()
# 861 "src/pps.ml"
| 1 ->
let
# 406 "src/pps.mll"
nl
# 867 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 406 "src/pps.mll"
(
Lexing.new_line lexbuf;
Buffer.add_string buf nl;
string lexbuf
)
# 875 "src/pps.ml"
| 2 ->
let
# 411 "src/pps.mll"
c
# 881 "src/pps.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 411 "src/pps.mll"
(
Buffer.add_char buf c;
string lexbuf
)
# 888 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_string_rec lexbuf __ocaml_lex_state
and quoted_string delim lexbuf =
__ocaml_lex_quoted_string_rec delim lexbuf 84
and __ocaml_lex_quoted_string_rec delim lexbuf __ocaml_lex_state =
match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
| 0 ->
let
# 417 "src/pps.mll"
edelim
# 901 "src/pps.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_curr_pos + -1)
and
# 417 "src/pps.mll"
s
# 906 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 417 "src/pps.mll"
(
if delim = edelim then ()
else (
Buffer.add_string buf s;
quoted_string delim lexbuf)
)
# 915 "src/pps.ml"
| 1 ->
let
# 423 "src/pps.mll"
nl
# 921 "src/pps.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 423 "src/pps.mll"
(
Lexing.new_line lexbuf;
Buffer.add_string buf nl;
quoted_string delim lexbuf
)
# 929 "src/pps.ml"
| 2 ->
let
# 428 "src/pps.mll"
c
# 935 "src/pps.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 428 "src/pps.mll"
(
Buffer.add_char buf c;
quoted_string delim lexbuf
)
# 942 "src/pps.ml"
| __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
__ocaml_lex_quoted_string_rec delim lexbuf __ocaml_lex_state
;;
# 433 "src/pps.mll"
let run ppf lb =
clear ();
print_directive `Beginning lb.Lexing.lex_curr_p ppf;
scan ppf lb
# 956 "src/pps.ml"