Source file generic_vs_generic.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
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
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
open Common
module A = Ast_generic
module B = Ast_generic
module MV = Metavars_generic
module Ast = Ast_generic
module Lib = Lib_ast
let verbose = ref false
let pr2, _pr2_once = Common2.mk_pr2_wrappers verbose
type tin = MV.metavars_binding
type tout = MV.metavars_binding list
type ('a, 'b) matcher = 'a -> 'b -> tin -> tout
let ((>>=):
(tin -> tout) ->
(unit -> (tin -> tout)) ->
(tin -> tout)) =
fun m1 m2 ->
fun tin ->
let xs = m1 tin in
let xxs = xs |> List.map (fun binding ->
m2 () binding
) in
List.flatten xxs
let ((>||>) :
(tin -> tout) ->
(tin -> tout) ->
(tin -> tout)) = fun m1 m2 -> fun tin ->
m1 tin @ m2 tin
let (return : tin -> tout) = fun tin ->
[tin]
let (fail : tin -> tout) = fun _tin ->
[]
let equal_ast_binded_code a b =
match a, b with
| Ast.E _, Ast.E _
| Ast.N _, Ast.N _
| Ast.S _, Ast.S _
->
let a = Lib.abstract_position_info_any a in
let b = Lib.abstract_position_info_any b in
a =*= b
| _, _ ->
false
let check_and_add_metavar_binding((mvar:MV.mvar), valu) = fun tin ->
match Common2.assoc_opt mvar tin with
| Some valu' ->
if equal_ast_binded_code valu valu'
then Some tin
else None
| None ->
Some (Common2.insert_assoc (mvar, valu) tin)
let (envf: (MV.mvar Ast.wrap, Ast.any) matcher) =
fun (mvar, _imvar) any -> fun tin ->
match check_and_add_metavar_binding (mvar, any) tin with
| None ->
pr2 (spf "envf: fail, %s" mvar);
fail tin
| Some new_binding ->
pr2 (spf "envf: success, %s" mvar);
return new_binding
let empty_environment () = []
let return () = return
let fail () = fail
let (m_option: ('a,'b) matcher -> ('a option,'b option) matcher) = fun f a b ->
match a, b with
| None, None -> return ()
| Some xa, Some xb ->
f xa xb >>= (fun () ->
return ()
)
| None, _
| Some _, _
-> fail ()
let (m_ref: ('a,'b) matcher -> ('a ref,'b ref) matcher) = fun f a b ->
match a, b with
{ contents = xa}, { contents = xb} ->
f xa xb >>= (fun () ->
return ()
)
let rec m_list f a b =
match a, b with
| [], [] ->
return ()
| xa::aas, xb::bbs ->
f xa xb >>= (fun () ->
m_list f aas bbs >>= (fun () ->
return ()
)
)
| [], _
| _::_, _ ->
fail ()
let m_bool a b =
if a = b then return () else fail ()
let m_string a b =
if a =$= b then return () else fail ()
let m_other_xxx a b =
match a, b with
| a, b when a =*= b -> return ()
| _ -> fail ()
let m_info _a _b = return ()
let m_tok a b = m_info a b
let m_wrap f a b =
match a, b with
((xaa, ainfo), (xbb, binfo)) ->
f xaa xbb >>= (fun () ->
m_info ainfo binfo >>= (fun () ->
return ()
))
let m_ident a b =
match a, b with
| (str, tok), b when MV.is_metavar_name str ->
envf (str, tok) (B.Id b)
| (a, b) -> (m_wrap m_string) a b
let m_dotted_name a b =
match a, b with
(a, b) -> (m_list m_ident) a b
let m_qualified_name a b =
match a, b with
(a, b) -> m_dotted_name a b
let m_module_name a b =
match a, b with
| A.FileName(a1), B.FileName(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.DottedName(a1), B.DottedName(b1) ->
m_dotted_name a1 b1 >>= (fun () ->
return ()
)
| A.FileName _, _
| A.DottedName _, _
-> fail ()
let m_resolved_name a b =
match a, b with
| A.Local, B.Local ->
return ()
| A.Param, B.Param ->
return ()
| A.Global(a1), B.Global(b1) ->
m_qualified_name a1 b1 >>= (fun () ->
return ()
)
| A.NotResolved, B.NotResolved ->
return ()
| A.Macro, B.Macro ->
return ()
| A.EnumConstant, B.EnumConstant ->
return ()
| A.ImportedModule, B.ImportedModule ->
return ()
| A.Local, _
| A.Param, _
| A.Global _, _
| A.NotResolved, _
| A.Macro, _
| A.EnumConstant, _
| A.ImportedModule, _
-> fail ()
let rec m_name a b =
match a,b with
| (a1, a2), (b1, b2) ->
m_ident a1 b1 >>= (fun () ->
m_id_info a2 b2 >>= (fun () ->
return ()
))
and m_expr a b =
match a, b with
| A.Name ((str,_tok), _id_info), B.IdSpecial _ when MV.is_metavar_name str ->
fail ()
| A.Name ((str,tok), _id_info), e2 when MV.is_metavar_name str ->
envf (str, tok) (B.E (e2))
| A.L(a1), B.L(b1) ->
m_literal a1 b1 >>= (fun () ->
return ()
)
| A.Container(a1, a2), B.Container(b1, b2) ->
m_container_operator a1 b1 >>= (fun () ->
(m_list m_expr) a2 b2 >>= (fun () ->
return ()
))
| A.Tuple(a1), B.Tuple(b1) ->
(m_list m_expr) a1 b1 >>= (fun () ->
return ()
)
| A.Record(a1), B.Record(b1) ->
(m_list m_field) a1 b1 >>= (fun () ->
return ()
)
| A.Constructor(a1, a2), B.Constructor(b1, b2) ->
m_name a1 b1 >>= (fun () ->
(m_list m_expr) a2 b2 >>= (fun () ->
return ()
))
| A.Lambda(a1), B.Lambda(b1) ->
m_function_definition a1 b1 >>= (fun () ->
return ())
| A.AnonClass(a1), B.AnonClass(b1) ->
m_class_definition a1 b1 >>= (fun () ->
return ())
| A.Nop, B.Nop ->
return ()
| A.Name(a1), B.Name(b1) ->
m_name a1 b1 >>= (fun () ->
return ())
| A.IdSpecial(a1), B.IdSpecial(b1) ->
m_wrap m_special a1 b1 >>= (fun () ->
return ()
)
| A.Call(a1, a2), B.Call(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
m_arguments a2 b2 >>= (fun () ->
return ()
))
| A.Xml(a1), B.Xml(b1) ->
m_xml a1 b1 >>= (fun () ->
return ()
)
| A.Assign(a1, a2), B.Assign(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.AssignOp(a1, a2, a3), B.AssignOp(b1, b2, b3) ->
m_expr a1 b1 >>= (fun () ->
m_wrap m_arithmetic_operator a2 b2 >>= (fun () ->
m_expr a3 b3 >>= (fun () ->
return ()
)))
| A.LetPattern(a1, a2), B.LetPattern(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.ObjAccess(a1, a2), B.ObjAccess(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
m_ident a2 b2 >>= (fun () ->
return ()
))
| A.ArrayAccess(a1, a2), B.ArrayAccess(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.Conditional(a1, a2, a3), B.Conditional(b1, b2, b3) ->
m_expr a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
m_expr a3 b3 >>= (fun () ->
return ()
)))
| A.MatchPattern(a1, a2), B.MatchPattern(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
(m_list m_action) a2 b2 >>= (fun () ->
return ()
))
| A.Yield(a1), B.Yield(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Await(a1), B.Await(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Cast(a1, a2), B.Cast(b1, b2) ->
m_type_ a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.Seq(a1), B.Seq(b1) ->
(m_list m_expr) a1 b1 >>= (fun () ->
return ()
)
| A.Ref(a1), B.Ref(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.DeRef(a1), B.DeRef(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Ellipses(a1), B.Ellipses(b1) ->
m_tok a1 b1 >>= (fun () ->
return ()
)
| A.OtherExpr(a1, a2), B.OtherExpr(b1, b2) ->
m_other_expr_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.L _, _ | A.Container _, _ | A.Tuple _, _ | A.Record _, _
| A.Constructor _, _ | A.Lambda _, _ | A.AnonClass _, _ | A.Nop, _
| A.Name _, _ | A.IdSpecial _, _ | A.Call _, _ | A.Xml _, _
| A.Assign _, _ | A.AssignOp _, _ | A.LetPattern _, _ | A.ObjAccess _, _
| A.ArrayAccess _, _ | A.Conditional _, _ | A.MatchPattern _, _
| A.Yield _, _ | A.Await _, _ | A.Cast _, _ | A.Seq _, _ | A.Ref _, _
| A.DeRef _, _ | A.Ellipses _, _ | A.OtherExpr _, _
-> fail ()
and m_literal a b =
match a, b with
| A.String("...", a), B.String(_s, b) ->
m_info a b >>= (fun () ->
return ())
| A.String(name, info_name), B.String(sb, info_sb)
when name =~ "^=~/\\(.*\\)/$" ->
let s = Common.matched1 name in
if sb =~ s
then
m_info info_name info_sb >>= (fun () ->
return ())
else fail ()
| A.String(a1), B.String(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.Unit(a1), B.Unit(b1) ->
m_tok a1 b1 >>= (fun () ->
return ()
)
| A.Bool(a1), B.Bool(b1) ->
(m_wrap m_bool) a1 b1 >>= (fun () ->
return ()
)
| A.Int(a1), B.Int(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.Float(a1), B.Float(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.Char(a1), B.Char(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.Regexp(a1), B.Regexp(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.Null(a1), B.Null(b1) ->
m_tok a1 b1 >>= (fun () ->
return ()
)
| A.Undefined(a1), B.Undefined(b1) ->
m_tok a1 b1 >>= (fun () ->
return ()
)
| A.Unit _, _ | A.Bool _, _ | A.Int _, _ | A.Float _, _ | A.Char _, _
| A.String _, _ | A.Regexp _, _ | A.Null _, _ | A.Undefined _, _
-> fail ()
and m_action a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
and m_arithmetic_operator a b =
match a, b with
| A.Plus, B.Plus ->
return ()
| A.Minus, B.Minus ->
return ()
| A.Mult, B.Mult ->
return ()
| A.Div, B.Div ->
return ()
| A.Mod, B.Mod ->
return ()
| A.Pow, B.Pow ->
return ()
| A.FloorDiv, B.FloorDiv ->
return ()
| A.LSL, B.LSL ->
return ()
| A.LSR, B.LSR ->
return ()
| A.ASR, B.ASR ->
return ()
| A.BitOr, B.BitOr ->
return ()
| A.BitXor, B.BitXor ->
return ()
| A.BitAnd, B.BitAnd ->
return ()
| A.BitNot, B.BitNot ->
return ()
| A.And, B.And ->
return ()
| A.Or, B.Or ->
return ()
| A.Not, B.Not ->
return ()
| A.Eq, B.Eq ->
return ()
| A.NotEq, B.NotEq ->
return ()
| A.PhysEq, B.PhysEq ->
return ()
| A.NotPhysEq, B.NotPhysEq ->
return ()
| A.Lt, B.Lt ->
return ()
| A.LtE, B.LtE ->
return ()
| A.Gt, B.Gt ->
return ()
| A.GtE, B.GtE ->
return ()
| A.Plus, _ | A.Minus, _ | A.Mult, _ | A.Div, _ | A.Mod, _ | A.Pow, _
| A.FloorDiv, _ | A.LSL, _ | A.LSR, _ | A.ASR, _ | A.BitOr, _
| A.BitXor, _ | A.BitAnd, _ | A.BitNot, _ | A.And, _ | A.Or, _
| A.Not, _ | A.Eq, _ | A.NotEq, _ | A.PhysEq, _ | A.NotPhysEq, _
| A.Lt, _ | A.LtE, _ | A.Gt, _ | A.GtE, _
-> fail ()
and m_special a b =
match a, b with
| A.This, B.This ->
return ()
| A.Super, B.Super ->
return ()
| A.Self, B.Self ->
return ()
| A.Parent, B.Parent ->
return ()
| A.Eval, B.Eval ->
return ()
| A.Typeof, B.Typeof ->
return ()
| A.Instanceof, B.Instanceof ->
return ()
| A.Sizeof, B.Sizeof ->
return ()
| A.New, B.New ->
return ()
| A.Concat, B.Concat ->
return ()
| A.Spread, B.Spread ->
return ()
| A.ArithOp(a1), B.ArithOp(b1) ->
m_arithmetic_operator a1 b1 >>= (fun () ->
return ()
)
| A.IncrDecr(a1, a2), B.IncrDecr(b1, b2) ->
m_bool a1 b1 >>= (fun () ->
m_bool a2 b2 >>= (fun () ->
return ()
))
| A.This, _ | A.Super, _ | A.Self, _ | A.Parent, _ | A.Eval, _
| A.Typeof, _ | A.Instanceof, _ | A.Sizeof, _ | A.New, _
| A.Concat, _ | A.Spread, _ | A.ArithOp _, _ | A.IncrDecr _, _
-> fail ()
and m_id_info a b =
match a, b with
{ A. id_qualifier = a1; id_typeargs = a2; id_resolved = a3; id_type = a4; },
{ B. id_qualifier = b1; id_typeargs = b2; id_resolved = b3; id_type = b4; }
->
(m_option m_dotted_name) a1 b1 >>= (fun () ->
(m_option m_type_arguments) a2 b2 >>= (fun () ->
(m_ref m_resolved_name) a3 b3 >>= (fun () ->
(m_ref (m_option m_type_)) a4 b4 >>= (fun () ->
return ()
))))
and m_container_operator a b =
match a, b with
| A.Array, B.Array ->
return ()
| A.List, B.List ->
return ()
| A.Set, B.Set ->
return ()
| A.Dict, B.Dict ->
return ()
| A.Array, _ | A.List, _ | A.Set, _ | A.Dict, _
-> fail ()
and m_other_expr_operator = m_other_xxx
and m_xml a b =
match a, b with
(a, b) -> (m_list m_any) a b
and m_arguments a b =
match a, b with
(a, b) -> (m_list__m_argument) a b
and m_list__m_argument (xsa: A.argument list) (xsb: A.argument list) =
match xsa, xsb with
| [], [] ->
return ()
| [A.Arg (A.Ellipses _i)], [] ->
return ()
| A.Arg (A.Ellipses i)::xsa, xb::xsb ->
(m_list__m_argument xsa (xb::xsb)) >||>
(m_list__m_argument xsa xsb) >||>
(m_list__m_argument ((A.Arg (A.Ellipses i))::xsa) xsb)
| xa::aas, xb::bbs ->
m_argument xa xb >>= (fun () ->
m_list__m_argument aas bbs >>= (fun () ->
return ()
)
)
| [], _
| _::_, _ ->
fail ()
and m_argument a b =
match a, b with
| A.Arg(a1), B.Arg(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.ArgType(a1), B.ArgType(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.ArgKwd(a1, a2), B.ArgKwd(b1, b2) ->
m_ident a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.ArgOther(a1, a2), B.ArgOther(b1, b2) ->
m_other_argument_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.Arg _, _ | A.ArgKwd _, _ | A.ArgType _, _ | A.ArgOther _, _
-> fail ()
and m_other_argument_operator = m_other_xxx
and m_type_ a b =
match a, b with
| A.TyBuiltin(a1), B.TyBuiltin(b1) ->
(m_wrap m_string) a1 b1 >>= (fun () ->
return ()
)
| A.TyFun(a1, a2), B.TyFun(b1, b2) ->
(m_list m_type_) a1 b1 >>= (fun () ->
m_type_ a2 b2 >>= (fun () ->
return ()
))
| A.TyApply(a1, a2), B.TyApply(b1, b2) ->
m_name a1 b1 >>= (fun () ->
m_type_arguments a2 b2 >>= (fun () ->
return ()
))
| A.TyVar(a1), B.TyVar(b1) ->
m_ident a1 b1 >>= (fun () ->
return ()
)
| A.TyArray(a1, a2), B.TyArray(b1, b2) ->
(m_option m_expr) a1 b1 >>= (fun () ->
m_type_ a2 b2 >>= (fun () ->
return ()
))
| A.TyPointer(a1), B.TyPointer(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.TyTuple(a1), B.TyTuple(b1) ->
(m_list m_type_) a1 b1 >>= (fun () ->
return ()
)
| A.TyQuestion(a1), B.TyQuestion(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.OtherType(a1, a2), B.OtherType(b1, b2) ->
m_other_type_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.TyBuiltin _, _ | A.TyFun _, _ | A.TyApply _, _ | A.TyVar _, _
| A.TyArray _, _ | A.TyPointer _, _ | A.TyTuple _, _ | A.TyQuestion _, _
| A.OtherType _, _
-> fail ()
and m_type_arguments a b =
match a, b with
(a, b) -> (m_list m_type_argument) a b
and m_type_argument a b =
match a, b with
| A.TypeArg(a1), B.TypeArg(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.OtherTypeArg(a1, a2), B.OtherTypeArg(b1, b2) ->
m_other_type_argument_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.TypeArg _, _ | A.OtherTypeArg _, _
-> fail ()
and m_other_type_operator = m_other_xxx
and m_other_type_argument_operator = m_other_xxx
and m_attribute a b =
match a, b with
| A.Recursive, B.Recursive ->
return ()
| A.MutuallyRecursive, B.MutuallyRecursive ->
return ()
| A.Static, B.Static ->
return ()
| A.Volatile, B.Volatile ->
return ()
| A.Extern, B.Extern ->
return ()
| A.Public, B.Public ->
return ()
| A.Private, B.Private ->
return ()
| A.Protected, B.Protected ->
return ()
| A.Abstract, B.Abstract ->
return ()
| A.Final, B.Final ->
return ()
| A.Var, B.Var ->
return ()
| A.Let, B.Let ->
return ()
| A.Const, B.Const ->
return ()
| A.Mutable, B.Mutable ->
return ()
| A.Generator, B.Generator ->
return ()
| A.Async, B.Async ->
return ()
| A.Ctor, B.Ctor ->
return ()
| A.Dtor, B.Dtor ->
return ()
| A.Getter, B.Getter ->
return ()
| A.Setter, B.Setter ->
return ()
| A.Variadic, B.Variadic ->
return ()
| A.NamedAttr(a1, a2), B.NamedAttr(b1, b2) ->
m_ident a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.OtherAttribute(a1, a2), B.OtherAttribute(b1, b2) ->
m_other_attribute_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.Recursive, _ | A.MutuallyRecursive, _
| A.Static, _ | A.Volatile, _ | A.Extern, _
| A.Public, _ | A.Private, _ | A.Protected, _
| A.Abstract, _ | A.Final, _ | A.Var, _ | A.Let, _
| A.Const, _ | A.Mutable, _ | A.Generator, _ | A.Async, _
| A.Ctor, _ | A.Dtor, _ | A.Getter, _ | A.Setter, _
| A.Variadic, _ | A.NamedAttr _, _ | A.OtherAttribute _, _
-> fail ()
and m_other_attribute_operator = m_other_xxx
and m_stmt a b =
match a, b with
| A.ExprStmt(A.Name ((str,tok), _id_info)), b when MV.is_metavar_name str ->
envf (str, tok) (B.S b)
| A.ExprStmt(A.Ellipses _i), _b ->
return ()
| A.ExprStmt(a1), B.ExprStmt(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.LocalDef(a1), B.LocalDef(b1) ->
m_definition a1 b1 >>= (fun () ->
return ()
)
| A.LocalDirective(a1), B.LocalDirective(b1) ->
m_directive a1 b1 >>= (fun () ->
return ()
)
| A.Block(a1), B.Block(b1) ->
(m_list m_stmt) a1 b1 >>= (fun () ->
return ()
)
| A.If(a1, a2, a3), B.If(b1, b2, b3) ->
m_expr a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
m_stmt a3 b3 >>= (fun () ->
return ()
)))
| A.While(a1, a2), B.While(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
return ()
))
| A.DoWhile(a1, a2), B.DoWhile(b1, b2) ->
m_stmt a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.For(a1, a2), B.For(b1, b2) ->
m_for_header a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
return ()
))
| A.Switch(a1, a2), B.Switch(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
(m_list m_case_and_body) a2 b2 >>= (fun () ->
return ()
))
| A.Return(a1), B.Return(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Continue(a1), B.Continue(b1) ->
(m_option m_expr) a1 b1 >>= (fun () ->
return ()
)
| A.Break(a1), B.Break(b1) ->
(m_option m_expr) a1 b1 >>= (fun () ->
return ()
)
| A.Label(a1, a2), B.Label(b1, b2) ->
m_label a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
return ()
))
| A.Goto(a1), B.Goto(b1) ->
m_label a1 b1 >>= (fun () ->
return ()
)
| A.Throw(a1), B.Throw(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Try(a1, a2, a3), B.Try(b1, b2, b3) ->
m_stmt a1 b1 >>= (fun () ->
(m_list m_catch) a2 b2 >>= (fun () ->
(m_option m_finally) a3 b3 >>= (fun () ->
return ()
)))
| A.Assert(a1, a2), B.Assert(b1, b2) ->
m_expr a1 b1 >>= (fun () ->
(m_option m_expr) a2 b2 >>= (fun () ->
return ()
))
| A.OtherStmt(a1, a2), B.OtherStmt(b1, b2) ->
m_other_stmt_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.ExprStmt _, _ | A.LocalDef _, _ | A.LocalDirective _, _
| A.Block _, _ | A.If _, _ | A.While _, _ | A.DoWhile _, _ | A.For _, _
| A.Switch _, _ | A.Return _, _ | A.Continue _, _ | A.Break _, _
| A.Label _, _ | A.Goto _, _ | A.Throw _, _ | A.Try _, _ | A.Assert _, _
| A.OtherStmt _, _
-> fail ()
and m_for_header a b =
match a, b with
| A.ForClassic(a1, a2, a3), B.ForClassic(b1, b2, b3) ->
(m_list m_for_var_or_expr) a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
m_expr a3 b3 >>= (fun () ->
return ()
)))
| A.ForEach(a1, a2), B.ForEach(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.ForClassic _, _ | A.ForEach _, _
-> fail ()
and m_for_var_or_expr a b =
match a, b with
| A.ForInitVar(a1, a2), B.ForInitVar(b1, b2) ->
m_entity a1 b1 >>= (fun () ->
m_variable_definition a2 b2 >>= (fun () ->
return ()
))
| A.ForInitExpr(a1), B.ForInitExpr(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.ForInitVar _, _ | A.ForInitExpr _, _
-> fail ()
and m_label a b =
match a, b with
(a, b) -> m_ident a b
and m_catch a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
return ()
))
and m_finally a b =
match a, b with
(a, b) -> m_stmt a b
and m_case_and_body a b =
match a, b with
| (a1, a2), (b1, b2) ->
(m_list m_case) a1 b1 >>= (fun () ->
m_stmt a2 b2 >>= (fun () ->
return ()
))
and m_case a b =
match a, b with
| A.Case(a1), B.Case(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.Default, B.Default ->
return ()
| A.Case _, _ | A.Default, _
-> fail ()
and m_other_stmt_operator = m_other_xxx
and m_pattern a b =
match a, b with
| A.PatVar(a1), B.PatVar(b1) ->
m_ident a1 b1 >>= (fun () ->
return ()
)
| A.PatLiteral(a1), B.PatLiteral(b1) ->
m_literal a1 b1 >>= (fun () ->
return ()
)
| A.PatConstructor(a1, a2), B.PatConstructor(b1, b2) ->
m_name a1 b1 >>= (fun () ->
(m_list m_pattern) a2 b2 >>= (fun () ->
return ()
))
| A.PatTuple(a1), B.PatTuple(b1) ->
(m_list m_pattern) a1 b1 >>= (fun () ->
return ()
)
| A.PatList(a1), B.PatList(b1) ->
(m_list m_pattern) a1 b1 >>= (fun () ->
return ()
)
| A.PatRecord(a1), B.PatRecord(b1) ->
(m_list m_field_pattern) a1 b1 >>= (fun () ->
return ()
)
| A.PatKeyVal(a1, a2), B.PatKeyVal(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_pattern a2 b2 >>= (fun () ->
return ()
))
| A.PatUnderscore(a1), B.PatUnderscore(b1) ->
m_tok a1 b1 >>= (fun () ->
return ()
)
| A.PatDisj(a1, a2), B.PatDisj(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_pattern a2 b2 >>= (fun () ->
return ()
))
| A.PatAs(a1, a2), B.PatAs(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_ident a2 b2 >>= (fun () ->
return ()
))
| A.PatTyped(a1, a2), B.PatTyped(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_type_ a2 b2 >>= (fun () ->
return ()
))
| A.PatWhen(a1, a2), B.PatWhen(b1, b2) ->
m_pattern a1 b1 >>= (fun () ->
m_expr a2 b2 >>= (fun () ->
return ()
))
| A.OtherPat(a1, a2), B.OtherPat(b1, b2) ->
m_other_pattern_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.PatVar _, _ | A.PatLiteral _, _ | A.PatConstructor _, _
| A.PatTuple _, _ | A.PatList _, _ | A.PatRecord _, _ | A.PatKeyVal _, _
| A.PatUnderscore _, _ | A.PatDisj _, _ | A.PatWhen _, _ | A.PatAs _, _
| A.PatTyped _, _ | A.OtherPat _, _
-> fail ()
and m_field_pattern a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_name a1 b1 >>= (fun () ->
m_pattern a2 b2 >>= (fun () ->
return ()
))
and m_other_pattern_operator = m_other_xxx
and m_definition a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_entity a1 b1 >>= (fun () ->
m_definition_kind a2 b2 >>= (fun () ->
return ()
))
and m_entity a b =
match a, b with
{ A. name = a1; attrs = a2; type_ = a3; tparams = a4; },
{ B. name = b1; attrs = b2; type_ = b3; tparams = b4; } ->
m_ident a1 b1 >>= (fun () ->
(m_list m_attribute) a2 b2 >>= (fun () ->
(m_option m_type_) a3 b3 >>= (fun () ->
(m_list m_type_parameter) a4 b4 >>= (fun () ->
return ()
))))
and m_definition_kind a b =
match a, b with
| A.FuncDef(a1), B.FuncDef(b1) ->
m_function_definition a1 b1 >>= (fun () ->
return ()
)
| A.VarDef(a1), B.VarDef(b1) ->
m_variable_definition a1 b1 >>= (fun () ->
return ()
)
| A.ClassDef(a1), B.ClassDef(b1) ->
m_class_definition a1 b1 >>= (fun () ->
return ()
)
| A.TypeDef(a1), B.TypeDef(b1) ->
m_type_definition a1 b1 >>= (fun () ->
return ()
)
| A.ModuleDef(a1), B.ModuleDef(b1) ->
m_module_definition a1 b1 >>= (fun () ->
return ()
)
| A.MacroDef(a1), B.MacroDef(b1) ->
m_macro_definition a1 b1 >>= (fun () ->
return ()
)
| A.Signature(a1), B.Signature(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.FuncDef _, _ | A.VarDef _, _ | A.ClassDef _, _ | A.TypeDef _, _
| A.ModuleDef _, _ | A.MacroDef _, _ | A.Signature _, _
-> fail ()
and m_type_parameter_constraint a b =
match a, b with
| A.Extends(a1), B.Extends(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
and m_type_parameter_constraints a b =
match a, b with
(a, b) -> (m_list m_type_parameter_constraint) a b
and m_type_parameter a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_ident a1 b1 >>= (fun () ->
m_type_parameter_constraints a2 b2 >>= (fun () ->
return ()
))
and m_function_definition a b =
match a, b with
{ A. fparams = a1; frettype = a2; fbody = a3; },
{ B. fparams = b1; frettype = b2; fbody = b3; } ->
m_parameters a1 b1 >>= (fun () ->
(m_option m_type_) a2 b2 >>= (fun () ->
m_stmt a3 b3 >>= (fun () ->
return ()
)))
and m_parameters a b =
match a, b with
(a, b) -> (m_list m_parameter) a b
and m_parameter a b =
match a, b with
| A.ParamClassic(a1), B.ParamClassic(b1) ->
m_parameter_classic a1 b1 >>= (fun () ->
return ()
)
| A.ParamPattern(a1), B.ParamPattern(b1) ->
m_pattern a1 b1 >>= (fun () ->
return ()
)
| A.OtherParam(a1, a2), B.OtherParam(b1, b2) ->
m_other_parameter_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.ParamClassic _, _ | A.ParamPattern _, _ | A.OtherParam _, _
-> fail ()
and m_parameter_classic a b =
match a, b with
{ A. pname = a1; pdefault = a2; ptype = a3; pattrs = a4; },
{ B. pname = b1; pdefault = b2; ptype = b3; pattrs = b4; } ->
m_ident a1 b1 >>= (fun () ->
(m_option m_expr) a2 b2 >>= (fun () ->
(m_option m_type_) a3 b3 >>= (fun () ->
(m_list m_attribute) a4 b4 >>= (fun () ->
return ()
))))
and m_other_parameter_operator = m_other_xxx
and m_variable_definition a b =
match a, b with
{ A. vinit = a1; vtype = a2; },
{ B. vinit = b1; vtype = b2; } ->
(m_option m_expr) a1 b1 >>= (fun () ->
(m_option m_type_) a2 b2 >>= (fun () ->
return ()
))
and m_field a b =
match a, b with
| A.FieldVar(a1, a2), B.FieldVar(b1, b2) ->
m_entity a1 b1 >>= (fun () ->
m_variable_definition a2 b2 >>= (fun () ->
return ()
))
| A.FieldMethod(a1, a2), B.FieldMethod(b1, b2) ->
m_entity a1 b1 >>= (fun () ->
m_function_definition a2 b2 >>= (fun () ->
return ()
))
| A.FieldDynamic(a1, a2, a3), B.FieldDynamic(b1, b2, b3) ->
m_expr a1 b1 >>= (fun () ->
(m_list m_attribute) a2 b2 >>= (fun () ->
m_expr a3 b3 >>= (fun () ->
return ()
)))
| A.FieldSpread(a1), B.FieldSpread(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.FieldStmt(a1), B.FieldStmt(b1) ->
m_stmt a1 b1 >>= (fun () ->
return ()
)
| A.FieldVar _, _ | A.FieldMethod _, _ | A.FieldDynamic _, _
| A.FieldSpread _, _ | A.FieldStmt _, _
-> fail ()
and m_type_definition a b =
match a, b with
{ A. tbody = a1;},
{ B. tbody = b1; } ->
m_type_definition_kind a1 b1 >>= (fun () ->
return ()
)
and m_type_definition_kind a b =
match a, b with
| A.OrType(a1), B.OrType(b1) ->
(m_list m_or_type) a1 b1 >>= (fun () ->
return ()
)
| A.AndType(a1), B.AndType(b1) ->
(m_list m_field) a1 b1 >>= (fun () ->
return ()
)
| A.AliasType(a1), B.AliasType(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.Exception(a1, a2), B.Exception(b1, b2) ->
m_ident a1 b1 >>= (fun () ->
(m_list m_type_) a2 b2 >>= (fun () ->
return ()
))
| A.OtherTypeKind(a1, a2), B.OtherTypeKind(b1, b2) ->
m_other_type_kind_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.OrType _, _ | A.AndType _, _ | A.AliasType _, _ | A.Exception _, _
| A.OtherTypeKind _, _
-> fail ()
and m_or_type a b =
match a, b with
| A.OrConstructor(a1, a2), B.OrConstructor(b1, b2) ->
(m_ident) a1 b1 >>= (fun () ->
(m_list m_type_) a2 b2 >>= (fun () ->
return ()
))
| A.OrEnum(a1, a2), B.OrEnum(b1, b2) ->
m_ident a1 b1 >>= (fun () ->
(m_expr) a2 b2 >>= (fun () ->
return ()
))
| A.OrUnion(a1, a2), B.OrUnion(b1, b2) ->
m_ident a1 b1 >>= (fun () ->
(m_type_) a2 b2 >>= (fun () ->
return ()
))
| A.OtherOr(a1, a2), B.OtherOr(b1, b2) ->
m_other_or_type_element_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.OrConstructor _, _ | A.OrEnum _, _ | A.OrUnion _, _ | A.OtherOr _, _
-> fail ()
and m_other_type_kind_operator = m_other_xxx
and m_other_or_type_element_operator = m_other_xxx
and m_class_definition a b =
match a, b with
{ A. ckind = a1; cextends = a2; cimplements = a3; cbody = a4; },
{ B. ckind = b1; cextends = b2; cimplements = b3; cbody = b4; } ->
m_class_kind a1 b1 >>= (fun () ->
(m_list m_type_) a2 b2 >>= (fun () ->
(m_list m_type_) a3 b3 >>= (fun () ->
(m_list m_field) a4 b4 >>= (fun () ->
return ()
))))
and m_class_kind a b =
match a, b with
| A.Class, B.Class ->
return ()
| A.Interface, B.Interface ->
return ()
| A.Trait, B.Trait ->
return ()
| A.Class, _ | A.Interface, _ | A.Trait, _
-> fail ()
and m_module_definition a b =
match a, b with
{ A. mbody = a1; },
{ B. mbody = b1; } ->
m_module_definition_kind a1 b1 >>= (fun () ->
return ()
)
and m_module_definition_kind a b =
match a, b with
| A.ModuleAlias(a1), B.ModuleAlias(b1) ->
m_name a1 b1 >>= (fun () ->
return ()
)
| A.ModuleStruct(a1, a2), B.ModuleStruct(b1, b2) ->
(m_option m_dotted_name) a1 b1 >>= (fun () ->
(m_list m_item) a2 b2 >>= (fun () ->
return ()
))
| A.OtherModule(a1, a2), B.OtherModule(b1, b2) ->
m_other_module_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.ModuleAlias _, _ | A.ModuleStruct _, _ | A.OtherModule _, _
-> fail ()
and m_other_module_operator = m_other_xxx
and m_macro_definition a b =
match a, b with
{ A. macroparams = a1; macrobody = a2; },
{ B. macroparams = b1; macrobody = b2; } ->
(m_list m_ident) a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
and m_directive a b =
match a, b with
| A.Import(a1, a2), B.Import(b1, b2) ->
m_module_name a1 b1 >>= (fun () ->
(m_list m_alias) a2 b2 >>= (fun () ->
return ()
))
| A.ImportAll(a1, a2), B.ImportAll(b1, b2) ->
m_module_name a1 b1 >>= (fun () ->
(m_option m_ident) a2 b2 >>= (fun () ->
return ()
))
| A.OtherDirective(a1, a2), B.OtherDirective(b1, b2) ->
m_other_directive_operator a1 b1 >>= (fun () ->
(m_list m_any) a2 b2 >>= (fun () ->
return ()
))
| A.Import _, _ | A.ImportAll _, _ | A.OtherDirective _, _
-> fail ()
and m_alias a b =
match a, b with
| (a1, a2), (b1, b2) ->
m_ident a1 b1 >>= (fun () ->
(m_option m_ident) a2 b2 >>= (fun () ->
return ()
))
and m_other_directive_operator = m_other_xxx
and m_item a b =
match a, b with
| A.IStmt(a1), B.IStmt(b1) ->
m_stmt a1 b1 >>= (fun () ->
return ()
)
| A.IDef(a1), B.IDef(b1) ->
m_definition a1 b1 >>= (fun () ->
return ()
)
| A.IDir(a1), B.IDir(b1) ->
m_directive a1 b1 >>= (fun () ->
return ()
)
| A.IStmt _, _ | A.IDef _, _ | A.IDir _, _
-> fail ()
and m_program a b =
match a, b with
(a, b) -> (m_list m_item) a b
and m_any a b =
match a, b with
| A.N(a1), B.N(b1) ->
m_name a1 b1 >>= (fun () ->
return ()
)
| A.Di(a1), B.Di(b1) ->
m_dotted_name a1 b1 >>= (fun () ->
return ()
)
| A.En(a1), B.En(b1) ->
m_entity a1 b1 >>= (fun () ->
return ()
)
| A.E(a1), B.E(b1) ->
m_expr a1 b1 >>= (fun () ->
return ()
)
| A.S(a1), B.S(b1) ->
m_stmt a1 b1 >>= (fun () ->
return ()
)
| A.T(a1), B.T(b1) ->
m_type_ a1 b1 >>= (fun () ->
return ()
)
| A.P(a1), B.P(b1) ->
m_pattern a1 b1 >>= (fun () ->
return ()
)
| A.Def(a1), B.Def(b1) ->
m_definition a1 b1 >>= (fun () ->
return ()
)
| A.Dir(a1), B.Dir(b1) ->
m_directive a1 b1 >>= (fun () ->
return ()
)
| A.I(a1), B.I(b1) ->
m_item a1 b1 >>= (fun () ->
return ()
)
| A.Pa(a1), B.Pa(b1) ->
m_parameter a1 b1 >>= (fun () ->
return ()
)
| A.Ar(a1), B.Ar(b1) ->
m_argument a1 b1 >>= (fun () ->
return ()
)
| A.At(a1), B.At(b1) ->
m_attribute a1 b1 >>= (fun () ->
return ()
)
| A.Dk(a1), B.Dk(b1) ->
m_definition_kind a1 b1 >>= (fun () ->
return ()
)
| A.Pr(a1), B.Pr(b1) ->
m_program a1 b1 >>= (fun () ->
return ()
)
| A.Id(a1), B.Id(b1) ->
m_ident a1 b1 >>= (fun () ->
return ()
)
| A.Id _, _ | A.N _, _ | A.Di _, _ | A.En _, _ | A.E _, _
| A.S _, _ | A.T _, _ | A.P _, _ | A.Def _, _ | A.Dir _, _
| A.I _, _ | A.Pa _, _ | A.Ar _, _ | A.At _, _ | A.Dk _, _ | A.Pr _, _
-> fail ()