forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathparse.c
More file actions
17216 lines (16913 loc) · 455 KB
/
parse.c
File metadata and controls
17216 lines (16913 loc) · 455 KB
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
// @generated by pegen.py from ./Grammar/python.gram
#include "pegen.h"
static const int n_keyword_lists = 15;
static KeywordToken *reserved_keywords[] = {
NULL,
NULL,
(KeywordToken[]) {
{"if", 510},
{"in", 518},
{"is", 526},
{"as", 531},
{"or", 532},
{NULL, -1},
},
(KeywordToken[]) {
{"del", 503},
{"try", 511},
{"for", 517},
{"def", 522},
{"not", 525},
{"and", 533},
{NULL, -1},
},
(KeywordToken[]) {
{"pass", 502},
{"from", 514},
{"elif", 515},
{"else", 516},
{"with", 519},
{"True", 527},
{"None", 529},
{NULL, -1},
},
(KeywordToken[]) {
{"raise", 501},
{"yield", 504},
{"break", 506},
{"while", 512},
{"class", 523},
{"False", 528},
{NULL, -1},
},
(KeywordToken[]) {
{"return", 500},
{"assert", 505},
{"global", 508},
{"import", 513},
{"except", 520},
{"lambda", 524},
{NULL, -1},
},
(KeywordToken[]) {
{"finally", 521},
{NULL, -1},
},
(KeywordToken[]) {
{"continue", 507},
{"nonlocal", 509},
{NULL, -1},
},
NULL,
NULL,
NULL,
NULL,
NULL,
(KeywordToken[]) {
{"__new_parser__", 530},
{NULL, -1},
},
};
#define file_type 1000
#define interactive_type 1001
#define eval_type 1002
#define func_type_type 1003
#define fstring_type 1004
#define type_expressions_type 1005
#define statements_type 1006
#define statement_type 1007
#define statement_newline_type 1008
#define simple_stmt_type 1009
#define small_stmt_type 1010
#define compound_stmt_type 1011
#define assignment_type 1012
#define augassign_type 1013
#define global_stmt_type 1014
#define nonlocal_stmt_type 1015
#define yield_stmt_type 1016
#define assert_stmt_type 1017
#define del_stmt_type 1018
#define import_stmt_type 1019
#define import_name_type 1020
#define import_from_type 1021
#define import_from_targets_type 1022
#define import_from_as_names_type 1023
#define import_from_as_name_type 1024
#define dotted_as_names_type 1025
#define dotted_as_name_type 1026
#define dotted_name_type 1027 // Left-recursive
#define if_stmt_type 1028
#define elif_stmt_type 1029
#define else_block_type 1030
#define while_stmt_type 1031
#define for_stmt_type 1032
#define with_stmt_type 1033
#define with_item_type 1034
#define try_stmt_type 1035
#define except_block_type 1036
#define finally_block_type 1037
#define return_stmt_type 1038
#define raise_stmt_type 1039
#define function_def_type 1040
#define function_def_raw_type 1041
#define func_type_comment_type 1042
#define params_type 1043
#define parameters_type 1044
#define slash_no_default_type 1045
#define slash_with_default_type 1046
#define star_etc_type 1047
#define kwds_type 1048
#define param_no_default_type 1049
#define param_with_default_type 1050
#define param_maybe_default_type 1051
#define param_type 1052
#define annotation_type 1053
#define default_type 1054
#define decorators_type 1055
#define class_def_type 1056
#define class_def_raw_type 1057
#define block_type 1058
#define expressions_list_type 1059
#define star_expressions_type 1060
#define star_expression_type 1061
#define star_named_expressions_type 1062
#define star_named_expression_type 1063
#define named_expression_type 1064
#define annotated_rhs_type 1065
#define expressions_type 1066
#define expression_type 1067
#define lambdef_type 1068
#define lambda_parameters_type 1069
#define lambda_slash_no_default_type 1070
#define lambda_slash_with_default_type 1071
#define lambda_star_etc_type 1072
#define lambda_kwds_type 1073
#define lambda_param_no_default_type 1074
#define lambda_param_with_default_type 1075
#define lambda_param_maybe_default_type 1076
#define lambda_param_type 1077
#define disjunction_type 1078
#define conjunction_type 1079
#define inversion_type 1080
#define comparison_type 1081
#define compare_op_bitwise_or_pair_type 1082
#define eq_bitwise_or_type 1083
#define noteq_bitwise_or_type 1084
#define lte_bitwise_or_type 1085
#define lt_bitwise_or_type 1086
#define gte_bitwise_or_type 1087
#define gt_bitwise_or_type 1088
#define notin_bitwise_or_type 1089
#define in_bitwise_or_type 1090
#define isnot_bitwise_or_type 1091
#define is_bitwise_or_type 1092
#define bitwise_or_type 1093 // Left-recursive
#define bitwise_xor_type 1094 // Left-recursive
#define bitwise_and_type 1095 // Left-recursive
#define shift_expr_type 1096 // Left-recursive
#define sum_type 1097 // Left-recursive
#define term_type 1098 // Left-recursive
#define factor_type 1099
#define power_type 1100
#define await_primary_type 1101
#define primary_type 1102 // Left-recursive
#define slices_type 1103
#define slice_type 1104
#define atom_type 1105
#define strings_type 1106
#define list_type 1107
#define listcomp_type 1108
#define tuple_type 1109
#define group_type 1110
#define genexp_type 1111
#define set_type 1112
#define setcomp_type 1113
#define dict_type 1114
#define dictcomp_type 1115
#define kvpairs_type 1116
#define kvpair_type 1117
#define for_if_clauses_type 1118
#define for_if_clause_type 1119
#define yield_expr_type 1120
#define arguments_type 1121
#define args_type 1122
#define kwargs_type 1123
#define starred_expression_type 1124
#define kwarg_or_starred_type 1125
#define kwarg_or_double_starred_type 1126
#define star_targets_type 1127
#define star_targets_seq_type 1128
#define star_target_type 1129
#define star_atom_type 1130
#define inside_paren_ann_assign_target_type 1131
#define ann_assign_subscript_attribute_target_type 1132
#define del_targets_type 1133
#define del_target_type 1134
#define del_t_atom_type 1135
#define targets_type 1136
#define target_type 1137
#define t_primary_type 1138 // Left-recursive
#define t_lookahead_type 1139
#define t_atom_type 1140
#define incorrect_arguments_type 1141
#define invalid_named_expression_type 1142
#define invalid_assignment_type 1143
#define invalid_block_type 1144
#define invalid_comprehension_type 1145
#define invalid_parameters_type 1146
#define invalid_star_etc_type 1147
#define invalid_lambda_star_etc_type 1148
#define invalid_double_type_comments_type 1149
#define _loop0_1_type 1150
#define _loop0_2_type 1151
#define _loop0_4_type 1152
#define _gather_3_type 1153
#define _loop0_6_type 1154
#define _gather_5_type 1155
#define _loop0_8_type 1156
#define _gather_7_type 1157
#define _loop0_10_type 1158
#define _gather_9_type 1159
#define _loop1_11_type 1160
#define _loop0_13_type 1161
#define _gather_12_type 1162
#define _tmp_14_type 1163
#define _tmp_15_type 1164
#define _tmp_16_type 1165
#define _tmp_17_type 1166
#define _tmp_18_type 1167
#define _tmp_19_type 1168
#define _tmp_20_type 1169
#define _tmp_21_type 1170
#define _loop1_22_type 1171
#define _tmp_23_type 1172
#define _tmp_24_type 1173
#define _loop0_26_type 1174
#define _gather_25_type 1175
#define _loop0_28_type 1176
#define _gather_27_type 1177
#define _tmp_29_type 1178
#define _loop0_30_type 1179
#define _loop1_31_type 1180
#define _loop0_33_type 1181
#define _gather_32_type 1182
#define _tmp_34_type 1183
#define _loop0_36_type 1184
#define _gather_35_type 1185
#define _tmp_37_type 1186
#define _loop0_39_type 1187
#define _gather_38_type 1188
#define _loop0_41_type 1189
#define _gather_40_type 1190
#define _loop0_43_type 1191
#define _gather_42_type 1192
#define _loop0_45_type 1193
#define _gather_44_type 1194
#define _tmp_46_type 1195
#define _loop1_47_type 1196
#define _tmp_48_type 1197
#define _tmp_49_type 1198
#define _tmp_50_type 1199
#define _tmp_51_type 1200
#define _tmp_52_type 1201
#define _loop0_53_type 1202
#define _loop0_54_type 1203
#define _loop0_55_type 1204
#define _loop1_56_type 1205
#define _loop0_57_type 1206
#define _loop1_58_type 1207
#define _loop1_59_type 1208
#define _loop1_60_type 1209
#define _loop0_61_type 1210
#define _loop1_62_type 1211
#define _loop0_63_type 1212
#define _loop1_64_type 1213
#define _loop0_65_type 1214
#define _loop1_66_type 1215
#define _loop1_67_type 1216
#define _tmp_68_type 1217
#define _loop0_70_type 1218
#define _gather_69_type 1219
#define _loop1_71_type 1220
#define _loop0_73_type 1221
#define _gather_72_type 1222
#define _loop1_74_type 1223
#define _loop0_75_type 1224
#define _loop0_76_type 1225
#define _loop0_77_type 1226
#define _loop1_78_type 1227
#define _loop0_79_type 1228
#define _loop1_80_type 1229
#define _loop1_81_type 1230
#define _loop1_82_type 1231
#define _loop0_83_type 1232
#define _loop1_84_type 1233
#define _loop0_85_type 1234
#define _loop1_86_type 1235
#define _loop0_87_type 1236
#define _loop1_88_type 1237
#define _loop1_89_type 1238
#define _loop1_90_type 1239
#define _loop1_91_type 1240
#define _tmp_92_type 1241
#define _loop0_94_type 1242
#define _gather_93_type 1243
#define _tmp_95_type 1244
#define _tmp_96_type 1245
#define _tmp_97_type 1246
#define _tmp_98_type 1247
#define _loop1_99_type 1248
#define _tmp_100_type 1249
#define _tmp_101_type 1250
#define _loop0_103_type 1251
#define _gather_102_type 1252
#define _loop1_104_type 1253
#define _loop0_105_type 1254
#define _loop0_106_type 1255
#define _tmp_107_type 1256
#define _tmp_108_type 1257
#define _loop0_110_type 1258
#define _gather_109_type 1259
#define _loop0_112_type 1260
#define _gather_111_type 1261
#define _loop0_114_type 1262
#define _gather_113_type 1263
#define _loop0_116_type 1264
#define _gather_115_type 1265
#define _loop0_117_type 1266
#define _loop0_119_type 1267
#define _gather_118_type 1268
#define _tmp_120_type 1269
#define _loop0_122_type 1270
#define _gather_121_type 1271
#define _loop0_124_type 1272
#define _gather_123_type 1273
#define _tmp_125_type 1274
#define _tmp_126_type 1275
#define _tmp_127_type 1276
#define _tmp_128_type 1277
#define _tmp_129_type 1278
#define _loop0_130_type 1279
#define _tmp_131_type 1280
#define _tmp_132_type 1281
#define _tmp_133_type 1282
#define _tmp_134_type 1283
#define _tmp_135_type 1284
#define _tmp_136_type 1285
#define _tmp_137_type 1286
#define _tmp_138_type 1287
#define _tmp_139_type 1288
#define _tmp_140_type 1289
#define _tmp_141_type 1290
#define _tmp_142_type 1291
#define _tmp_143_type 1292
#define _tmp_144_type 1293
#define _loop1_145_type 1294
#define _tmp_146_type 1295
#define _tmp_147_type 1296
static mod_ty file_rule(Parser *p);
static mod_ty interactive_rule(Parser *p);
static mod_ty eval_rule(Parser *p);
static mod_ty func_type_rule(Parser *p);
static expr_ty fstring_rule(Parser *p);
static asdl_seq* type_expressions_rule(Parser *p);
static asdl_seq* statements_rule(Parser *p);
static asdl_seq* statement_rule(Parser *p);
static asdl_seq* statement_newline_rule(Parser *p);
static asdl_seq* simple_stmt_rule(Parser *p);
static stmt_ty small_stmt_rule(Parser *p);
static stmt_ty compound_stmt_rule(Parser *p);
static stmt_ty assignment_rule(Parser *p);
static AugOperator* augassign_rule(Parser *p);
static stmt_ty global_stmt_rule(Parser *p);
static stmt_ty nonlocal_stmt_rule(Parser *p);
static stmt_ty yield_stmt_rule(Parser *p);
static stmt_ty assert_stmt_rule(Parser *p);
static stmt_ty del_stmt_rule(Parser *p);
static stmt_ty import_stmt_rule(Parser *p);
static stmt_ty import_name_rule(Parser *p);
static stmt_ty import_from_rule(Parser *p);
static asdl_seq* import_from_targets_rule(Parser *p);
static asdl_seq* import_from_as_names_rule(Parser *p);
static alias_ty import_from_as_name_rule(Parser *p);
static asdl_seq* dotted_as_names_rule(Parser *p);
static alias_ty dotted_as_name_rule(Parser *p);
static expr_ty dotted_name_rule(Parser *p);
static stmt_ty if_stmt_rule(Parser *p);
static stmt_ty elif_stmt_rule(Parser *p);
static asdl_seq* else_block_rule(Parser *p);
static stmt_ty while_stmt_rule(Parser *p);
static stmt_ty for_stmt_rule(Parser *p);
static stmt_ty with_stmt_rule(Parser *p);
static withitem_ty with_item_rule(Parser *p);
static stmt_ty try_stmt_rule(Parser *p);
static excepthandler_ty except_block_rule(Parser *p);
static asdl_seq* finally_block_rule(Parser *p);
static stmt_ty return_stmt_rule(Parser *p);
static stmt_ty raise_stmt_rule(Parser *p);
static stmt_ty function_def_rule(Parser *p);
static stmt_ty function_def_raw_rule(Parser *p);
static Token* func_type_comment_rule(Parser *p);
static arguments_ty params_rule(Parser *p);
static arguments_ty parameters_rule(Parser *p);
static asdl_seq* slash_no_default_rule(Parser *p);
static SlashWithDefault* slash_with_default_rule(Parser *p);
static StarEtc* star_etc_rule(Parser *p);
static arg_ty kwds_rule(Parser *p);
static arg_ty param_no_default_rule(Parser *p);
static NameDefaultPair* param_with_default_rule(Parser *p);
static NameDefaultPair* param_maybe_default_rule(Parser *p);
static arg_ty param_rule(Parser *p);
static expr_ty annotation_rule(Parser *p);
static expr_ty default_rule(Parser *p);
static asdl_seq* decorators_rule(Parser *p);
static stmt_ty class_def_rule(Parser *p);
static stmt_ty class_def_raw_rule(Parser *p);
static asdl_seq* block_rule(Parser *p);
static asdl_seq* expressions_list_rule(Parser *p);
static expr_ty star_expressions_rule(Parser *p);
static expr_ty star_expression_rule(Parser *p);
static asdl_seq* star_named_expressions_rule(Parser *p);
static expr_ty star_named_expression_rule(Parser *p);
static expr_ty named_expression_rule(Parser *p);
static expr_ty annotated_rhs_rule(Parser *p);
static expr_ty expressions_rule(Parser *p);
static expr_ty expression_rule(Parser *p);
static expr_ty lambdef_rule(Parser *p);
static arguments_ty lambda_parameters_rule(Parser *p);
static asdl_seq* lambda_slash_no_default_rule(Parser *p);
static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
static StarEtc* lambda_star_etc_rule(Parser *p);
static arg_ty lambda_kwds_rule(Parser *p);
static arg_ty lambda_param_no_default_rule(Parser *p);
static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
static arg_ty lambda_param_rule(Parser *p);
static expr_ty disjunction_rule(Parser *p);
static expr_ty conjunction_rule(Parser *p);
static expr_ty inversion_rule(Parser *p);
static expr_ty comparison_rule(Parser *p);
static CmpopExprPair* compare_op_bitwise_or_pair_rule(Parser *p);
static CmpopExprPair* eq_bitwise_or_rule(Parser *p);
static CmpopExprPair* noteq_bitwise_or_rule(Parser *p);
static CmpopExprPair* lte_bitwise_or_rule(Parser *p);
static CmpopExprPair* lt_bitwise_or_rule(Parser *p);
static CmpopExprPair* gte_bitwise_or_rule(Parser *p);
static CmpopExprPair* gt_bitwise_or_rule(Parser *p);
static CmpopExprPair* notin_bitwise_or_rule(Parser *p);
static CmpopExprPair* in_bitwise_or_rule(Parser *p);
static CmpopExprPair* isnot_bitwise_or_rule(Parser *p);
static CmpopExprPair* is_bitwise_or_rule(Parser *p);
static expr_ty bitwise_or_rule(Parser *p);
static expr_ty bitwise_xor_rule(Parser *p);
static expr_ty bitwise_and_rule(Parser *p);
static expr_ty shift_expr_rule(Parser *p);
static expr_ty sum_rule(Parser *p);
static expr_ty term_rule(Parser *p);
static expr_ty factor_rule(Parser *p);
static expr_ty power_rule(Parser *p);
static expr_ty await_primary_rule(Parser *p);
static expr_ty primary_rule(Parser *p);
static expr_ty slices_rule(Parser *p);
static expr_ty slice_rule(Parser *p);
static expr_ty atom_rule(Parser *p);
static expr_ty strings_rule(Parser *p);
static expr_ty list_rule(Parser *p);
static expr_ty listcomp_rule(Parser *p);
static expr_ty tuple_rule(Parser *p);
static expr_ty group_rule(Parser *p);
static expr_ty genexp_rule(Parser *p);
static expr_ty set_rule(Parser *p);
static expr_ty setcomp_rule(Parser *p);
static expr_ty dict_rule(Parser *p);
static expr_ty dictcomp_rule(Parser *p);
static asdl_seq* kvpairs_rule(Parser *p);
static KeyValuePair* kvpair_rule(Parser *p);
static asdl_seq* for_if_clauses_rule(Parser *p);
static comprehension_ty for_if_clause_rule(Parser *p);
static expr_ty yield_expr_rule(Parser *p);
static expr_ty arguments_rule(Parser *p);
static expr_ty args_rule(Parser *p);
static asdl_seq* kwargs_rule(Parser *p);
static expr_ty starred_expression_rule(Parser *p);
static KeywordOrStarred* kwarg_or_starred_rule(Parser *p);
static KeywordOrStarred* kwarg_or_double_starred_rule(Parser *p);
static expr_ty star_targets_rule(Parser *p);
static asdl_seq* star_targets_seq_rule(Parser *p);
static expr_ty star_target_rule(Parser *p);
static expr_ty star_atom_rule(Parser *p);
static expr_ty inside_paren_ann_assign_target_rule(Parser *p);
static expr_ty ann_assign_subscript_attribute_target_rule(Parser *p);
static asdl_seq* del_targets_rule(Parser *p);
static expr_ty del_target_rule(Parser *p);
static expr_ty del_t_atom_rule(Parser *p);
static asdl_seq* targets_rule(Parser *p);
static expr_ty target_rule(Parser *p);
static expr_ty t_primary_rule(Parser *p);
static void *t_lookahead_rule(Parser *p);
static expr_ty t_atom_rule(Parser *p);
static void *incorrect_arguments_rule(Parser *p);
static void *invalid_named_expression_rule(Parser *p);
static void *invalid_assignment_rule(Parser *p);
static void *invalid_block_rule(Parser *p);
static void *invalid_comprehension_rule(Parser *p);
static void *invalid_parameters_rule(Parser *p);
static void *invalid_star_etc_rule(Parser *p);
static void *invalid_lambda_star_etc_rule(Parser *p);
static void *invalid_double_type_comments_rule(Parser *p);
static asdl_seq *_loop0_1_rule(Parser *p);
static asdl_seq *_loop0_2_rule(Parser *p);
static asdl_seq *_loop0_4_rule(Parser *p);
static asdl_seq *_gather_3_rule(Parser *p);
static asdl_seq *_loop0_6_rule(Parser *p);
static asdl_seq *_gather_5_rule(Parser *p);
static asdl_seq *_loop0_8_rule(Parser *p);
static asdl_seq *_gather_7_rule(Parser *p);
static asdl_seq *_loop0_10_rule(Parser *p);
static asdl_seq *_gather_9_rule(Parser *p);
static asdl_seq *_loop1_11_rule(Parser *p);
static asdl_seq *_loop0_13_rule(Parser *p);
static asdl_seq *_gather_12_rule(Parser *p);
static void *_tmp_14_rule(Parser *p);
static void *_tmp_15_rule(Parser *p);
static void *_tmp_16_rule(Parser *p);
static void *_tmp_17_rule(Parser *p);
static void *_tmp_18_rule(Parser *p);
static void *_tmp_19_rule(Parser *p);
static void *_tmp_20_rule(Parser *p);
static void *_tmp_21_rule(Parser *p);
static asdl_seq *_loop1_22_rule(Parser *p);
static void *_tmp_23_rule(Parser *p);
static void *_tmp_24_rule(Parser *p);
static asdl_seq *_loop0_26_rule(Parser *p);
static asdl_seq *_gather_25_rule(Parser *p);
static asdl_seq *_loop0_28_rule(Parser *p);
static asdl_seq *_gather_27_rule(Parser *p);
static void *_tmp_29_rule(Parser *p);
static asdl_seq *_loop0_30_rule(Parser *p);
static asdl_seq *_loop1_31_rule(Parser *p);
static asdl_seq *_loop0_33_rule(Parser *p);
static asdl_seq *_gather_32_rule(Parser *p);
static void *_tmp_34_rule(Parser *p);
static asdl_seq *_loop0_36_rule(Parser *p);
static asdl_seq *_gather_35_rule(Parser *p);
static void *_tmp_37_rule(Parser *p);
static asdl_seq *_loop0_39_rule(Parser *p);
static asdl_seq *_gather_38_rule(Parser *p);
static asdl_seq *_loop0_41_rule(Parser *p);
static asdl_seq *_gather_40_rule(Parser *p);
static asdl_seq *_loop0_43_rule(Parser *p);
static asdl_seq *_gather_42_rule(Parser *p);
static asdl_seq *_loop0_45_rule(Parser *p);
static asdl_seq *_gather_44_rule(Parser *p);
static void *_tmp_46_rule(Parser *p);
static asdl_seq *_loop1_47_rule(Parser *p);
static void *_tmp_48_rule(Parser *p);
static void *_tmp_49_rule(Parser *p);
static void *_tmp_50_rule(Parser *p);
static void *_tmp_51_rule(Parser *p);
static void *_tmp_52_rule(Parser *p);
static asdl_seq *_loop0_53_rule(Parser *p);
static asdl_seq *_loop0_54_rule(Parser *p);
static asdl_seq *_loop0_55_rule(Parser *p);
static asdl_seq *_loop1_56_rule(Parser *p);
static asdl_seq *_loop0_57_rule(Parser *p);
static asdl_seq *_loop1_58_rule(Parser *p);
static asdl_seq *_loop1_59_rule(Parser *p);
static asdl_seq *_loop1_60_rule(Parser *p);
static asdl_seq *_loop0_61_rule(Parser *p);
static asdl_seq *_loop1_62_rule(Parser *p);
static asdl_seq *_loop0_63_rule(Parser *p);
static asdl_seq *_loop1_64_rule(Parser *p);
static asdl_seq *_loop0_65_rule(Parser *p);
static asdl_seq *_loop1_66_rule(Parser *p);
static asdl_seq *_loop1_67_rule(Parser *p);
static void *_tmp_68_rule(Parser *p);
static asdl_seq *_loop0_70_rule(Parser *p);
static asdl_seq *_gather_69_rule(Parser *p);
static asdl_seq *_loop1_71_rule(Parser *p);
static asdl_seq *_loop0_73_rule(Parser *p);
static asdl_seq *_gather_72_rule(Parser *p);
static asdl_seq *_loop1_74_rule(Parser *p);
static asdl_seq *_loop0_75_rule(Parser *p);
static asdl_seq *_loop0_76_rule(Parser *p);
static asdl_seq *_loop0_77_rule(Parser *p);
static asdl_seq *_loop1_78_rule(Parser *p);
static asdl_seq *_loop0_79_rule(Parser *p);
static asdl_seq *_loop1_80_rule(Parser *p);
static asdl_seq *_loop1_81_rule(Parser *p);
static asdl_seq *_loop1_82_rule(Parser *p);
static asdl_seq *_loop0_83_rule(Parser *p);
static asdl_seq *_loop1_84_rule(Parser *p);
static asdl_seq *_loop0_85_rule(Parser *p);
static asdl_seq *_loop1_86_rule(Parser *p);
static asdl_seq *_loop0_87_rule(Parser *p);
static asdl_seq *_loop1_88_rule(Parser *p);
static asdl_seq *_loop1_89_rule(Parser *p);
static asdl_seq *_loop1_90_rule(Parser *p);
static asdl_seq *_loop1_91_rule(Parser *p);
static void *_tmp_92_rule(Parser *p);
static asdl_seq *_loop0_94_rule(Parser *p);
static asdl_seq *_gather_93_rule(Parser *p);
static void *_tmp_95_rule(Parser *p);
static void *_tmp_96_rule(Parser *p);
static void *_tmp_97_rule(Parser *p);
static void *_tmp_98_rule(Parser *p);
static asdl_seq *_loop1_99_rule(Parser *p);
static void *_tmp_100_rule(Parser *p);
static void *_tmp_101_rule(Parser *p);
static asdl_seq *_loop0_103_rule(Parser *p);
static asdl_seq *_gather_102_rule(Parser *p);
static asdl_seq *_loop1_104_rule(Parser *p);
static asdl_seq *_loop0_105_rule(Parser *p);
static asdl_seq *_loop0_106_rule(Parser *p);
static void *_tmp_107_rule(Parser *p);
static void *_tmp_108_rule(Parser *p);
static asdl_seq *_loop0_110_rule(Parser *p);
static asdl_seq *_gather_109_rule(Parser *p);
static asdl_seq *_loop0_112_rule(Parser *p);
static asdl_seq *_gather_111_rule(Parser *p);
static asdl_seq *_loop0_114_rule(Parser *p);
static asdl_seq *_gather_113_rule(Parser *p);
static asdl_seq *_loop0_116_rule(Parser *p);
static asdl_seq *_gather_115_rule(Parser *p);
static asdl_seq *_loop0_117_rule(Parser *p);
static asdl_seq *_loop0_119_rule(Parser *p);
static asdl_seq *_gather_118_rule(Parser *p);
static void *_tmp_120_rule(Parser *p);
static asdl_seq *_loop0_122_rule(Parser *p);
static asdl_seq *_gather_121_rule(Parser *p);
static asdl_seq *_loop0_124_rule(Parser *p);
static asdl_seq *_gather_123_rule(Parser *p);
static void *_tmp_125_rule(Parser *p);
static void *_tmp_126_rule(Parser *p);
static void *_tmp_127_rule(Parser *p);
static void *_tmp_128_rule(Parser *p);
static void *_tmp_129_rule(Parser *p);
static asdl_seq *_loop0_130_rule(Parser *p);
static void *_tmp_131_rule(Parser *p);
static void *_tmp_132_rule(Parser *p);
static void *_tmp_133_rule(Parser *p);
static void *_tmp_134_rule(Parser *p);
static void *_tmp_135_rule(Parser *p);
static void *_tmp_136_rule(Parser *p);
static void *_tmp_137_rule(Parser *p);
static void *_tmp_138_rule(Parser *p);
static void *_tmp_139_rule(Parser *p);
static void *_tmp_140_rule(Parser *p);
static void *_tmp_141_rule(Parser *p);
static void *_tmp_142_rule(Parser *p);
static void *_tmp_143_rule(Parser *p);
static void *_tmp_144_rule(Parser *p);
static asdl_seq *_loop1_145_rule(Parser *p);
static void *_tmp_146_rule(Parser *p);
static void *_tmp_147_rule(Parser *p);
// file: statements? $
static mod_ty
file_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
mod_ty res = NULL;
int mark = p->mark;
{ // statements? $
void *a;
Token * endmarker_var;
if (
(a = statements_rule(p), 1)
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
)
{
res = _PyPegen_make_module ( p , a );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
res = NULL;
done:
return res;
}
// interactive: statement_newline
static mod_ty
interactive_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
mod_ty res = NULL;
int mark = p->mark;
{ // statement_newline
asdl_seq* a;
if (
(a = statement_newline_rule(p))
)
{
res = Interactive ( a , p -> arena );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
res = NULL;
done:
return res;
}
// eval: expressions NEWLINE* $
static mod_ty
eval_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
mod_ty res = NULL;
int mark = p->mark;
{ // expressions NEWLINE* $
asdl_seq * _loop0_1_var;
expr_ty a;
Token * endmarker_var;
if (
(a = expressions_rule(p))
&&
(_loop0_1_var = _loop0_1_rule(p))
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
)
{
res = Expression ( a , p -> arena );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
res = NULL;
done:
return res;
}
// func_type: '(' type_expressions? ')' '->' expression NEWLINE* $
static mod_ty
func_type_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
mod_ty res = NULL;
int mark = p->mark;
{ // '(' type_expressions? ')' '->' expression NEWLINE* $
asdl_seq * _loop0_2_var;
void *a;
expr_ty b;
Token * endmarker_var;
Token * literal;
Token * literal_1;
Token * literal_2;
if (
(literal = _PyPegen_expect_token(p, 7))
&&
(a = type_expressions_rule(p), 1)
&&
(literal_1 = _PyPegen_expect_token(p, 8))
&&
(literal_2 = _PyPegen_expect_token(p, 51))
&&
(b = expression_rule(p))
&&
(_loop0_2_var = _loop0_2_rule(p))
&&
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
)
{
res = FunctionType ( a , b , p -> arena );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
res = NULL;
done:
return res;
}
// fstring: star_expressions
static expr_ty
fstring_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
expr_ty res = NULL;
int mark = p->mark;
{ // star_expressions
expr_ty star_expressions_var;
if (
(star_expressions_var = star_expressions_rule(p))
)
{
res = star_expressions_var;
goto done;
}
p->mark = mark;
}
res = NULL;
done:
return res;
}
// type_expressions:
// | ','.expression+ ',' '*' expression ',' '**' expression
// | ','.expression+ ',' '*' expression
// | ','.expression+ ',' '**' expression
// | '*' expression ',' '**' expression
// | '*' expression
// | '**' expression
// | ','.expression+
static asdl_seq*
type_expressions_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq* res = NULL;
int mark = p->mark;
{ // ','.expression+ ',' '*' expression ',' '**' expression
asdl_seq * a;
expr_ty b;
expr_ty c;
Token * literal;
Token * literal_1;
Token * literal_2;
Token * literal_3;
if (
(a = _gather_3_rule(p))
&&
(literal = _PyPegen_expect_token(p, 12))
&&
(literal_1 = _PyPegen_expect_token(p, 16))
&&
(b = expression_rule(p))
&&
(literal_2 = _PyPegen_expect_token(p, 12))
&&
(literal_3 = _PyPegen_expect_token(p, 35))
&&
(c = expression_rule(p))
)
{
res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // ','.expression+ ',' '*' expression
asdl_seq * a;
expr_ty b;
Token * literal;
Token * literal_1;
if (
(a = _gather_5_rule(p))
&&
(literal = _PyPegen_expect_token(p, 12))
&&
(literal_1 = _PyPegen_expect_token(p, 16))
&&
(b = expression_rule(p))
)
{
res = _PyPegen_seq_append_to_end ( p , a , b );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // ','.expression+ ',' '**' expression
asdl_seq * a;
expr_ty b;
Token * literal;
Token * literal_1;
if (
(a = _gather_7_rule(p))
&&
(literal = _PyPegen_expect_token(p, 12))
&&
(literal_1 = _PyPegen_expect_token(p, 35))
&&
(b = expression_rule(p))
)
{
res = _PyPegen_seq_append_to_end ( p , a , b );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // '*' expression ',' '**' expression
expr_ty a;
expr_ty b;
Token * literal;
Token * literal_1;
Token * literal_2;
if (
(literal = _PyPegen_expect_token(p, 16))
&&
(a = expression_rule(p))
&&
(literal_1 = _PyPegen_expect_token(p, 12))
&&
(literal_2 = _PyPegen_expect_token(p, 35))
&&
(b = expression_rule(p))
)
{
res = _PyPegen_seq_append_to_end ( p , CHECK ( _PyPegen_singleton_seq ( p , a ) ) , b );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // '*' expression
expr_ty a;
Token * literal;
if (
(literal = _PyPegen_expect_token(p, 16))
&&
(a = expression_rule(p))
)
{
res = _PyPegen_singleton_seq ( p , a );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // '**' expression
expr_ty a;
Token * literal;
if (
(literal = _PyPegen_expect_token(p, 35))
&&
(a = expression_rule(p))
)
{
res = _PyPegen_singleton_seq ( p , a );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
}
goto done;
}
p->mark = mark;
}
{ // ','.expression+
asdl_seq * _gather_9_var;
if (
(_gather_9_var = _gather_9_rule(p))
)