summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Grammar/python.gram109
-rw-r--r--Lib/test/test_type_comments.py7
-rw-r--r--Parser/pegen/parse.c3698
-rw-r--r--Parser/pegen/pegen.c151
-rw-r--r--Parser/pegen/pegen.h44
-rw-r--r--Python/bltinmodule.c6
6 files changed, 2567 insertions, 1448 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 0ff2dcc..e1164d9 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -17,6 +17,8 @@ _PyPegen_parse(Parser *p)
result = interactive_rule(p);
} else if (p->start_rule == Py_eval_input) {
result = eval_rule(p);
+ } else if (p->start_rule == Py_func_type_input) {
+ result = func_type_rule(p);
} else if (p->start_rule == Py_fstring_input) {
result = fstring_rule(p);
}
@@ -26,11 +28,20 @@ _PyPegen_parse(Parser *p)
// The end
'''
-file[mod_ty]: a=[statements] ENDMARKER { Module(a, NULL, p->arena) }
+file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }
interactive[mod_ty]: a=statement_newline { Interactive(a, p->arena) }
eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { Expression(a, p->arena) }
+func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMARKER { FunctionType(a, b, p->arena) }
fstring[expr_ty]: star_expressions
+# type_expressions allow */** but ignore them
+type_expressions[asdl_seq*]:
+ | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
+ _PyPegen_seq_append_to_end(p, CHECK(_PyPegen_seq_append_to_end(p, a, b)), c) }
+ | a=','.expression+ ',' '*' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
+ | a=','.expression+ ',' '**' b=expression { _PyPegen_seq_append_to_end(p, a, b) }
+ | ','.expression+
+
statements[asdl_seq*]: a=statement+ { _PyPegen_seq_flatten(p, a) }
statement[asdl_seq*]: a=compound_stmt { _PyPegen_singleton_seq(p, a) } | simple_stmt
statement_newline[asdl_seq*]:
@@ -73,8 +84,8 @@ assignment:
| a=('(' b=inside_paren_ann_assign_target ')' { b }
| ann_assign_subscript_attribute_target) ':' b=expression c=['=' d=annotated_rhs { d }] {
_Py_AnnAssign(a, b, c, 0, EXTRA)}
- | a=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) {
- _Py_Assign(a, b, NULL, EXTRA) }
+ | a=(z=star_targets '=' { z })+ b=(yield_expr | star_expressions) tc=[TYPE_COMMENT] {
+ _Py_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
| a=target b=augassign c=(yield_expr | star_expressions) {
_Py_AugAssign(a, b->kind, c, EXTRA) }
| invalid_assignment
@@ -145,14 +156,14 @@ while_stmt[stmt_ty]:
| 'while' a=named_expression ':' b=block c=[else_block] { _Py_While(a, b, c, EXTRA) }
for_stmt[stmt_ty]:
- | is_async=[ASYNC] 'for' t=star_targets 'in' ex=star_expressions ':' b=block el=[else_block] {
- (is_async ? _Py_AsyncFor : _Py_For)(t, ex, b, el, NULL, EXTRA) }
+ | is_async=[ASYNC] 'for' t=star_targets 'in' ex=star_expressions ':' tc=[TYPE_COMMENT] b=block el=[else_block] {
+ (is_async ? _Py_AsyncFor : _Py_For)(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }
with_stmt[stmt_ty]:
| is_async=[ASYNC] 'with' '(' a=','.with_item+ ')' ':' b=block {
(is_async ? _Py_AsyncWith : _Py_With)(a, b, NULL, EXTRA) }
- | is_async=[ASYNC] 'with' a=','.with_item+ ':' b=block {
- (is_async ? _Py_AsyncWith : _Py_With)(a, b, NULL, EXTRA) }
+ | is_async=[ASYNC] 'with' a=','.with_item+ ':' tc=[TYPE_COMMENT] b=block {
+ (is_async ? _Py_AsyncWith : _Py_With)(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
with_item[withitem_ty]:
| e=expression o=['as' t=target { t }] { _Py_withitem(e, o, p->arena) }
@@ -177,43 +188,74 @@ function_def[stmt_ty]:
| function_def_raw
function_def_raw[stmt_ty]:
- | is_async=[ASYNC] 'def' n=NAME '(' params=[params] ')' a=['->' z=annotation { z }] ':' b=block {
+ | is_async=[ASYNC] 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] ':' tc=[func_type_comment] b=block {
(is_async ? _Py_AsyncFunctionDef : _Py_FunctionDef)(n->v.Name.id,
(params) ? params : CHECK(_PyPegen_empty_arguments(p)),
- b, NULL, a, NULL, EXTRA) }
+ b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) }
+func_type_comment[PyObject*]:
+ | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by indented block
+ | invalid_double_type_comments
+ | TYPE_COMMENT
params[arguments_ty]:
| invalid_parameters
| parameters
+
parameters[arguments_ty]:
- | a=slash_without_default b=[',' x=plain_names { x }] c=[',' y=names_with_default { y }] d=[',' z=[star_etc] { z }] {
+ | a=slash_no_default b=param_no_default* c=param_with_default* d=[star_etc] {
_PyPegen_make_arguments(p, a, NULL, b, c, d) }
- | a=slash_with_default b=[',' y=names_with_default { y }] c=[',' z=[star_etc] { z }] {
+ | a=slash_with_default b=param_with_default* c=[star_etc] {
_PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
- | a=plain_names b=[',' y=names_with_default { y }] c=[',' z=[star_etc] { z }] {
+ | a=param_no_default+ b=param_with_default* c=[star_etc] {
_PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
- | a=names_with_default b=[',' z=[star_etc] { z }] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
+ | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
| a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
-slash_without_default[asdl_seq*]: a=plain_names ',' '/' { a }
-slash_with_default[SlashWithDefault*]: a=[n=plain_names ',' { n }] b=names_with_default ',' '/' {
- _PyPegen_slash_with_default(p, a, b) }
+
+# Some duplication here because we can't write (',' | &')'),
+# which is because we don't support empty alternatives (yet).
+#
+slash_no_default[asdl_seq*]:
+ | a=param_no_default+ '/' ',' { a }
+ | a=param_no_default+ '/' &')' { a }
+slash_with_default[SlashWithDefault*]:
+ | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, a, b) }
+ | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, a, b) }
+
star_etc[StarEtc*]:
- | '*' a=plain_name b=name_with_optional_default* c=[',' d=kwds { d }] [','] {
+ | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
_PyPegen_star_etc(p, a, b, c) }
- | '*' b=name_with_optional_default+ c=[',' d=kwds { d }] [','] {
+ | '*' ',' b=param_maybe_default+ c=[kwds] {
_PyPegen_star_etc(p, NULL, b, c) }
- | a=kwds [','] { _PyPegen_star_etc(p, NULL, NULL, a) }
-name_with_optional_default[NameDefaultPair*]:
- | ',' a=plain_name b=['=' e=expression { e }] { _PyPegen_name_default_pair(p, a, b) }
-names_with_default[asdl_seq*]: a=','.name_with_default+ { a }
-name_with_default[NameDefaultPair*]:
- | n=plain_name '=' e=expression { _PyPegen_name_default_pair(p, n, e) }
-plain_names[asdl_seq*] (memo): a=','.(plain_name !'=')+ { a }
-plain_name[arg_ty]:
- | a=NAME b=[':' z=annotation { z }] { _Py_arg(a->v.Name.id, b, NULL, EXTRA) }
+ | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }
+
kwds[arg_ty]:
- | '**' a=plain_name { a }
-annotation[expr_ty]: expression
+ | '**' a=param_no_default { a }
+
+# One parameter. This *includes* a following comma and type comment.
+#
+# There are three styles:
+# - No default
+# - With default
+# - Maybe with default
+#
+# There are two alternative forms of each, to deal with type comments:
+# - Ends in a comma followed by an optional type comment
+# - No comma, optional type comment, must be followed by close paren
+# The latter form is for a final parameter without trailing comma.
+#
+param_no_default[arg_ty]:
+ | a=param ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, tc) }
+ | a=param tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }
+param_with_default[NameDefaultPair*]:
+ | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, a, c, tc) }
+ | a=param c=default tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, a, c, tc) }
+param_maybe_default[NameDefaultPair*]:
+ | a=param c=default? ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, a, c, tc) }
+ | a=param c=default? tc=TYPE_COMMENT? &')' { _PyPegen_name_default_pair(p, a, c, tc) }
+param[arg_ty]: a=NAME b=annotation? { _Py_arg(a->v.Name.id, b, NULL, EXTRA) }
+
+annotation[expr_ty]: ':' a=expression { a }
+default[expr_ty]: '=' a=expression { a }
decorators[asdl_seq*]: a=('@' f=named_expression NEWLINE { f })+ { a }
@@ -284,10 +326,10 @@ lambda_star_etc[StarEtc*]:
_PyPegen_star_etc(p, NULL, b, c) }
| a=lambda_kwds [','] { _PyPegen_star_etc(p, NULL, NULL, a) }
lambda_name_with_optional_default[NameDefaultPair*]:
- | ',' a=lambda_plain_name b=['=' e=expression { e }] { _PyPegen_name_default_pair(p, a, b) }
+ | ',' a=lambda_plain_name b=['=' e=expression { e }] { _PyPegen_name_default_pair(p, a, b, NULL) }
lambda_names_with_default[asdl_seq*]: a=','.lambda_name_with_default+ { a }
lambda_name_with_default[NameDefaultPair*]:
- | n=lambda_plain_name '=' e=expression { _PyPegen_name_default_pair(p, n, e) }
+ | n=lambda_plain_name '=' e=expression { _PyPegen_name_default_pair(p, n, e, NULL) }
lambda_plain_names[asdl_seq*]: a=','.(lambda_plain_name !'=')+ { a }
lambda_plain_name[arg_ty]: a=NAME { _Py_arg(a->v.Name.id, NULL, NULL, EXTRA) }
lambda_kwds[arg_ty]: '**' a=lambda_plain_name { a }
@@ -552,5 +594,8 @@ invalid_comprehension:
| ('[' | '(' | '{') '*' expression for_if_clauses {
RAISE_SYNTAX_ERROR("iterable unpacking cannot be used in comprehension") }
invalid_parameters:
- | [plain_names ','] (slash_with_default | names_with_default) ',' plain_names {
+ | param_no_default* (slash_with_default | param_with_default+) param_no_default {
RAISE_SYNTAX_ERROR("non-default argument follows default argument") }
+invalid_double_type_comments:
+ | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
+ RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }
diff --git a/Lib/test/test_type_comments.py b/Lib/test/test_type_comments.py
index ce3b798..6c3f6ed 100644
--- a/Lib/test/test_type_comments.py
+++ b/Lib/test/test_type_comments.py
@@ -219,7 +219,6 @@ def favk(
"""
-@support.skip_if_new_parser("Pegen does not support type comments yet")
class TypeCommentTests(unittest.TestCase):
lowest = 4 # Lowest minor version supported
@@ -253,6 +252,7 @@ class TypeCommentTests(unittest.TestCase):
self.assertEqual(tree.body[0].type_comment, None)
self.assertEqual(tree.body[1].type_comment, None)
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_asyncdef(self):
for tree in self.parse_all(asyncdef, minver=5):
self.assertEqual(tree.body[0].type_comment, "() -> int")
@@ -261,22 +261,27 @@ class TypeCommentTests(unittest.TestCase):
self.assertEqual(tree.body[0].type_comment, None)
self.assertEqual(tree.body[1].type_comment, None)
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_asyncvar(self):
for tree in self.parse_all(asyncvar, maxver=6):
pass
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_asynccomp(self):
for tree in self.parse_all(asynccomp, minver=6):
pass
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_matmul(self):
for tree in self.parse_all(matmul, minver=5):
pass
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_fstring(self):
for tree in self.parse_all(fstring, minver=6):
pass
+ @support.skip_if_new_parser("Pegen does not support feature_version yet")
def test_underscorednumber(self):
for tree in self.parse_all(underscorednumber, minver=6):
pass
diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c
index 76dd6d3..8ff9a70 100644
--- a/Parser/pegen/parse.c
+++ b/Parser/pegen/parse.c
@@ -71,289 +71,300 @@ static KeywordToken *reserved_keywords[] = {
#define file_type 1000
#define interactive_type 1001
#define eval_type 1002
-#define fstring_type 1003
-#define statements_type 1004
-#define statement_type 1005
-#define statement_newline_type 1006
-#define simple_stmt_type 1007
-#define small_stmt_type 1008
-#define compound_stmt_type 1009
-#define assignment_type 1010
-#define augassign_type 1011
-#define global_stmt_type 1012
-#define nonlocal_stmt_type 1013
-#define yield_stmt_type 1014
-#define assert_stmt_type 1015
-#define del_stmt_type 1016
-#define import_stmt_type 1017
-#define import_name_type 1018
-#define import_from_type 1019
-#define import_from_targets_type 1020
-#define import_from_as_names_type 1021
-#define import_from_as_name_type 1022
-#define dotted_as_names_type 1023
-#define dotted_as_name_type 1024
-#define dotted_name_type 1025 // Left-recursive
-#define if_stmt_type 1026
-#define elif_stmt_type 1027
-#define else_block_type 1028
-#define while_stmt_type 1029
-#define for_stmt_type 1030
-#define with_stmt_type 1031
-#define with_item_type 1032
-#define try_stmt_type 1033
-#define except_block_type 1034
-#define finally_block_type 1035
-#define return_stmt_type 1036
-#define raise_stmt_type 1037
-#define function_def_type 1038
-#define function_def_raw_type 1039
-#define params_type 1040
-#define parameters_type 1041
-#define slash_without_default_type 1042
-#define slash_with_default_type 1043
-#define star_etc_type 1044
-#define name_with_optional_default_type 1045
-#define names_with_default_type 1046
-#define name_with_default_type 1047
-#define plain_names_type 1048
-#define plain_name_type 1049
-#define kwds_type 1050
-#define annotation_type 1051
-#define decorators_type 1052
-#define class_def_type 1053
-#define class_def_raw_type 1054
-#define block_type 1055
-#define expressions_list_type 1056
-#define star_expressions_type 1057
-#define star_expression_type 1058
-#define star_named_expressions_type 1059
-#define star_named_expression_type 1060
-#define named_expression_type 1061
-#define annotated_rhs_type 1062
-#define expressions_type 1063
-#define expression_type 1064
-#define lambdef_type 1065
-#define lambda_parameters_type 1066
-#define lambda_slash_without_default_type 1067
-#define lambda_slash_with_default_type 1068
-#define lambda_star_etc_type 1069
-#define lambda_name_with_optional_default_type 1070
-#define lambda_names_with_default_type 1071
-#define lambda_name_with_default_type 1072
-#define lambda_plain_names_type 1073
-#define lambda_plain_name_type 1074
-#define lambda_kwds_type 1075
-#define disjunction_type 1076
-#define conjunction_type 1077
-#define inversion_type 1078
-#define comparison_type 1079
-#define compare_op_bitwise_or_pair_type 1080
-#define eq_bitwise_or_type 1081
-#define noteq_bitwise_or_type 1082
-#define lte_bitwise_or_type 1083
-#define lt_bitwise_or_type 1084
-#define gte_bitwise_or_type 1085
-#define gt_bitwise_or_type 1086
-#define notin_bitwise_or_type 1087
-#define in_bitwise_or_type 1088
-#define isnot_bitwise_or_type 1089
-#define is_bitwise_or_type 1090
-#define bitwise_or_type 1091 // Left-recursive
-#define bitwise_xor_type 1092 // Left-recursive
-#define bitwise_and_type 1093 // Left-recursive
-#define shift_expr_type 1094 // Left-recursive
-#define sum_type 1095 // Left-recursive
-#define term_type 1096 // Left-recursive
-#define factor_type 1097
-#define power_type 1098
-#define await_primary_type 1099
-#define primary_type 1100 // Left-recursive
-#define slices_type 1101
-#define slice_type 1102
-#define atom_type 1103
-#define strings_type 1104
-#define list_type 1105
-#define listcomp_type 1106
-#define tuple_type 1107
-#define group_type 1108
-#define genexp_type 1109
-#define set_type 1110
-#define setcomp_type 1111
-#define dict_type 1112
-#define dictcomp_type 1113
-#define kvpairs_type 1114
-#define kvpair_type 1115
-#define for_if_clauses_type 1116
-#define yield_expr_type 1117
-#define arguments_type 1118
-#define args_type 1119
-#define kwargs_type 1120
-#define starred_expression_type 1121
-#define kwarg_or_starred_type 1122
-#define kwarg_or_double_starred_type 1123
-#define star_targets_type 1124
-#define star_targets_seq_type 1125
-#define star_target_type 1126
-#define star_atom_type 1127
-#define inside_paren_ann_assign_target_type 1128
-#define ann_assign_subscript_attribute_target_type 1129
-#define del_targets_type 1130
-#define del_target_type 1131
-#define del_t_atom_type 1132
-#define targets_type 1133
-#define target_type 1134
-#define t_primary_type 1135 // Left-recursive
-#define t_lookahead_type 1136
-#define t_atom_type 1137
-#define incorrect_arguments_type 1138
-#define invalid_named_expression_type 1139
-#define invalid_assignment_type 1140
-#define invalid_block_type 1141
-#define invalid_comprehension_type 1142
-#define invalid_parameters_type 1143
-#define _loop0_1_type 1144
-#define _loop1_2_type 1145
-#define _loop0_4_type 1146
-#define _gather_3_type 1147
-#define _tmp_5_type 1148
-#define _tmp_6_type 1149
-#define _tmp_7_type 1150
-#define _tmp_8_type 1151
-#define _tmp_9_type 1152
-#define _tmp_10_type 1153
-#define _tmp_11_type 1154
-#define _tmp_12_type 1155
-#define _loop1_13_type 1156
-#define _tmp_14_type 1157
-#define _tmp_15_type 1158
-#define _loop0_17_type 1159
-#define _gather_16_type 1160
-#define _loop0_19_type 1161
-#define _gather_18_type 1162
-#define _tmp_20_type 1163
-#define _loop0_21_type 1164
-#define _loop1_22_type 1165
-#define _loop0_24_type 1166
-#define _gather_23_type 1167
-#define _tmp_25_type 1168
-#define _loop0_27_type 1169
-#define _gather_26_type 1170
-#define _tmp_28_type 1171
-#define _loop0_30_type 1172
-#define _gather_29_type 1173
-#define _loop0_32_type 1174
-#define _gather_31_type 1175
-#define _tmp_33_type 1176
-#define _loop1_34_type 1177
-#define _tmp_35_type 1178
-#define _tmp_36_type 1179
-#define _tmp_37_type 1180
-#define _tmp_38_type 1181
-#define _tmp_39_type 1182
-#define _tmp_40_type 1183
-#define _tmp_41_type 1184
-#define _tmp_42_type 1185
-#define _tmp_43_type 1186
-#define _tmp_44_type 1187
-#define _tmp_45_type 1188
-#define _tmp_46_type 1189
-#define _loop0_47_type 1190
-#define _tmp_48_type 1191
-#define _loop1_49_type 1192
-#define _tmp_50_type 1193
-#define _tmp_51_type 1194
-#define _loop0_53_type 1195
-#define _gather_52_type 1196
-#define _loop0_55_type 1197
-#define _gather_54_type 1198
-#define _tmp_56_type 1199
-#define _loop1_57_type 1200
-#define _tmp_58_type 1201
-#define _loop0_60_type 1202
-#define _gather_59_type 1203
-#define _loop1_61_type 1204
-#define _loop0_63_type 1205
-#define _gather_62_type 1206
-#define _loop1_64_type 1207
-#define _tmp_65_type 1208
-#define _tmp_66_type 1209
-#define _tmp_67_type 1210
-#define _tmp_68_type 1211
-#define _tmp_69_type 1212
-#define _tmp_70_type 1213
-#define _tmp_71_type 1214
-#define _tmp_72_type 1215
-#define _tmp_73_type 1216
-#define _loop0_74_type 1217
-#define _tmp_75_type 1218
-#define _loop1_76_type 1219
-#define _tmp_77_type 1220
-#define _tmp_78_type 1221
-#define _loop0_80_type 1222
-#define _gather_79_type 1223
-#define _loop0_82_type 1224
-#define _gather_81_type 1225
-#define _loop1_83_type 1226
-#define _loop1_84_type 1227
-#define _loop1_85_type 1228
-#define _tmp_86_type 1229
-#define _loop0_88_type 1230
-#define _gather_87_type 1231
-#define _tmp_89_type 1232
-#define _tmp_90_type 1233
-#define _tmp_91_type 1234
-#define _tmp_92_type 1235
-#define _loop1_93_type 1236
-#define _tmp_94_type 1237
-#define _tmp_95_type 1238
-#define _loop0_97_type 1239
-#define _gather_96_type 1240
-#define _loop1_98_type 1241
-#define _tmp_99_type 1242
-#define _tmp_100_type 1243
-#define _loop0_102_type 1244
-#define _gather_101_type 1245
-#define _loop0_104_type 1246
-#define _gather_103_type 1247
-#define _loop0_106_type 1248
-#define _gather_105_type 1249
-#define _loop0_108_type 1250
-#define _gather_107_type 1251
-#define _loop0_109_type 1252
-#define _loop0_111_type 1253
-#define _gather_110_type 1254
-#define _tmp_112_type 1255
-#define _loop0_114_type 1256
-#define _gather_113_type 1257
-#define _loop0_116_type 1258
-#define _gather_115_type 1259
-#define _tmp_117_type 1260
-#define _tmp_118_type 1261
-#define _tmp_119_type 1262
-#define _tmp_120_type 1263
-#define _tmp_121_type 1264
-#define _tmp_122_type 1265
-#define _tmp_123_type 1266
-#define _tmp_124_type 1267
-#define _tmp_125_type 1268
-#define _tmp_126_type 1269
-#define _tmp_127_type 1270
-#define _tmp_128_type 1271
-#define _tmp_129_type 1272
-#define _tmp_130_type 1273
-#define _tmp_131_type 1274
-#define _tmp_132_type 1275
-#define _tmp_133_type 1276
-#define _tmp_134_type 1277
-#define _tmp_135_type 1278
-#define _loop0_136_type 1279
-#define _tmp_137_type 1280
+#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_without_default_type 1070
+#define lambda_slash_with_default_type 1071
+#define lambda_star_etc_type 1072
+#define lambda_name_with_optional_default_type 1073
+#define lambda_names_with_default_type 1074
+#define lambda_name_with_default_type 1075
+#define lambda_plain_names_type 1076
+#define lambda_plain_name_type 1077
+#define lambda_kwds_type 1078
+#define disjunction_type 1079
+#define conjunction_type 1080
+#define inversion_type 1081
+#define comparison_type 1082
+#define compare_op_bitwise_or_pair_type 1083
+#define eq_bitwise_or_type 1084
+#define noteq_bitwise_or_type 1085
+#define lte_bitwise_or_type 1086
+#define lt_bitwise_or_type 1087
+#define gte_bitwise_or_type 1088
+#define gt_bitwise_or_type 1089
+#define notin_bitwise_or_type 1090
+#define in_bitwise_or_type 1091
+#define isnot_bitwise_or_type 1092
+#define is_bitwise_or_type 1093
+#define bitwise_or_type 1094 // Left-recursive
+#define bitwise_xor_type 1095 // Left-recursive
+#define bitwise_and_type 1096 // Left-recursive
+#define shift_expr_type 1097 // Left-recursive
+#define sum_type 1098 // Left-recursive
+#define term_type 1099 // Left-recursive
+#define factor_type 1100
+#define power_type 1101
+#define await_primary_type 1102
+#define primary_type 1103 // Left-recursive
+#define slices_type 1104
+#define slice_type 1105
+#define atom_type 1106
+#define strings_type 1107
+#define list_type 1108
+#define listcomp_type 1109
+#define tuple_type 1110
+#define group_type 1111
+#define genexp_type 1112
+#define set_type 1113
+#define setcomp_type 1114
+#define dict_type 1115
+#define dictcomp_type 1116
+#define kvpairs_type 1117
+#define kvpair_type 1118
+#define for_if_clauses_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_double_type_comments_type 1147
+#define _loop0_1_type 1148
+#define _loop0_2_type 1149
+#define _loop0_4_type 1150
+#define _gather_3_type 1151
+#define _loop0_6_type 1152
+#define _gather_5_type 1153
+#define _loop0_8_type 1154
+#define _gather_7_type 1155
+#define _loop0_10_type 1156
+#define _gather_9_type 1157
+#define _loop1_11_type 1158
+#define _loop0_13_type 1159
+#define _gather_12_type 1160
+#define _tmp_14_type 1161
+#define _tmp_15_type 1162
+#define _tmp_16_type 1163
+#define _tmp_17_type 1164
+#define _tmp_18_type 1165
+#define _tmp_19_type 1166
+#define _tmp_20_type 1167
+#define _tmp_21_type 1168
+#define _loop1_22_type 1169
+#define _tmp_23_type 1170
+#define _tmp_24_type 1171
+#define _loop0_26_type 1172
+#define _gather_25_type 1173
+#define _loop0_28_type 1174
+#define _gather_27_type 1175
+#define _tmp_29_type 1176
+#define _loop0_30_type 1177
+#define _loop1_31_type 1178
+#define _loop0_33_type 1179
+#define _gather_32_type 1180
+#define _tmp_34_type 1181
+#define _loop0_36_type 1182
+#define _gather_35_type 1183
+#define _tmp_37_type 1184
+#define _loop0_39_type 1185
+#define _gather_38_type 1186
+#define _loop0_41_type 1187
+#define _gather_40_type 1188
+#define _tmp_42_type 1189
+#define _loop1_43_type 1190
+#define _tmp_44_type 1191
+#define _tmp_45_type 1192
+#define _tmp_46_type 1193
+#define _tmp_47_type 1194
+#define _loop0_48_type 1195
+#define _loop0_49_type 1196
+#define _loop0_50_type 1197
+#define _loop1_51_type 1198
+#define _loop0_52_type 1199
+#define _loop1_53_type 1200
+#define _loop1_54_type 1201
+#define _loop1_55_type 1202
+#define _loop0_56_type 1203
+#define _loop1_57_type 1204
+#define _loop0_58_type 1205
+#define _loop1_59_type 1206
+#define _loop0_60_type 1207
+#define _loop1_61_type 1208
+#define _loop1_62_type 1209
+#define _tmp_63_type 1210
+#define _loop0_65_type 1211
+#define _gather_64_type 1212
+#define _loop1_66_type 1213
+#define _loop0_68_type 1214
+#define _gather_67_type 1215
+#define _loop1_69_type 1216
+#define _tmp_70_type 1217
+#define _tmp_71_type 1218
+#define _tmp_72_type 1219
+#define _tmp_73_type 1220
+#define _tmp_74_type 1221
+#define _tmp_75_type 1222
+#define _tmp_76_type 1223
+#define _tmp_77_type 1224
+#define _tmp_78_type 1225
+#define _loop0_79_type 1226
+#define _tmp_80_type 1227
+#define _loop1_81_type 1228
+#define _tmp_82_type 1229
+#define _tmp_83_type 1230
+#define _loop0_85_type 1231
+#define _gather_84_type 1232
+#define _loop0_87_type 1233
+#define _gather_86_type 1234
+#define _loop1_88_type 1235
+#define _loop1_89_type 1236
+#define _loop1_90_type 1237
+#define _tmp_91_type 1238
+#define _loop0_93_type 1239
+#define _gather_92_type 1240
+#define _tmp_94_type 1241
+#define _tmp_95_type 1242
+#define _tmp_96_type 1243
+#define _tmp_97_type 1244
+#define _loop1_98_type 1245
+#define _tmp_99_type 1246
+#define _tmp_100_type 1247
+#define _loop0_102_type 1248
+#define _gather_101_type 1249
+#define _loop1_103_type 1250
+#define _tmp_104_type 1251
+#define _tmp_105_type 1252
+#define _loop0_107_type 1253
+#define _gather_106_type 1254
+#define _loop0_109_type 1255
+#define _gather_108_type 1256
+#define _loop0_111_type 1257
+#define _gather_110_type 1258
+#define _loop0_113_type 1259
+#define _gather_112_type 1260
+#define _loop0_114_type 1261
+#define _loop0_116_type 1262
+#define _gather_115_type 1263
+#define _tmp_117_type 1264
+#define _loop0_119_type 1265
+#define _gather_118_type 1266
+#define _loop0_121_type 1267
+#define _gather_120_type 1268
+#define _tmp_122_type 1269
+#define _tmp_123_type 1270
+#define _tmp_124_type 1271
+#define _tmp_125_type 1272
+#define _tmp_126_type 1273
+#define _loop0_127_type 1274
+#define _tmp_128_type 1275
+#define _tmp_129_type 1276
+#define _tmp_130_type 1277
+#define _tmp_131_type 1278
+#define _tmp_132_type 1279
+#define _tmp_133_type 1280
+#define _tmp_134_type 1281
+#define _tmp_135_type 1282
+#define _tmp_136_type 1283
+#define _tmp_137_type 1284
+#define _tmp_138_type 1285
+#define _tmp_139_type 1286
+#define _loop1_140_type 1287
+#define _loop0_141_type 1288
+#define _tmp_142_type 1289
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);
@@ -390,18 +401,19 @@ 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 PyObject* func_type_comment_rule(Parser *p);
static arguments_ty params_rule(Parser *p);
static arguments_ty parameters_rule(Parser *p);
-static asdl_seq* slash_without_default_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 NameDefaultPair* name_with_optional_default_rule(Parser *p);
-static asdl_seq* names_with_default_rule(Parser *p);
-static NameDefaultPair* name_with_default_rule(Parser *p);
-static asdl_seq* plain_names_rule(Parser *p);
-static arg_ty plain_name_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);
@@ -494,133 +506,134 @@ 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_double_type_comments_rule(Parser *p);
static asdl_seq *_loop0_1_rule(Parser *p);
-static asdl_seq *_loop1_2_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 void *_tmp_5_rule(Parser *p);
-static void *_tmp_6_rule(Parser *p);
-static void *_tmp_7_rule(Parser *p);
-static void *_tmp_8_rule(Parser *p);
-static void *_tmp_9_rule(Parser *p);
-static void *_tmp_10_rule(Parser *p);
-static void *_tmp_11_rule(Parser *p);
-static void *_tmp_12_rule(Parser *p);
-static asdl_seq *_loop1_13_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 asdl_seq *_loop0_17_rule(Parser *p);
-static asdl_seq *_gather_16_rule(Parser *p);
-static asdl_seq *_loop0_19_rule(Parser *p);
-static asdl_seq *_gather_18_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 asdl_seq *_loop0_21_rule(Parser *p);
+static void *_tmp_21_rule(Parser *p);
static asdl_seq *_loop1_22_rule(Parser *p);
-static asdl_seq *_loop0_24_rule(Parser *p);
-static asdl_seq *_gather_23_rule(Parser *p);
-static void *_tmp_25_rule(Parser *p);
-static asdl_seq *_loop0_27_rule(Parser *p);
-static asdl_seq *_gather_26_rule(Parser *p);
-static void *_tmp_28_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 *_gather_29_rule(Parser *p);
-static asdl_seq *_loop0_32_rule(Parser *p);
-static asdl_seq *_gather_31_rule(Parser *p);
-static void *_tmp_33_rule(Parser *p);
-static asdl_seq *_loop1_34_rule(Parser *p);
-static void *_tmp_35_rule(Parser *p);
-static void *_tmp_36_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 void *_tmp_38_rule(Parser *p);
-static void *_tmp_39_rule(Parser *p);
-static void *_tmp_40_rule(Parser *p);
-static void *_tmp_41_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 void *_tmp_42_rule(Parser *p);
-static void *_tmp_43_rule(Parser *p);
+static asdl_seq *_loop1_43_rule(Parser *p);
static void *_tmp_44_rule(Parser *p);
static void *_tmp_45_rule(Parser *p);
static void *_tmp_46_rule(Parser *p);
-static asdl_seq *_loop0_47_rule(Parser *p);
-static void *_tmp_48_rule(Parser *p);
-static asdl_seq *_loop1_49_rule(Parser *p);
-static void *_tmp_50_rule(Parser *p);
-static void *_tmp_51_rule(Parser *p);
-static asdl_seq *_loop0_53_rule(Parser *p);
-static asdl_seq *_gather_52_rule(Parser *p);
-static asdl_seq *_loop0_55_rule(Parser *p);
-static asdl_seq *_gather_54_rule(Parser *p);
-static void *_tmp_56_rule(Parser *p);
+static void *_tmp_47_rule(Parser *p);
+static asdl_seq *_loop0_48_rule(Parser *p);
+static asdl_seq *_loop0_49_rule(Parser *p);
+static asdl_seq *_loop0_50_rule(Parser *p);
+static asdl_seq *_loop1_51_rule(Parser *p);
+static asdl_seq *_loop0_52_rule(Parser *p);
+static asdl_seq *_loop1_53_rule(Parser *p);
+static asdl_seq *_loop1_54_rule(Parser *p);
+static asdl_seq *_loop1_55_rule(Parser *p);
+static asdl_seq *_loop0_56_rule(Parser *p);
static asdl_seq *_loop1_57_rule(Parser *p);
-static void *_tmp_58_rule(Parser *p);
+static asdl_seq *_loop0_58_rule(Parser *p);
+static asdl_seq *_loop1_59_rule(Parser *p);
static asdl_seq *_loop0_60_rule(Parser *p);
-static asdl_seq *_gather_59_rule(Parser *p);
static asdl_seq *_loop1_61_rule(Parser *p);
-static asdl_seq *_loop0_63_rule(Parser *p);
-static asdl_seq *_gather_62_rule(Parser *p);
-static asdl_seq *_loop1_64_rule(Parser *p);
-static void *_tmp_65_rule(Parser *p);
-static void *_tmp_66_rule(Parser *p);
-static void *_tmp_67_rule(Parser *p);
-static void *_tmp_68_rule(Parser *p);
-static void *_tmp_69_rule(Parser *p);
+static asdl_seq *_loop1_62_rule(Parser *p);
+static void *_tmp_63_rule(Parser *p);
+static asdl_seq *_loop0_65_rule(Parser *p);
+static asdl_seq *_gather_64_rule(Parser *p);
+static asdl_seq *_loop1_66_rule(Parser *p);
+static asdl_seq *_loop0_68_rule(Parser *p);
+static asdl_seq *_gather_67_rule(Parser *p);
+static asdl_seq *_loop1_69_rule(Parser *p);
static void *_tmp_70_rule(Parser *p);
static void *_tmp_71_rule(Parser *p);
static void *_tmp_72_rule(Parser *p);
static void *_tmp_73_rule(Parser *p);
-static asdl_seq *_loop0_74_rule(Parser *p);
+static void *_tmp_74_rule(Parser *p);
static void *_tmp_75_rule(Parser *p);
-static asdl_seq *_loop1_76_rule(Parser *p);
+static void *_tmp_76_rule(Parser *p);
static void *_tmp_77_rule(Parser *p);
static void *_tmp_78_rule(Parser *p);
-static asdl_seq *_loop0_80_rule(Parser *p);
-static asdl_seq *_gather_79_rule(Parser *p);
-static asdl_seq *_loop0_82_rule(Parser *p);
-static asdl_seq *_gather_81_rule(Parser *p);
-static asdl_seq *_loop1_83_rule(Parser *p);
-static asdl_seq *_loop1_84_rule(Parser *p);
-static asdl_seq *_loop1_85_rule(Parser *p);
-static void *_tmp_86_rule(Parser *p);
-static asdl_seq *_loop0_88_rule(Parser *p);
-static asdl_seq *_gather_87_rule(Parser *p);
-static void *_tmp_89_rule(Parser *p);
-static void *_tmp_90_rule(Parser *p);
+static asdl_seq *_loop0_79_rule(Parser *p);
+static void *_tmp_80_rule(Parser *p);
+static asdl_seq *_loop1_81_rule(Parser *p);
+static void *_tmp_82_rule(Parser *p);
+static void *_tmp_83_rule(Parser *p);
+static asdl_seq *_loop0_85_rule(Parser *p);
+static asdl_seq *_gather_84_rule(Parser *p);
+static asdl_seq *_loop0_87_rule(Parser *p);
+static asdl_seq *_gather_86_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 void *_tmp_91_rule(Parser *p);
-static void *_tmp_92_rule(Parser *p);
-static asdl_seq *_loop1_93_rule(Parser *p);
+static asdl_seq *_loop0_93_rule(Parser *p);
+static asdl_seq *_gather_92_rule(Parser *p);
static void *_tmp_94_rule(Parser *p);
static void *_tmp_95_rule(Parser *p);
-static asdl_seq *_loop0_97_rule(Parser *p);
-static asdl_seq *_gather_96_rule(Parser *p);
+static void *_tmp_96_rule(Parser *p);
+static void *_tmp_97_rule(Parser *p);
static asdl_seq *_loop1_98_rule(Parser *p);
static void *_tmp_99_rule(Parser *p);
static void *_tmp_100_rule(Parser *p);
static asdl_seq *_loop0_102_rule(Parser *p);
static asdl_seq *_gather_101_rule(Parser *p);
-static asdl_seq *_loop0_104_rule(Parser *p);
-static asdl_seq *_gather_103_rule(Parser *p);
-static asdl_seq *_loop0_106_rule(Parser *p);
-static asdl_seq *_gather_105_rule(Parser *p);
-static asdl_seq *_loop0_108_rule(Parser *p);
-static asdl_seq *_gather_107_rule(Parser *p);
+static asdl_seq *_loop1_103_rule(Parser *p);
+static void *_tmp_104_rule(Parser *p);
+static void *_tmp_105_rule(Parser *p);
+static asdl_seq *_loop0_107_rule(Parser *p);
+static asdl_seq *_gather_106_rule(Parser *p);
static asdl_seq *_loop0_109_rule(Parser *p);
+static asdl_seq *_gather_108_rule(Parser *p);
static asdl_seq *_loop0_111_rule(Parser *p);
static asdl_seq *_gather_110_rule(Parser *p);
-static void *_tmp_112_rule(Parser *p);
+static asdl_seq *_loop0_113_rule(Parser *p);
+static asdl_seq *_gather_112_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 void *_tmp_117_rule(Parser *p);
-static void *_tmp_118_rule(Parser *p);
-static void *_tmp_119_rule(Parser *p);
-static void *_tmp_120_rule(Parser *p);
-static void *_tmp_121_rule(Parser *p);
+static asdl_seq *_loop0_119_rule(Parser *p);
+static asdl_seq *_gather_118_rule(Parser *p);
+static asdl_seq *_loop0_121_rule(Parser *p);
+static asdl_seq *_gather_120_rule(Parser *p);
static void *_tmp_122_rule(Parser *p);
static void *_tmp_123_rule(Parser *p);
static void *_tmp_124_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 asdl_seq *_loop0_127_rule(Parser *p);
static void *_tmp_128_rule(Parser *p);
static void *_tmp_129_rule(Parser *p);
static void *_tmp_130_rule(Parser *p);
@@ -629,8 +642,13 @@ 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 asdl_seq *_loop0_136_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 asdl_seq *_loop1_140_rule(Parser *p);
+static asdl_seq *_loop0_141_rule(Parser *p);
+static void *_tmp_142_rule(Parser *p);
// file: statements? $
@@ -651,7 +669,7 @@ file_rule(Parser *p)
(endmarker_var = _PyPegen_expect_token(p, ENDMARKER))
)
{
- res = Module ( a , NULL , p -> arena );
+ res = _PyPegen_make_module ( p , a );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -729,6 +747,53 @@ eval_rule(Parser *p)
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;
+ void *endmarker_var;
+ void *literal;
+ void *literal_1;
+ void *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)
@@ -754,6 +819,116 @@ fstring_rule(Parser *p)
return res;
}
+// type_expressions:
+// | ','.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;
+ void *literal;
+ void *literal_1;
+ void *literal_2;
+ void *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;
+ void *literal;
+ void *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;
+ void *literal;
+ void *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+
+ asdl_seq * _gather_9_var;
+ if (
+ (_gather_9_var = _gather_9_rule(p))
+ )
+ {
+ res = _gather_9_var;
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
// statements: statement+
static asdl_seq*
statements_rule(Parser *p)
@@ -766,7 +941,7 @@ statements_rule(Parser *p)
{ // statement+
asdl_seq * a;
if (
- (a = _loop1_2_rule(p))
+ (a = _loop1_11_rule(p))
)
{
res = _PyPegen_seq_flatten ( p , a );
@@ -947,7 +1122,7 @@ simple_stmt_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_3_rule(p))
+ (a = _gather_12_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 13), 1)
&&
@@ -1050,7 +1225,7 @@ small_stmt_rule(Parser *p)
{ // &('import' | 'from') import_stmt
stmt_ty import_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_5_rule, p)
+ _PyPegen_lookahead(1, _tmp_14_rule, p)
&&
(import_stmt_var = import_stmt_rule(p))
)
@@ -1232,7 +1407,7 @@ compound_stmt_rule(Parser *p)
{ // &('def' | '@' | ASYNC) function_def
stmt_ty function_def_var;
if (
- _PyPegen_lookahead(1, _tmp_6_rule, p)
+ _PyPegen_lookahead(1, _tmp_15_rule, p)
&&
(function_def_var = function_def_rule(p))
)
@@ -1258,7 +1433,7 @@ compound_stmt_rule(Parser *p)
{ // &('class' | '@') class_def
stmt_ty class_def_var;
if (
- _PyPegen_lookahead(1, _tmp_7_rule, p)
+ _PyPegen_lookahead(1, _tmp_16_rule, p)
&&
(class_def_var = class_def_rule(p))
)
@@ -1271,7 +1446,7 @@ compound_stmt_rule(Parser *p)
{ // &('with' | ASYNC) with_stmt
stmt_ty with_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_8_rule, p)
+ _PyPegen_lookahead(1, _tmp_17_rule, p)
&&
(with_stmt_var = with_stmt_rule(p))
)
@@ -1284,7 +1459,7 @@ compound_stmt_rule(Parser *p)
{ // &('for' | ASYNC) for_stmt
stmt_ty for_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_9_rule, p)
+ _PyPegen_lookahead(1, _tmp_18_rule, p)
&&
(for_stmt_var = for_stmt_rule(p))
)
@@ -1328,7 +1503,7 @@ compound_stmt_rule(Parser *p)
// assignment:
// | NAME ':' expression ['=' annotated_rhs]
// | ('(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target) ':' expression ['=' annotated_rhs]
-// | ((star_targets '='))+ (yield_expr | star_expressions)
+// | ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
// | target augassign (yield_expr | star_expressions)
// | invalid_assignment
static void *
@@ -1359,7 +1534,7 @@ assignment_rule(Parser *p)
&&
(b = expression_rule(p))
&&
- (c = _tmp_10_rule(p), 1)
+ (c = _tmp_19_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1385,13 +1560,13 @@ assignment_rule(Parser *p)
void *c;
void *literal;
if (
- (a = _tmp_11_rule(p))
+ (a = _tmp_20_rule(p))
&&
(literal = _PyPegen_expect_token(p, 11))
&&
(b = expression_rule(p))
&&
- (c = _tmp_12_rule(p), 1)
+ (c = _tmp_21_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1411,13 +1586,16 @@ assignment_rule(Parser *p)
}
p->mark = mark;
}
- { // ((star_targets '='))+ (yield_expr | star_expressions)
+ { // ((star_targets '='))+ (yield_expr | star_expressions) TYPE_COMMENT?
asdl_seq * a;
void *b;
+ void *tc;
if (
- (a = _loop1_13_rule(p))
+ (a = _loop1_22_rule(p))
+ &&
+ (b = _tmp_23_rule(p))
&&
- (b = _tmp_14_rule(p))
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1428,7 +1606,7 @@ assignment_rule(Parser *p)
UNUSED(end_lineno); // Only used by EXTRA macro
int end_col_offset = token->end_col_offset;
UNUSED(end_col_offset); // Only used by EXTRA macro
- res = _Py_Assign ( a , b , NULL , EXTRA );
+ res = _Py_Assign ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -1446,7 +1624,7 @@ assignment_rule(Parser *p)
&&
(b = augassign_rule(p))
&&
- (c = _tmp_15_rule(p))
+ (c = _tmp_24_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1727,7 +1905,7 @@ global_stmt_rule(Parser *p)
if (
(keyword = _PyPegen_expect_token(p, 508))
&&
- (a = _gather_16_rule(p))
+ (a = _gather_25_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1775,7 +1953,7 @@ nonlocal_stmt_rule(Parser *p)
if (
(keyword = _PyPegen_expect_token(p, 509))
&&
- (a = _gather_18_rule(p))
+ (a = _gather_27_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -1871,7 +2049,7 @@ assert_stmt_rule(Parser *p)
&&
(a = expression_rule(p))
&&
- (b = _tmp_20_rule(p), 1)
+ (b = _tmp_29_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -2056,7 +2234,7 @@ import_from_rule(Parser *p)
if (
(keyword = _PyPegen_expect_token(p, 514))
&&
- (a = _loop0_21_rule(p))
+ (a = _loop0_30_rule(p))
&&
(b = dotted_name_rule(p))
&&
@@ -2090,7 +2268,7 @@ import_from_rule(Parser *p)
if (
(keyword = _PyPegen_expect_token(p, 514))
&&
- (a = _loop1_22_rule(p))
+ (a = _loop1_31_rule(p))
&&
(keyword_1 = _PyPegen_expect_token(p, 513))
&&
@@ -2196,7 +2374,7 @@ import_from_as_names_rule(Parser *p)
{ // ','.import_from_as_name+
asdl_seq * a;
if (
- (a = _gather_23_rule(p))
+ (a = _gather_32_rule(p))
)
{
res = a;
@@ -2228,7 +2406,7 @@ import_from_as_name_rule(Parser *p)
if (
(a = _PyPegen_name_token(p))
&&
- (b = _tmp_25_rule(p), 1)
+ (b = _tmp_34_rule(p), 1)
)
{
res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
@@ -2257,7 +2435,7 @@ dotted_as_names_rule(Parser *p)
{ // ','.dotted_as_name+
asdl_seq * a;
if (
- (a = _gather_26_rule(p))
+ (a = _gather_35_rule(p))
)
{
res = a;
@@ -2289,7 +2467,7 @@ dotted_as_name_rule(Parser *p)
if (
(a = dotted_name_rule(p))
&&
- (b = _tmp_28_rule(p), 1)
+ (b = _tmp_37_rule(p), 1)
)
{
res = _Py_alias ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Name . id : NULL , p -> arena );
@@ -2657,7 +2835,8 @@ while_stmt_rule(Parser *p)
return res;
}
-// for_stmt: ASYNC? 'for' star_targets 'in' star_expressions ':' block else_block?
+// for_stmt:
+// | ASYNC? 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
static stmt_ty
for_stmt_rule(Parser *p)
{
@@ -2674,7 +2853,7 @@ for_stmt_rule(Parser *p)
UNUSED(start_lineno); // Only used by EXTRA macro
int start_col_offset = p->tokens[mark]->col_offset;
UNUSED(start_col_offset); // Only used by EXTRA macro
- { // ASYNC? 'for' star_targets 'in' star_expressions ':' block else_block?
+ { // ASYNC? 'for' star_targets 'in' star_expressions ':' TYPE_COMMENT? block else_block?
asdl_seq* b;
void *el;
expr_ty ex;
@@ -2683,6 +2862,7 @@ for_stmt_rule(Parser *p)
void *keyword_1;
void *literal;
expr_ty t;
+ void *tc;
if (
(is_async = _PyPegen_expect_token(p, ASYNC), 1)
&&
@@ -2696,6 +2876,8 @@ for_stmt_rule(Parser *p)
&&
(literal = _PyPegen_expect_token(p, 11))
&&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
+ &&
(b = block_rule(p))
&&
(el = else_block_rule(p), 1)
@@ -2709,7 +2891,7 @@ for_stmt_rule(Parser *p)
UNUSED(end_lineno); // Only used by EXTRA macro
int end_col_offset = token->end_col_offset;
UNUSED(end_col_offset); // Only used by EXTRA macro
- res = ( is_async ? _Py_AsyncFor : _Py_For ) ( t , ex , b , el , NULL , EXTRA );
+ res = ( is_async ? _Py_AsyncFor : _Py_For ) ( t , ex , b , el , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -2725,7 +2907,7 @@ for_stmt_rule(Parser *p)
// with_stmt:
// | ASYNC? 'with' '(' ','.with_item+ ')' ':' block
-// | ASYNC? 'with' ','.with_item+ ':' block
+// | ASYNC? 'with' ','.with_item+ ':' TYPE_COMMENT? block
static stmt_ty
with_stmt_rule(Parser *p)
{
@@ -2757,7 +2939,7 @@ with_stmt_rule(Parser *p)
&&
(literal = _PyPegen_expect_token(p, 7))
&&
- (a = _gather_29_rule(p))
+ (a = _gather_38_rule(p))
&&
(literal_1 = _PyPegen_expect_token(p, 8))
&&
@@ -2783,21 +2965,24 @@ with_stmt_rule(Parser *p)
}
p->mark = mark;
}
- { // ASYNC? 'with' ','.with_item+ ':' block
+ { // ASYNC? 'with' ','.with_item+ ':' TYPE_COMMENT? block
asdl_seq * a;
asdl_seq* b;
void *is_async;
void *keyword;
void *literal;
+ void *tc;
if (
(is_async = _PyPegen_expect_token(p, ASYNC), 1)
&&
(keyword = _PyPegen_expect_token(p, 519))
&&
- (a = _gather_31_rule(p))
+ (a = _gather_40_rule(p))
&&
(literal = _PyPegen_expect_token(p, 11))
&&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
+ &&
(b = block_rule(p))
)
{
@@ -2809,7 +2994,7 @@ with_stmt_rule(Parser *p)
UNUSED(end_lineno); // Only used by EXTRA macro
int end_col_offset = token->end_col_offset;
UNUSED(end_col_offset); // Only used by EXTRA macro
- res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NULL , EXTRA );
+ res = ( is_async ? _Py_AsyncWith : _Py_With ) ( a , b , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -2838,7 +3023,7 @@ with_item_rule(Parser *p)
if (
(e = expression_rule(p))
&&
- (o = _tmp_33_rule(p), 1)
+ (o = _tmp_42_rule(p), 1)
)
{
res = _Py_withitem ( e , o , p -> arena );
@@ -2920,7 +3105,7 @@ try_stmt_rule(Parser *p)
&&
(b = block_rule(p))
&&
- (ex = _loop1_34_rule(p))
+ (ex = _loop1_43_rule(p))
&&
(el = else_block_rule(p), 1)
&&
@@ -2977,7 +3162,7 @@ except_block_rule(Parser *p)
&&
(e = expression_rule(p))
&&
- (t = _tmp_35_rule(p), 1)
+ (t = _tmp_44_rule(p), 1)
&&
(literal = _PyPegen_expect_token(p, 11))
&&
@@ -3144,7 +3329,7 @@ raise_stmt_rule(Parser *p)
&&
(a = expression_rule(p))
&&
- (b = _tmp_36_rule(p), 1)
+ (b = _tmp_45_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -3235,7 +3420,8 @@ function_def_rule(Parser *p)
return res;
}
-// function_def_raw: ASYNC? 'def' NAME '(' params? ')' ['->' annotation] ':' block
+// function_def_raw:
+// | ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
static stmt_ty
function_def_raw_rule(Parser *p)
{
@@ -3252,7 +3438,7 @@ function_def_raw_rule(Parser *p)
UNUSED(start_lineno); // Only used by EXTRA macro
int start_col_offset = p->tokens[mark]->col_offset;
UNUSED(start_col_offset); // Only used by EXTRA macro
- { // ASYNC? 'def' NAME '(' params? ')' ['->' annotation] ':' block
+ { // ASYNC? 'def' NAME '(' params? ')' ['->' expression] ':' func_type_comment? block
void *a;
asdl_seq* b;
void *is_async;
@@ -3262,6 +3448,7 @@ function_def_raw_rule(Parser *p)
void *literal_2;
expr_ty n;
void *params;
+ void *tc;
if (
(is_async = _PyPegen_expect_token(p, ASYNC), 1)
&&
@@ -3275,10 +3462,12 @@ function_def_raw_rule(Parser *p)
&&
(literal_1 = _PyPegen_expect_token(p, 8))
&&
- (a = _tmp_37_rule(p), 1)
+ (a = _tmp_46_rule(p), 1)
&&
(literal_2 = _PyPegen_expect_token(p, 11))
&&
+ (tc = func_type_comment_rule(p), 1)
+ &&
(b = block_rule(p))
)
{
@@ -3290,7 +3479,44 @@ function_def_raw_rule(Parser *p)
UNUSED(end_lineno); // Only used by EXTRA macro
int end_col_offset = token->end_col_offset;
UNUSED(end_col_offset); // Only used by EXTRA macro
- res = ( is_async ? _Py_AsyncFunctionDef : _Py_FunctionDef ) ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NULL , EXTRA );
+ res = ( is_async ? _Py_AsyncFunctionDef : _Py_FunctionDef ) ( n -> v . Name . id , ( params ) ? params : CHECK ( _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
+// func_type_comment:
+// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
+// | invalid_double_type_comments
+// | TYPE_COMMENT
+static PyObject*
+func_type_comment_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ PyObject* res = NULL;
+ int mark = p->mark;
+ { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
+ void *newline_var;
+ void *t;
+ if (
+ (newline_var = _PyPegen_expect_token(p, NEWLINE))
+ &&
+ (t = _PyPegen_expect_token(p, TYPE_COMMENT))
+ &&
+ _PyPegen_lookahead(1, _tmp_47_rule, p)
+ )
+ {
+ res = t;
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -3299,6 +3525,28 @@ function_def_raw_rule(Parser *p)
}
p->mark = mark;
}
+ { // invalid_double_type_comments
+ void *invalid_double_type_comments_var;
+ if (
+ (invalid_double_type_comments_var = invalid_double_type_comments_rule(p))
+ )
+ {
+ res = invalid_double_type_comments_var;
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // TYPE_COMMENT
+ void *type_comment_var;
+ if (
+ (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
+ )
+ {
+ res = type_comment_var;
+ goto done;
+ }
+ p->mark = mark;
+ }
res = NULL;
done:
return res;
@@ -3341,10 +3589,10 @@ params_rule(Parser *p)
}
// parameters:
-// | slash_without_default [',' plain_names] [',' names_with_default] [',' star_etc?]
-// | slash_with_default [',' names_with_default] [',' star_etc?]
-// | plain_names [',' names_with_default] [',' star_etc?]
-// | names_with_default [',' star_etc?]
+// | slash_no_default param_no_default* param_with_default* star_etc?
+// | slash_with_default param_with_default* star_etc?
+// | param_no_default+ param_with_default* star_etc?
+// | param_with_default+ star_etc?
// | star_etc
static arguments_ty
parameters_rule(Parser *p)
@@ -3354,19 +3602,19 @@ parameters_rule(Parser *p)
}
arguments_ty res = NULL;
int mark = p->mark;
- { // slash_without_default [',' plain_names] [',' names_with_default] [',' star_etc?]
+ { // slash_no_default param_no_default* param_with_default* star_etc?
asdl_seq* a;
- void *b;
- void *c;
+ asdl_seq * b;
+ asdl_seq * c;
void *d;
if (
- (a = slash_without_default_rule(p))
+ (a = slash_no_default_rule(p))
&&
- (b = _tmp_38_rule(p), 1)
+ (b = _loop0_48_rule(p))
&&
- (c = _tmp_39_rule(p), 1)
+ (c = _loop0_49_rule(p))
&&
- (d = _tmp_40_rule(p), 1)
+ (d = star_etc_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
@@ -3378,16 +3626,16 @@ parameters_rule(Parser *p)
}
p->mark = mark;
}
- { // slash_with_default [',' names_with_default] [',' star_etc?]
+ { // slash_with_default param_with_default* star_etc?
SlashWithDefault* a;
- void *b;
+ asdl_seq * b;
void *c;
if (
(a = slash_with_default_rule(p))
&&
- (b = _tmp_41_rule(p), 1)
+ (b = _loop0_50_rule(p))
&&
- (c = _tmp_42_rule(p), 1)
+ (c = star_etc_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
@@ -3399,16 +3647,16 @@ parameters_rule(Parser *p)
}
p->mark = mark;
}
- { // plain_names [',' names_with_default] [',' star_etc?]
- asdl_seq* a;
- void *b;
+ { // param_no_default+ param_with_default* star_etc?
+ asdl_seq * a;
+ asdl_seq * b;
void *c;
if (
- (a = plain_names_rule(p))
+ (a = _loop1_51_rule(p))
&&
- (b = _tmp_43_rule(p), 1)
+ (b = _loop0_52_rule(p))
&&
- (c = _tmp_44_rule(p), 1)
+ (c = star_etc_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
@@ -3420,13 +3668,13 @@ parameters_rule(Parser *p)
}
p->mark = mark;
}
- { // names_with_default [',' star_etc?]
- asdl_seq* a;
+ { // param_with_default+ star_etc?
+ asdl_seq * a;
void *b;
if (
- (a = names_with_default_rule(p))
+ (a = _loop1_53_rule(p))
&&
- (b = _tmp_45_rule(p), 1)
+ (b = star_etc_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
@@ -3458,25 +3706,45 @@ parameters_rule(Parser *p)
return res;
}
-// slash_without_default: plain_names ',' '/'
+// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
static asdl_seq*
-slash_without_default_rule(Parser *p)
+slash_no_default_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq* res = NULL;
int mark = p->mark;
- { // plain_names ',' '/'
- asdl_seq* a;
+ { // param_no_default+ '/' ','
+ asdl_seq * a;
void *literal;
void *literal_1;
if (
- (a = plain_names_rule(p))
+ (a = _loop1_54_rule(p))
&&
- (literal = _PyPegen_expect_token(p, 12))
+ (literal = _PyPegen_expect_token(p, 17))
&&
- (literal_1 = _PyPegen_expect_token(p, 17))
+ (literal_1 = _PyPegen_expect_token(p, 12))
+ )
+ {
+ res = a;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // param_no_default+ '/' &')'
+ asdl_seq * a;
+ void *literal;
+ if (
+ (a = _loop1_55_rule(p))
+ &&
+ (literal = _PyPegen_expect_token(p, 17))
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
)
{
res = a;
@@ -3493,7 +3761,9 @@ slash_without_default_rule(Parser *p)
return res;
}
-// slash_with_default: [plain_names ','] names_with_default ',' '/'
+// slash_with_default:
+// | param_no_default* param_with_default+ '/' ','
+// | param_no_default* param_with_default+ '/' &')'
static SlashWithDefault*
slash_with_default_rule(Parser *p)
{
@@ -3502,19 +3772,42 @@ slash_with_default_rule(Parser *p)
}
SlashWithDefault* res = NULL;
int mark = p->mark;
- { // [plain_names ','] names_with_default ',' '/'
- void *a;
- asdl_seq* b;
+ { // param_no_default* param_with_default+ '/' ','
+ asdl_seq * a;
+ asdl_seq * b;
void *literal;
void *literal_1;
if (
- (a = _tmp_46_rule(p), 1)
+ (a = _loop0_56_rule(p))
&&
- (b = names_with_default_rule(p))
+ (b = _loop1_57_rule(p))
&&
- (literal = _PyPegen_expect_token(p, 12))
+ (literal = _PyPegen_expect_token(p, 17))
&&
- (literal_1 = _PyPegen_expect_token(p, 17))
+ (literal_1 = _PyPegen_expect_token(p, 12))
+ )
+ {
+ res = _PyPegen_slash_with_default ( p , a , b );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // param_no_default* param_with_default+ '/' &')'
+ asdl_seq * a;
+ asdl_seq * b;
+ void *literal;
+ if (
+ (a = _loop0_58_rule(p))
+ &&
+ (b = _loop1_59_rule(p))
+ &&
+ (literal = _PyPegen_expect_token(p, 17))
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
)
{
res = _PyPegen_slash_with_default ( p , a , b );
@@ -3532,9 +3825,9 @@ slash_with_default_rule(Parser *p)
}
// star_etc:
-// | '*' plain_name name_with_optional_default* [',' kwds] ','?
-// | '*' name_with_optional_default+ [',' kwds] ','?
-// | kwds ','?
+// | '*' param_no_default param_maybe_default* kwds?
+// | '*' ',' param_maybe_default+ kwds?
+// | kwds
static StarEtc*
star_etc_rule(Parser *p)
{
@@ -3543,23 +3836,19 @@ star_etc_rule(Parser *p)
}
StarEtc* res = NULL;
int mark = p->mark;
- { // '*' plain_name name_with_optional_default* [',' kwds] ','?
+ { // '*' param_no_default param_maybe_default* kwds?
arg_ty a;
asdl_seq * b;
void *c;
void *literal;
- void *opt_var;
- UNUSED(opt_var); // Silence compiler warnings
if (
(literal = _PyPegen_expect_token(p, 16))
&&
- (a = plain_name_rule(p))
+ (a = param_no_default_rule(p))
&&
- (b = _loop0_47_rule(p))
+ (b = _loop0_60_rule(p))
&&
- (c = _tmp_48_rule(p), 1)
- &&
- (opt_var = _PyPegen_expect_token(p, 12), 1)
+ (c = kwds_rule(p), 1)
)
{
res = _PyPegen_star_etc ( p , a , b , c );
@@ -3571,20 +3860,19 @@ star_etc_rule(Parser *p)
}
p->mark = mark;
}
- { // '*' name_with_optional_default+ [',' kwds] ','?
+ { // '*' ',' param_maybe_default+ kwds?
asdl_seq * b;
void *c;
void *literal;
- void *opt_var;
- UNUSED(opt_var); // Silence compiler warnings
+ void *literal_1;
if (
(literal = _PyPegen_expect_token(p, 16))
&&
- (b = _loop1_49_rule(p))
+ (literal_1 = _PyPegen_expect_token(p, 12))
&&
- (c = _tmp_50_rule(p), 1)
+ (b = _loop1_61_rule(p))
&&
- (opt_var = _PyPegen_expect_token(p, 12), 1)
+ (c = kwds_rule(p), 1)
)
{
res = _PyPegen_star_etc ( p , NULL , b , c );
@@ -3596,14 +3884,10 @@ star_etc_rule(Parser *p)
}
p->mark = mark;
}
- { // kwds ','?
+ { // kwds
arg_ty a;
- void *opt_var;
- UNUSED(opt_var); // Silence compiler warnings
if (
(a = kwds_rule(p))
- &&
- (opt_var = _PyPegen_expect_token(p, 12), 1)
)
{
res = _PyPegen_star_etc ( p , NULL , NULL , a );
@@ -3620,28 +3904,25 @@ star_etc_rule(Parser *p)
return res;
}
-// name_with_optional_default: ',' plain_name ['=' expression]
-static NameDefaultPair*
-name_with_optional_default_rule(Parser *p)
+// kwds: '**' param_no_default
+static arg_ty
+kwds_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- NameDefaultPair* res = NULL;
+ arg_ty res = NULL;
int mark = p->mark;
- { // ',' plain_name ['=' expression]
+ { // '**' param_no_default
arg_ty a;
- void *b;
void *literal;
if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (a = plain_name_rule(p))
+ (literal = _PyPegen_expect_token(p, 35))
&&
- (b = _tmp_51_rule(p), 1)
+ (a = param_no_default_rule(p))
)
{
- res = _PyPegen_name_default_pair ( p , a , b );
+ res = a;
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -3655,22 +3936,48 @@ name_with_optional_default_rule(Parser *p)
return res;
}
-// names_with_default: ','.name_with_default+
-static asdl_seq*
-names_with_default_rule(Parser *p)
+// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
+static arg_ty
+param_no_default_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- asdl_seq* res = NULL;
+ arg_ty res = NULL;
int mark = p->mark;
- { // ','.name_with_default+
- asdl_seq * a;
+ { // param ',' TYPE_COMMENT?
+ arg_ty a;
+ void *literal;
+ void *tc;
if (
- (a = _gather_52_rule(p))
+ (a = param_rule(p))
+ &&
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
)
{
- res = a;
+ res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // param TYPE_COMMENT? &')'
+ arg_ty a;
+ void *tc;
+ if (
+ (a = param_rule(p))
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
+ )
+ {
+ res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -3684,28 +3991,54 @@ names_with_default_rule(Parser *p)
return res;
}
-// name_with_default: plain_name '=' expression
+// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
static NameDefaultPair*
-name_with_default_rule(Parser *p)
+param_with_default_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
NameDefaultPair* res = NULL;
int mark = p->mark;
- { // plain_name '=' expression
- expr_ty e;
+ { // param default ',' TYPE_COMMENT?
+ arg_ty a;
+ expr_ty c;
void *literal;
- arg_ty n;
+ void *tc;
if (
- (n = plain_name_rule(p))
+ (a = param_rule(p))
&&
- (literal = _PyPegen_expect_token(p, 22))
+ (c = default_rule(p))
&&
- (e = expression_rule(p))
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
)
{
- res = _PyPegen_name_default_pair ( p , n , e );
+ res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // param default TYPE_COMMENT? &')'
+ arg_ty a;
+ expr_ty c;
+ void *tc;
+ if (
+ (a = param_rule(p))
+ &&
+ (c = default_rule(p))
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
+ )
+ {
+ res = _PyPegen_name_default_pair ( p , a , c , tc );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -3719,24 +4052,56 @@ name_with_default_rule(Parser *p)
return res;
}
-// plain_names: ','.(plain_name !'=')+
-static asdl_seq*
-plain_names_rule(Parser *p)
+// param_maybe_default:
+// | param default? ',' TYPE_COMMENT?
+// | param default? TYPE_COMMENT? &')'
+static NameDefaultPair*
+param_maybe_default_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- asdl_seq* res = NULL;
- if (_PyPegen_is_memoized(p, plain_names_type, &res))
- return res;
+ NameDefaultPair* res = NULL;
int mark = p->mark;
- { // ','.(plain_name !'=')+
- asdl_seq * a;
+ { // param default? ',' TYPE_COMMENT?
+ arg_ty a;
+ void *c;
+ void *literal;
+ void *tc;
if (
- (a = _gather_54_rule(p))
+ (a = param_rule(p))
+ &&
+ (c = default_rule(p), 1)
+ &&
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
)
{
- res = a;
+ res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ { // param default? TYPE_COMMENT? &')'
+ arg_ty a;
+ void *c;
+ void *tc;
+ if (
+ (a = param_rule(p))
+ &&
+ (c = default_rule(p), 1)
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1)
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8)
+ )
+ {
+ res = _PyPegen_name_default_pair ( p , a , c , tc );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -3747,13 +4112,12 @@ plain_names_rule(Parser *p)
}
res = NULL;
done:
- _PyPegen_insert_memo(p, mark, plain_names_type, res);
return res;
}
-// plain_name: NAME [':' annotation]
+// param: NAME annotation?
static arg_ty
-plain_name_rule(Parser *p)
+param_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -3768,13 +4132,13 @@ plain_name_rule(Parser *p)
UNUSED(start_lineno); // Only used by EXTRA macro
int start_col_offset = p->tokens[mark]->col_offset;
UNUSED(start_col_offset); // Only used by EXTRA macro
- { // NAME [':' annotation]
+ { // NAME annotation?
expr_ty a;
void *b;
if (
(a = _PyPegen_name_token(p))
&&
- (b = _tmp_56_rule(p), 1)
+ (b = annotation_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -3799,22 +4163,22 @@ plain_name_rule(Parser *p)
return res;
}
-// kwds: '**' plain_name
-static arg_ty
-kwds_rule(Parser *p)
+// annotation: ':' expression
+static expr_ty
+annotation_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- arg_ty res = NULL;
+ expr_ty res = NULL;
int mark = p->mark;
- { // '**' plain_name
- arg_ty a;
+ { // ':' expression
+ expr_ty a;
void *literal;
if (
- (literal = _PyPegen_expect_token(p, 35))
+ (literal = _PyPegen_expect_token(p, 11))
&&
- (a = plain_name_rule(p))
+ (a = expression_rule(p))
)
{
res = a;
@@ -3831,22 +4195,29 @@ kwds_rule(Parser *p)
return res;
}
-// annotation: expression
+// default: '=' expression
static expr_ty
-annotation_rule(Parser *p)
+default_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
expr_ty res = NULL;
int mark = p->mark;
- { // expression
- expr_ty expression_var;
+ { // '=' expression
+ expr_ty a;
+ void *literal;
if (
- (expression_var = expression_rule(p))
+ (literal = _PyPegen_expect_token(p, 22))
+ &&
+ (a = expression_rule(p))
)
{
- res = expression_var;
+ res = a;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
goto done;
}
p->mark = mark;
@@ -3868,7 +4239,7 @@ decorators_rule(Parser *p)
{ // (('@' named_expression NEWLINE))+
asdl_seq * a;
if (
- (a = _loop1_57_rule(p))
+ (a = _loop1_62_rule(p))
)
{
res = a;
@@ -3956,7 +4327,7 @@ class_def_raw_rule(Parser *p)
&&
(a = _PyPegen_name_token(p))
&&
- (b = _tmp_58_rule(p), 1)
+ (b = _tmp_63_rule(p), 1)
&&
(literal = _PyPegen_expect_token(p, 11))
&&
@@ -4062,7 +4433,7 @@ expressions_list_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_59_rule(p))
+ (a = _gather_64_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4109,7 +4480,7 @@ star_expressions_rule(Parser *p)
if (
(a = star_expression_rule(p))
&&
- (b = _loop1_61_rule(p))
+ (b = _loop1_66_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4249,7 +4620,7 @@ star_named_expressions_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_62_rule(p))
+ (a = _gather_67_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4463,7 +4834,7 @@ expressions_rule(Parser *p)
if (
(a = expression_rule(p))
&&
- (b = _loop1_64_rule(p))
+ (b = _loop1_69_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4685,11 +5056,11 @@ lambda_parameters_rule(Parser *p)
if (
(a = lambda_slash_without_default_rule(p))
&&
- (b = _tmp_65_rule(p), 1)
+ (b = _tmp_70_rule(p), 1)
&&
- (c = _tmp_66_rule(p), 1)
+ (c = _tmp_71_rule(p), 1)
&&
- (d = _tmp_67_rule(p), 1)
+ (d = _tmp_72_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
@@ -4708,9 +5079,9 @@ lambda_parameters_rule(Parser *p)
if (
(a = lambda_slash_with_default_rule(p))
&&
- (b = _tmp_68_rule(p), 1)
+ (b = _tmp_73_rule(p), 1)
&&
- (c = _tmp_69_rule(p), 1)
+ (c = _tmp_74_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
@@ -4729,9 +5100,9 @@ lambda_parameters_rule(Parser *p)
if (
(a = lambda_plain_names_rule(p))
&&
- (b = _tmp_70_rule(p), 1)
+ (b = _tmp_75_rule(p), 1)
&&
- (c = _tmp_71_rule(p), 1)
+ (c = _tmp_76_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
@@ -4749,7 +5120,7 @@ lambda_parameters_rule(Parser *p)
if (
(a = lambda_names_with_default_rule(p))
&&
- (b = _tmp_72_rule(p), 1)
+ (b = _tmp_77_rule(p), 1)
)
{
res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
@@ -4831,7 +5202,7 @@ lambda_slash_with_default_rule(Parser *p)
void *literal;
void *literal_1;
if (
- (a = _tmp_73_rule(p), 1)
+ (a = _tmp_78_rule(p), 1)
&&
(b = lambda_names_with_default_rule(p))
&&
@@ -4878,9 +5249,9 @@ lambda_star_etc_rule(Parser *p)
&&
(a = lambda_plain_name_rule(p))
&&
- (b = _loop0_74_rule(p))
+ (b = _loop0_79_rule(p))
&&
- (c = _tmp_75_rule(p), 1)
+ (c = _tmp_80_rule(p), 1)
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4903,9 +5274,9 @@ lambda_star_etc_rule(Parser *p)
if (
(literal = _PyPegen_expect_token(p, 16))
&&
- (b = _loop1_76_rule(p))
+ (b = _loop1_81_rule(p))
&&
- (c = _tmp_77_rule(p), 1)
+ (c = _tmp_82_rule(p), 1)
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -4961,10 +5332,10 @@ lambda_name_with_optional_default_rule(Parser *p)
&&
(a = lambda_plain_name_rule(p))
&&
- (b = _tmp_78_rule(p), 1)
+ (b = _tmp_83_rule(p), 1)
)
{
- res = _PyPegen_name_default_pair ( p , a , b );
+ res = _PyPegen_name_default_pair ( p , a , b , NULL );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -4990,7 +5361,7 @@ lambda_names_with_default_rule(Parser *p)
{ // ','.lambda_name_with_default+
asdl_seq * a;
if (
- (a = _gather_79_rule(p))
+ (a = _gather_84_rule(p))
)
{
res = a;
@@ -5028,7 +5399,7 @@ lambda_name_with_default_rule(Parser *p)
(e = expression_rule(p))
)
{
- res = _PyPegen_name_default_pair ( p , n , e );
+ res = _PyPegen_name_default_pair ( p , n , e , NULL );
if (res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
return NULL;
@@ -5054,7 +5425,7 @@ lambda_plain_names_rule(Parser *p)
{ // ','.(lambda_plain_name !'=')+
asdl_seq * a;
if (
- (a = _gather_81_rule(p))
+ (a = _gather_86_rule(p))
)
{
res = a;
@@ -5173,7 +5544,7 @@ disjunction_rule(Parser *p)
if (
(a = conjunction_rule(p))
&&
- (b = _loop1_83_rule(p))
+ (b = _loop1_88_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -5235,7 +5606,7 @@ conjunction_rule(Parser *p)
if (
(a = inversion_rule(p))
&&
- (b = _loop1_84_rule(p))
+ (b = _loop1_89_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -5357,7 +5728,7 @@ comparison_rule(Parser *p)
if (
(a = bitwise_or_rule(p))
&&
- (b = _loop1_85_rule(p))
+ (b = _loop1_90_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -5569,10 +5940,10 @@ noteq_bitwise_or_rule(Parser *p)
CmpopExprPair* res = NULL;
int mark = p->mark;
{ // ('!=') bitwise_or
- void *_tmp_86_var;
+ void *_tmp_91_var;
expr_ty a;
if (
- (_tmp_86_var = _tmp_86_rule(p))
+ (_tmp_91_var = _tmp_91_rule(p))
&&
(a = bitwise_or_rule(p))
)
@@ -7014,7 +7385,7 @@ slices_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_87_rule(p))
+ (a = _gather_92_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -7070,7 +7441,7 @@ slice_rule(Parser *p)
&&
(b = expression_rule(p), 1)
&&
- (c = _tmp_89_rule(p), 1)
+ (c = _tmp_94_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -7258,40 +7629,40 @@ atom_rule(Parser *p)
p->mark = mark;
}
{ // &'(' (tuple | group | genexp)
- void *_tmp_90_var;
+ void *_tmp_95_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7)
&&
- (_tmp_90_var = _tmp_90_rule(p))
+ (_tmp_95_var = _tmp_95_rule(p))
)
{
- res = _tmp_90_var;
+ res = _tmp_95_var;
goto done;
}
p->mark = mark;
}
{ // &'[' (list | listcomp)
- void *_tmp_91_var;
+ void *_tmp_96_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9)
&&
- (_tmp_91_var = _tmp_91_rule(p))
+ (_tmp_96_var = _tmp_96_rule(p))
)
{
- res = _tmp_91_var;
+ res = _tmp_96_var;
goto done;
}
p->mark = mark;
}
{ // &'{' (dict | set | dictcomp | setcomp)
- void *_tmp_92_var;
+ void *_tmp_97_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25)
&&
- (_tmp_92_var = _tmp_92_rule(p))
+ (_tmp_97_var = _tmp_97_rule(p))
)
{
- res = _tmp_92_var;
+ res = _tmp_97_var;
goto done;
}
p->mark = mark;
@@ -7338,7 +7709,7 @@ strings_rule(Parser *p)
{ // STRING+
asdl_seq * a;
if (
- (a = _loop1_93_rule(p))
+ (a = _loop1_98_rule(p))
)
{
res = _PyPegen_concatenate_strings ( p , a );
@@ -7496,7 +7867,7 @@ tuple_rule(Parser *p)
if (
(literal = _PyPegen_expect_token(p, 7))
&&
- (a = _tmp_94_rule(p), 1)
+ (a = _tmp_99_rule(p), 1)
&&
(literal_1 = _PyPegen_expect_token(p, 8))
)
@@ -7539,7 +7910,7 @@ group_rule(Parser *p)
if (
(literal = _PyPegen_expect_token(p, 7))
&&
- (a = _tmp_95_rule(p))
+ (a = _tmp_100_rule(p))
&&
(literal_1 = _PyPegen_expect_token(p, 8))
)
@@ -7858,7 +8229,7 @@ kvpairs_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_96_rule(p))
+ (a = _gather_101_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -7942,7 +8313,7 @@ for_if_clauses_rule(Parser *p)
{ // ((ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*))+
asdl_seq * a;
if (
- (a = _loop1_98_rule(p))
+ (a = _loop1_103_rule(p))
)
{
res = a;
@@ -8108,7 +8479,7 @@ args_rule(Parser *p)
if (
(a = starred_expression_rule(p))
&&
- (b = _tmp_99_rule(p), 1)
+ (b = _tmp_104_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -8157,7 +8528,7 @@ args_rule(Parser *p)
if (
(a = named_expression_rule(p))
&&
- (b = _tmp_100_rule(p), 1)
+ (b = _tmp_105_rule(p), 1)
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -8199,11 +8570,11 @@ kwargs_rule(Parser *p)
asdl_seq * b;
void *literal;
if (
- (a = _gather_101_rule(p))
+ (a = _gather_106_rule(p))
&&
(literal = _PyPegen_expect_token(p, 12))
&&
- (b = _gather_103_rule(p))
+ (b = _gather_108_rule(p))
)
{
res = _PyPegen_join_sequences ( p , a , b );
@@ -8216,23 +8587,23 @@ kwargs_rule(Parser *p)
p->mark = mark;
}
{ // ','.kwarg_or_starred+
- asdl_seq * _gather_105_var;
+ asdl_seq * _gather_110_var;
if (
- (_gather_105_var = _gather_105_rule(p))
+ (_gather_110_var = _gather_110_rule(p))
)
{
- res = _gather_105_var;
+ res = _gather_110_var;
goto done;
}
p->mark = mark;
}
{ // ','.kwarg_or_double_starred+
- asdl_seq * _gather_107_var;
+ asdl_seq * _gather_112_var;
if (
- (_gather_107_var = _gather_107_rule(p))
+ (_gather_112_var = _gather_112_rule(p))
)
{
- res = _gather_107_var;
+ res = _gather_112_var;
goto done;
}
p->mark = mark;
@@ -8475,7 +8846,7 @@ star_targets_rule(Parser *p)
if (
(a = star_target_rule(p))
&&
- (b = _loop0_109_rule(p))
+ (b = _loop0_114_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -8516,7 +8887,7 @@ star_targets_seq_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_110_rule(p))
+ (a = _gather_115_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -8564,7 +8935,7 @@ star_target_rule(Parser *p)
if (
(literal = _PyPegen_expect_token(p, 16))
&&
- (a = _tmp_112_rule(p))
+ (a = _tmp_117_rule(p))
)
{
Token *token = _PyPegen_get_last_nonnwhitespace_token(p);
@@ -8953,7 +9324,7 @@ del_targets_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_113_rule(p))
+ (a = _gather_118_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -9206,7 +9577,7 @@ targets_rule(Parser *p)
void *opt_var;
UNUSED(opt_var); // Silence compiler warnings
if (
- (a = _gather_115_rule(p))
+ (a = _gather_120_rule(p))
&&
(opt_var = _PyPegen_expect_token(p, 12), 1)
)
@@ -9734,7 +10105,7 @@ incorrect_arguments_rule(Parser *p)
&&
(literal = _PyPegen_expect_token(p, 12))
&&
- (opt_var = _tmp_117_rule(p), 1)
+ (opt_var = _tmp_122_rule(p), 1)
)
{
res = RAISE_SYNTAX_ERROR ( "Generator expression must be parenthesized" );
@@ -9869,7 +10240,7 @@ invalid_assignment_rule(Parser *p)
&&
(expression_var_1 = expression_rule(p))
&&
- (opt_var = _tmp_118_rule(p), 1)
+ (opt_var = _tmp_123_rule(p), 1)
)
{
res = RAISE_SYNTAX_ERROR ( "illegal target for annotation" );
@@ -9882,15 +10253,15 @@ invalid_assignment_rule(Parser *p)
p->mark = mark;
}
{ // expression ('=' | augassign) (yield_expr | star_expressions)
- void *_tmp_119_var;
- void *_tmp_120_var;
+ void *_tmp_124_var;
+ void *_tmp_125_var;
expr_ty a;
if (
(a = expression_rule(p))
&&
- (_tmp_119_var = _tmp_119_rule(p))
+ (_tmp_124_var = _tmp_124_rule(p))
&&
- (_tmp_120_var = _tmp_120_rule(p))
+ (_tmp_125_var = _tmp_125_rule(p))
)
{
res = RAISE_SYNTAX_ERROR ( "cannot assign to %s" , _PyPegen_get_expr_name ( a ) );
@@ -9948,12 +10319,12 @@ invalid_comprehension_rule(Parser *p)
void * res = NULL;
int mark = p->mark;
{ // ('[' | '(' | '{') '*' expression for_if_clauses
- void *_tmp_121_var;
+ void *_tmp_126_var;
expr_ty expression_var;
asdl_seq* for_if_clauses_var;
void *literal;
if (
- (_tmp_121_var = _tmp_121_rule(p))
+ (_tmp_126_var = _tmp_126_rule(p))
&&
(literal = _PyPegen_expect_token(p, 16))
&&
@@ -9977,7 +10348,7 @@ invalid_comprehension_rule(Parser *p)
}
// invalid_parameters:
-// | [plain_names ','] (slash_with_default | names_with_default) ',' plain_names
+// | param_no_default* (slash_with_default | param_with_default+) param_no_default
static void *
invalid_parameters_rule(Parser *p)
{
@@ -9986,20 +10357,16 @@ invalid_parameters_rule(Parser *p)
}
void * res = NULL;
int mark = p->mark;
- { // [plain_names ','] (slash_with_default | names_with_default) ',' plain_names
- void *_tmp_123_var;
- void *literal;
- void *opt_var;
- UNUSED(opt_var); // Silence compiler warnings
- asdl_seq* plain_names_var;
+ { // param_no_default* (slash_with_default | param_with_default+) param_no_default
+ asdl_seq * _loop0_127_var;
+ void *_tmp_128_var;
+ arg_ty param_no_default_var;
if (
- (opt_var = _tmp_122_rule(p), 1)
- &&
- (_tmp_123_var = _tmp_123_rule(p))
+ (_loop0_127_var = _loop0_127_rule(p))
&&
- (literal = _PyPegen_expect_token(p, 12))
+ (_tmp_128_var = _tmp_128_rule(p))
&&
- (plain_names_var = plain_names_rule(p))
+ (param_no_default_var = param_no_default_rule(p))
)
{
res = RAISE_SYNTAX_ERROR ( "non-default argument follows default argument" );
@@ -10016,6 +10383,47 @@ invalid_parameters_rule(Parser *p)
return res;
}
+// invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
+static void *
+invalid_double_type_comments_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void * res = NULL;
+ int mark = p->mark;
+ { // TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
+ void *indent_var;
+ void *newline_var;
+ void *newline_var_1;
+ void *type_comment_var;
+ void *type_comment_var_1;
+ if (
+ (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT))
+ &&
+ (newline_var = _PyPegen_expect_token(p, NEWLINE))
+ &&
+ (type_comment_var_1 = _PyPegen_expect_token(p, TYPE_COMMENT))
+ &&
+ (newline_var_1 = _PyPegen_expect_token(p, NEWLINE))
+ &&
+ (indent_var = _PyPegen_expect_token(p, INDENT))
+ )
+ {
+ res = RAISE_SYNTAX_ERROR ( "Cannot have two type comments on def" );
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
// _loop0_1: NEWLINE
static asdl_seq *
_loop0_1_rule(Parser *p)
@@ -10065,9 +10473,398 @@ _loop0_1_rule(Parser *p)
return seq;
}
-// _loop1_2: statement
+// _loop0_2: NEWLINE
+static asdl_seq *
+_loop0_2_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // NEWLINE
+ void *newline_var;
+ while (
+ (newline_var = _PyPegen_expect_token(p, NEWLINE))
+ )
+ {
+ res = newline_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_2");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_2_type, seq);
+ return seq;
+}
+
+// _loop0_4: ',' expression
+static asdl_seq *
+_loop0_4_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // ',' expression
+ expr_ty elem;
+ void *literal;
+ while (
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (elem = expression_rule(p))
+ )
+ {
+ res = elem;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(children);
+ return NULL;
+ }
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
+ return seq;
+}
+
+// _gather_3: expression _loop0_4
+static asdl_seq *
+_gather_3_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ asdl_seq * res = NULL;
+ int mark = p->mark;
+ { // expression _loop0_4
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = expression_rule(p))
+ &&
+ (seq = _loop0_4_rule(p))
+ )
+ {
+ res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
+// _loop0_6: ',' expression
static asdl_seq *
-_loop1_2_rule(Parser *p)
+_loop0_6_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // ',' expression
+ expr_ty elem;
+ void *literal;
+ while (
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (elem = expression_rule(p))
+ )
+ {
+ res = elem;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(children);
+ return NULL;
+ }
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_6");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_6_type, seq);
+ return seq;
+}
+
+// _gather_5: expression _loop0_6
+static asdl_seq *
+_gather_5_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ asdl_seq * res = NULL;
+ int mark = p->mark;
+ { // expression _loop0_6
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = expression_rule(p))
+ &&
+ (seq = _loop0_6_rule(p))
+ )
+ {
+ res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
+// _loop0_8: ',' expression
+static asdl_seq *
+_loop0_8_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // ',' expression
+ expr_ty elem;
+ void *literal;
+ while (
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (elem = expression_rule(p))
+ )
+ {
+ res = elem;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(children);
+ return NULL;
+ }
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_8");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_8_type, seq);
+ return seq;
+}
+
+// _gather_7: expression _loop0_8
+static asdl_seq *
+_gather_7_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ asdl_seq * res = NULL;
+ int mark = p->mark;
+ { // expression _loop0_8
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = expression_rule(p))
+ &&
+ (seq = _loop0_8_rule(p))
+ )
+ {
+ res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
+// _loop0_10: ',' expression
+static asdl_seq *
+_loop0_10_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // ',' expression
+ expr_ty elem;
+ void *literal;
+ while (
+ (literal = _PyPegen_expect_token(p, 12))
+ &&
+ (elem = expression_rule(p))
+ )
+ {
+ res = elem;
+ if (res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(children);
+ return NULL;
+ }
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_10");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_10_type, seq);
+ return seq;
+}
+
+// _gather_9: expression _loop0_10
+static asdl_seq *
+_gather_9_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ asdl_seq * res = NULL;
+ int mark = p->mark;
+ { // expression _loop0_10
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = expression_rule(p))
+ &&
+ (seq = _loop0_10_rule(p))
+ )
+ {
+ res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = mark;
+ }
+ res = NULL;
+ done:
+ return res;
+}
+
+// _loop1_11: statement
+static asdl_seq *
+_loop1_11_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10108,19 +10905,19 @@ _loop1_2_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_2");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_11");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_2_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_11_type, seq);
return seq;
}
-// _loop0_4: ';' small_stmt
+// _loop0_13: ';' small_stmt
static asdl_seq *
-_loop0_4_rule(Parser *p)
+_loop0_13_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10165,32 +10962,32 @@ _loop0_4_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_4");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_13");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_4_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_13_type, seq);
return seq;
}
-// _gather_3: small_stmt _loop0_4
+// _gather_12: small_stmt _loop0_13
static asdl_seq *
-_gather_3_rule(Parser *p)
+_gather_12_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // small_stmt _loop0_4
+ { // small_stmt _loop0_13
stmt_ty elem;
asdl_seq * seq;
if (
(elem = small_stmt_rule(p))
&&
- (seq = _loop0_4_rule(p))
+ (seq = _loop0_13_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -10203,9 +11000,9 @@ _gather_3_rule(Parser *p)
return res;
}
-// _tmp_5: 'import' | 'from'
+// _tmp_14: 'import' | 'from'
static void *
-_tmp_5_rule(Parser *p)
+_tmp_14_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10239,9 +11036,9 @@ _tmp_5_rule(Parser *p)
return res;
}
-// _tmp_6: 'def' | '@' | ASYNC
+// _tmp_15: 'def' | '@' | ASYNC
static void *
-_tmp_6_rule(Parser *p)
+_tmp_15_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10286,9 +11083,9 @@ _tmp_6_rule(Parser *p)
return res;
}
-// _tmp_7: 'class' | '@'
+// _tmp_16: 'class' | '@'
static void *
-_tmp_7_rule(Parser *p)
+_tmp_16_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10322,9 +11119,9 @@ _tmp_7_rule(Parser *p)
return res;
}
-// _tmp_8: 'with' | ASYNC
+// _tmp_17: 'with' | ASYNC
static void *
-_tmp_8_rule(Parser *p)
+_tmp_17_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10358,9 +11155,9 @@ _tmp_8_rule(Parser *p)
return res;
}
-// _tmp_9: 'for' | ASYNC
+// _tmp_18: 'for' | ASYNC
static void *
-_tmp_9_rule(Parser *p)
+_tmp_18_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10394,9 +11191,9 @@ _tmp_9_rule(Parser *p)
return res;
}
-// _tmp_10: '=' annotated_rhs
+// _tmp_19: '=' annotated_rhs
static void *
-_tmp_10_rule(Parser *p)
+_tmp_19_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10426,9 +11223,9 @@ _tmp_10_rule(Parser *p)
return res;
}
-// _tmp_11: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
+// _tmp_20: '(' inside_paren_ann_assign_target ')' | ann_assign_subscript_attribute_target
static void *
-_tmp_11_rule(Parser *p)
+_tmp_20_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10472,9 +11269,9 @@ _tmp_11_rule(Parser *p)
return res;
}
-// _tmp_12: '=' annotated_rhs
+// _tmp_21: '=' annotated_rhs
static void *
-_tmp_12_rule(Parser *p)
+_tmp_21_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10504,9 +11301,9 @@ _tmp_12_rule(Parser *p)
return res;
}
-// _loop1_13: (star_targets '=')
+// _loop1_22: (star_targets '=')
static asdl_seq *
-_loop1_13_rule(Parser *p)
+_loop1_22_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10522,12 +11319,12 @@ _loop1_13_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // (star_targets '=')
- void *_tmp_124_var;
+ void *_tmp_129_var;
while (
- (_tmp_124_var = _tmp_124_rule(p))
+ (_tmp_129_var = _tmp_129_rule(p))
)
{
- res = _tmp_124_var;
+ res = _tmp_129_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -10547,19 +11344,19 @@ _loop1_13_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_13");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_13_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
return seq;
}
-// _tmp_14: yield_expr | star_expressions
+// _tmp_23: yield_expr | star_expressions
static void *
-_tmp_14_rule(Parser *p)
+_tmp_23_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10593,9 +11390,9 @@ _tmp_14_rule(Parser *p)
return res;
}
-// _tmp_15: yield_expr | star_expressions
+// _tmp_24: yield_expr | star_expressions
static void *
-_tmp_15_rule(Parser *p)
+_tmp_24_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10629,9 +11426,9 @@ _tmp_15_rule(Parser *p)
return res;
}
-// _loop0_17: ',' NAME
+// _loop0_26: ',' NAME
static asdl_seq *
-_loop0_17_rule(Parser *p)
+_loop0_26_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10676,32 +11473,32 @@ _loop0_17_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_17");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_26");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_17_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_26_type, seq);
return seq;
}
-// _gather_16: NAME _loop0_17
+// _gather_25: NAME _loop0_26
static asdl_seq *
-_gather_16_rule(Parser *p)
+_gather_25_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // NAME _loop0_17
+ { // NAME _loop0_26
expr_ty elem;
asdl_seq * seq;
if (
(elem = _PyPegen_name_token(p))
&&
- (seq = _loop0_17_rule(p))
+ (seq = _loop0_26_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -10714,9 +11511,9 @@ _gather_16_rule(Parser *p)
return res;
}
-// _loop0_19: ',' NAME
+// _loop0_28: ',' NAME
static asdl_seq *
-_loop0_19_rule(Parser *p)
+_loop0_28_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10761,32 +11558,32 @@ _loop0_19_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_19");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_28");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_19_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_28_type, seq);
return seq;
}
-// _gather_18: NAME _loop0_19
+// _gather_27: NAME _loop0_28
static asdl_seq *
-_gather_18_rule(Parser *p)
+_gather_27_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // NAME _loop0_19
+ { // NAME _loop0_28
expr_ty elem;
asdl_seq * seq;
if (
(elem = _PyPegen_name_token(p))
&&
- (seq = _loop0_19_rule(p))
+ (seq = _loop0_28_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -10799,9 +11596,9 @@ _gather_18_rule(Parser *p)
return res;
}
-// _tmp_20: ',' expression
+// _tmp_29: ',' expression
static void *
-_tmp_20_rule(Parser *p)
+_tmp_29_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10831,9 +11628,9 @@ _tmp_20_rule(Parser *p)
return res;
}
-// _loop0_21: ('.' | '...')
+// _loop0_30: ('.' | '...')
static asdl_seq *
-_loop0_21_rule(Parser *p)
+_loop0_30_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10849,12 +11646,12 @@ _loop0_21_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('.' | '...')
- void *_tmp_125_var;
+ void *_tmp_130_var;
while (
- (_tmp_125_var = _tmp_125_rule(p))
+ (_tmp_130_var = _tmp_130_rule(p))
)
{
- res = _tmp_125_var;
+ res = _tmp_130_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -10870,19 +11667,19 @@ _loop0_21_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_21");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_21_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
return seq;
}
-// _loop1_22: ('.' | '...')
+// _loop1_31: ('.' | '...')
static asdl_seq *
-_loop1_22_rule(Parser *p)
+_loop1_31_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10898,12 +11695,12 @@ _loop1_22_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('.' | '...')
- void *_tmp_126_var;
+ void *_tmp_131_var;
while (
- (_tmp_126_var = _tmp_126_rule(p))
+ (_tmp_131_var = _tmp_131_rule(p))
)
{
- res = _tmp_126_var;
+ res = _tmp_131_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -10923,19 +11720,19 @@ _loop1_22_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_22");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_31");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_22_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_31_type, seq);
return seq;
}
-// _loop0_24: ',' import_from_as_name
+// _loop0_33: ',' import_from_as_name
static asdl_seq *
-_loop0_24_rule(Parser *p)
+_loop0_33_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -10980,32 +11777,32 @@ _loop0_24_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_24");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_33");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_24_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_33_type, seq);
return seq;
}
-// _gather_23: import_from_as_name _loop0_24
+// _gather_32: import_from_as_name _loop0_33
static asdl_seq *
-_gather_23_rule(Parser *p)
+_gather_32_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // import_from_as_name _loop0_24
+ { // import_from_as_name _loop0_33
alias_ty elem;
asdl_seq * seq;
if (
(elem = import_from_as_name_rule(p))
&&
- (seq = _loop0_24_rule(p))
+ (seq = _loop0_33_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -11018,9 +11815,9 @@ _gather_23_rule(Parser *p)
return res;
}
-// _tmp_25: 'as' NAME
+// _tmp_34: 'as' NAME
static void *
-_tmp_25_rule(Parser *p)
+_tmp_34_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11050,9 +11847,9 @@ _tmp_25_rule(Parser *p)
return res;
}
-// _loop0_27: ',' dotted_as_name
+// _loop0_36: ',' dotted_as_name
static asdl_seq *
-_loop0_27_rule(Parser *p)
+_loop0_36_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11097,32 +11894,32 @@ _loop0_27_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_27");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_36");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_27_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_36_type, seq);
return seq;
}
-// _gather_26: dotted_as_name _loop0_27
+// _gather_35: dotted_as_name _loop0_36
static asdl_seq *
-_gather_26_rule(Parser *p)
+_gather_35_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // dotted_as_name _loop0_27
+ { // dotted_as_name _loop0_36
alias_ty elem;
asdl_seq * seq;
if (
(elem = dotted_as_name_rule(p))
&&
- (seq = _loop0_27_rule(p))
+ (seq = _loop0_36_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -11135,9 +11932,9 @@ _gather_26_rule(Parser *p)
return res;
}
-// _tmp_28: 'as' NAME
+// _tmp_37: 'as' NAME
static void *
-_tmp_28_rule(Parser *p)
+_tmp_37_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11167,9 +11964,9 @@ _tmp_28_rule(Parser *p)
return res;
}
-// _loop0_30: ',' with_item
+// _loop0_39: ',' with_item
static asdl_seq *
-_loop0_30_rule(Parser *p)
+_loop0_39_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11214,32 +12011,32 @@ _loop0_30_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_30");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_39");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_30_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_39_type, seq);
return seq;
}
-// _gather_29: with_item _loop0_30
+// _gather_38: with_item _loop0_39
static asdl_seq *
-_gather_29_rule(Parser *p)
+_gather_38_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // with_item _loop0_30
+ { // with_item _loop0_39
withitem_ty elem;
asdl_seq * seq;
if (
(elem = with_item_rule(p))
&&
- (seq = _loop0_30_rule(p))
+ (seq = _loop0_39_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -11252,9 +12049,9 @@ _gather_29_rule(Parser *p)
return res;
}
-// _loop0_32: ',' with_item
+// _loop0_41: ',' with_item
static asdl_seq *
-_loop0_32_rule(Parser *p)
+_loop0_41_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11299,32 +12096,32 @@ _loop0_32_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_32");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_41");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_32_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_41_type, seq);
return seq;
}
-// _gather_31: with_item _loop0_32
+// _gather_40: with_item _loop0_41
static asdl_seq *
-_gather_31_rule(Parser *p)
+_gather_40_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // with_item _loop0_32
+ { // with_item _loop0_41
withitem_ty elem;
asdl_seq * seq;
if (
(elem = with_item_rule(p))
&&
- (seq = _loop0_32_rule(p))
+ (seq = _loop0_41_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -11337,9 +12134,9 @@ _gather_31_rule(Parser *p)
return res;
}
-// _tmp_33: 'as' target
+// _tmp_42: 'as' target
static void *
-_tmp_33_rule(Parser *p)
+_tmp_42_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11369,9 +12166,9 @@ _tmp_33_rule(Parser *p)
return res;
}
-// _loop1_34: except_block
+// _loop1_43: except_block
static asdl_seq *
-_loop1_34_rule(Parser *p)
+_loop1_43_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11412,19 +12209,19 @@ _loop1_34_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_34");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_43");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_34_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_43_type, seq);
return seq;
}
-// _tmp_35: 'as' target
+// _tmp_44: 'as' target
static void *
-_tmp_35_rule(Parser *p)
+_tmp_44_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11454,9 +12251,9 @@ _tmp_35_rule(Parser *p)
return res;
}
-// _tmp_36: 'from' expression
+// _tmp_45: 'from' expression
static void *
-_tmp_36_rule(Parser *p)
+_tmp_45_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11486,22 +12283,22 @@ _tmp_36_rule(Parser *p)
return res;
}
-// _tmp_37: '->' annotation
+// _tmp_46: '->' expression
static void *
-_tmp_37_rule(Parser *p)
+_tmp_46_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
void * res = NULL;
int mark = p->mark;
- { // '->' annotation
+ { // '->' expression
void *literal;
expr_ty z;
if (
(literal = _PyPegen_expect_token(p, 51))
&&
- (z = annotation_rule(p))
+ (z = expression_rule(p))
)
{
res = z;
@@ -11518,29 +12315,25 @@ _tmp_37_rule(Parser *p)
return res;
}
-// _tmp_38: ',' plain_names
+// _tmp_47: NEWLINE INDENT
static void *
-_tmp_38_rule(Parser *p)
+_tmp_47_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
void * res = NULL;
int mark = p->mark;
- { // ',' plain_names
- void *literal;
- asdl_seq* x;
+ { // NEWLINE INDENT
+ void *indent_var;
+ void *newline_var;
if (
- (literal = _PyPegen_expect_token(p, 12))
+ (newline_var = _PyPegen_expect_token(p, NEWLINE))
&&
- (x = plain_names_rule(p))
+ (indent_var = _PyPegen_expect_token(p, INDENT))
)
{
- res = x;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
- }
+ res = _PyPegen_dummy_name(p, newline_var, indent_var);
goto done;
}
p->mark = mark;
@@ -11550,265 +12343,258 @@ _tmp_38_rule(Parser *p)
return res;
}
-// _tmp_39: ',' names_with_default
-static void *
-_tmp_39_rule(Parser *p)
+// _loop0_48: param_no_default
+static asdl_seq *
+_loop0_48_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' names_with_default
- void *literal;
- asdl_seq* y;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (y = names_with_default_rule(p))
- )
- {
- res = y;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
- }
- goto done;
- }
- p->mark = mark;
- }
- res = NULL;
- done:
- return res;
-}
-
-// _tmp_40: ',' star_etc?
-static void *
-_tmp_40_rule(Parser *p)
-{
- if (p->error_indicator) {
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
return NULL;
}
- void * res = NULL;
- int mark = p->mark;
- { // ',' star_etc?
- void *literal;
- void *z;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (z = star_etc_rule(p), 1)
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_no_default
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = z;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_no_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
-}
-
-// _tmp_41: ',' names_with_default
-static void *
-_tmp_41_rule(Parser *p)
-{
- if (p->error_indicator) {
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_48");
+ PyMem_Free(children);
return NULL;
}
- void * res = NULL;
- int mark = p->mark;
- { // ',' names_with_default
- void *literal;
- asdl_seq* y;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (y = names_with_default_rule(p))
- )
- {
- res = y;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
- }
- goto done;
- }
- p->mark = mark;
- }
- res = NULL;
- done:
- return res;
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_48_type, seq);
+ return seq;
}
-// _tmp_42: ',' star_etc?
-static void *
-_tmp_42_rule(Parser *p)
+// _loop0_49: param_with_default
+static asdl_seq *
+_loop0_49_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' star_etc?
- void *literal;
- void *z;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (z = star_etc_rule(p), 1)
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = z;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_49");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_49_type, seq);
+ return seq;
}
-// _tmp_43: ',' names_with_default
-static void *
-_tmp_43_rule(Parser *p)
+// _loop0_50: param_with_default
+static asdl_seq *
+_loop0_50_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' names_with_default
- void *literal;
- asdl_seq* y;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (y = names_with_default_rule(p))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = y;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_50");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_50_type, seq);
+ return seq;
}
-// _tmp_44: ',' star_etc?
-static void *
-_tmp_44_rule(Parser *p)
+// _loop1_51: param_no_default
+static asdl_seq *
+_loop1_51_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' star_etc?
- void *literal;
- void *z;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (z = star_etc_rule(p), 1)
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_no_default
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = z;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_no_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
-}
-
-// _tmp_45: ',' star_etc?
-static void *
-_tmp_45_rule(Parser *p)
-{
- if (p->error_indicator) {
+ if (n == 0) {
+ PyMem_Free(children);
return NULL;
}
- void * res = NULL;
- int mark = p->mark;
- { // ',' star_etc?
- void *literal;
- void *z;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (z = star_etc_rule(p), 1)
- )
- {
- res = z;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
- }
- goto done;
- }
- p->mark = mark;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_51");
+ PyMem_Free(children);
+ return NULL;
}
- res = NULL;
- done:
- return res;
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_51_type, seq);
+ return seq;
}
-// _tmp_46: plain_names ','
-static void *
-_tmp_46_rule(Parser *p)
+// _loop0_52: param_with_default
+static asdl_seq *
+_loop0_52_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // plain_names ','
- void *literal;
- asdl_seq* n;
- if (
- (n = plain_names_rule(p))
- &&
- (literal = _PyPegen_expect_token(p, 12))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = n;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_52");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_52_type, seq);
+ return seq;
}
-// _loop0_47: name_with_optional_default
+// _loop1_53: param_with_default
static asdl_seq *
-_loop0_47_rule(Parser *p)
+_loop1_53_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11823,13 +12609,13 @@ _loop0_47_rule(Parser *p)
}
ssize_t children_capacity = 1;
ssize_t n = 0;
- { // name_with_optional_default
- NameDefaultPair* name_with_optional_default_var;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
while (
- (name_with_optional_default_var = name_with_optional_default_rule(p))
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = name_with_optional_default_var;
+ res = param_with_default_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -11843,53 +12629,78 @@ _loop0_47_rule(Parser *p)
}
p->mark = mark;
}
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_47");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_53");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_47_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_53_type, seq);
return seq;
}
-// _tmp_48: ',' kwds
-static void *
-_tmp_48_rule(Parser *p)
+// _loop1_54: param_no_default
+static asdl_seq *
+_loop1_54_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' kwds
- arg_ty d;
- void *literal;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (d = kwds_rule(p))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_no_default
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = d;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_no_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_54");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_54_type, seq);
+ return seq;
}
-// _loop1_49: name_with_optional_default
+// _loop1_55: param_no_default
static asdl_seq *
-_loop1_49_rule(Parser *p)
+_loop1_55_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -11904,13 +12715,13 @@ _loop1_49_rule(Parser *p)
}
ssize_t children_capacity = 1;
ssize_t n = 0;
- { // name_with_optional_default
- NameDefaultPair* name_with_optional_default_var;
+ { // param_no_default
+ arg_ty param_no_default_var;
while (
- (name_with_optional_default_var = name_with_optional_default_rule(p))
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = name_with_optional_default_var;
+ res = param_no_default_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -11930,83 +12741,121 @@ _loop1_49_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_49");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_55");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_49_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_55_type, seq);
return seq;
}
-// _tmp_50: ',' kwds
-static void *
-_tmp_50_rule(Parser *p)
+// _loop0_56: param_no_default
+static asdl_seq *
+_loop0_56_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // ',' kwds
- arg_ty d;
- void *literal;
- if (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (d = kwds_rule(p))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_no_default
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = d;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_no_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_56");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_56_type, seq);
+ return seq;
}
-// _tmp_51: '=' expression
-static void *
-_tmp_51_rule(Parser *p)
+// _loop1_57: param_with_default
+static asdl_seq *
+_loop1_57_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // '=' expression
- expr_ty e;
- void *literal;
- if (
- (literal = _PyPegen_expect_token(p, 22))
- &&
- (e = expression_rule(p))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = e;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_57");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_57_type, seq);
+ return seq;
}
-// _loop0_53: ',' name_with_default
+// _loop0_58: param_no_default
static asdl_seq *
-_loop0_53_rule(Parser *p)
+_loop0_58_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12021,21 +12870,13 @@ _loop0_53_rule(Parser *p)
}
ssize_t children_capacity = 1;
ssize_t n = 0;
- { // ',' name_with_default
- NameDefaultPair* elem;
- void *literal;
+ { // param_no_default
+ arg_ty param_no_default_var;
while (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (elem = name_with_default_rule(p))
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = elem;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(children);
- return NULL;
- }
+ res = param_no_default_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -12051,47 +12892,72 @@ _loop0_53_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_53");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_58");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_53_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_58_type, seq);
return seq;
}
-// _gather_52: name_with_default _loop0_53
+// _loop1_59: param_with_default
static asdl_seq *
-_gather_52_rule(Parser *p)
+_loop1_59_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- asdl_seq * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // name_with_default _loop0_53
- NameDefaultPair* elem;
- asdl_seq * seq;
- if (
- (elem = name_with_default_rule(p))
- &&
- (seq = _loop0_53_rule(p))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
)
{
- res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_59");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_59_type, seq);
+ return seq;
}
-// _loop0_55: ',' (plain_name !'=')
+// _loop0_60: param_maybe_default
static asdl_seq *
-_loop0_55_rule(Parser *p)
+_loop0_60_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12106,21 +12972,13 @@ _loop0_55_rule(Parser *p)
}
ssize_t children_capacity = 1;
ssize_t n = 0;
- { // ',' (plain_name !'=')
- void *elem;
- void *literal;
+ { // param_maybe_default
+ NameDefaultPair* param_maybe_default_var;
while (
- (literal = _PyPegen_expect_token(p, 12))
- &&
- (elem = _tmp_127_rule(p))
+ (param_maybe_default_var = param_maybe_default_rule(p))
)
{
- res = elem;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(children);
- return NULL;
- }
+ res = param_maybe_default_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -12136,79 +12994,72 @@ _loop0_55_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_55");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_60");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_55_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_60_type, seq);
return seq;
}
-// _gather_54: (plain_name !'=') _loop0_55
+// _loop1_61: param_maybe_default
static asdl_seq *
-_gather_54_rule(Parser *p)
+_loop1_61_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- asdl_seq * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // (plain_name !'=') _loop0_55
- void *elem;
- asdl_seq * seq;
- if (
- (elem = _tmp_127_rule(p))
- &&
- (seq = _loop0_55_rule(p))
- )
- {
- res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
- }
- p->mark = mark;
- }
- res = NULL;
- done:
- return res;
-}
-
-// _tmp_56: ':' annotation
-static void *
-_tmp_56_rule(Parser *p)
-{
- if (p->error_indicator) {
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
return NULL;
}
- void * res = NULL;
- int mark = p->mark;
- { // ':' annotation
- void *literal;
- expr_ty z;
- if (
- (literal = _PyPegen_expect_token(p, 11))
- &&
- (z = annotation_rule(p))
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_maybe_default
+ NameDefaultPair* param_maybe_default_var;
+ while (
+ (param_maybe_default_var = param_maybe_default_rule(p))
)
{
- res = z;
- if (res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- return NULL;
+ res = param_maybe_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
}
- goto done;
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_61");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_61_type, seq);
+ return seq;
}
-// _loop1_57: ('@' named_expression NEWLINE)
+// _loop1_62: ('@' named_expression NEWLINE)
static asdl_seq *
-_loop1_57_rule(Parser *p)
+_loop1_62_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12224,12 +13075,12 @@ _loop1_57_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('@' named_expression NEWLINE)
- void *_tmp_128_var;
+ void *_tmp_132_var;
while (
- (_tmp_128_var = _tmp_128_rule(p))
+ (_tmp_132_var = _tmp_132_rule(p))
)
{
- res = _tmp_128_var;
+ res = _tmp_132_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -12249,19 +13100,19 @@ _loop1_57_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_57");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_62");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_57_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_62_type, seq);
return seq;
}
-// _tmp_58: '(' arguments? ')'
+// _tmp_63: '(' arguments? ')'
static void *
-_tmp_58_rule(Parser *p)
+_tmp_63_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12294,9 +13145,9 @@ _tmp_58_rule(Parser *p)
return res;
}
-// _loop0_60: ',' star_expression
+// _loop0_65: ',' star_expression
static asdl_seq *
-_loop0_60_rule(Parser *p)
+_loop0_65_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12341,32 +13192,32 @@ _loop0_60_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_60");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_65");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_60_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_65_type, seq);
return seq;
}
-// _gather_59: star_expression _loop0_60
+// _gather_64: star_expression _loop0_65
static asdl_seq *
-_gather_59_rule(Parser *p)
+_gather_64_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // star_expression _loop0_60
+ { // star_expression _loop0_65
expr_ty elem;
asdl_seq * seq;
if (
(elem = star_expression_rule(p))
&&
- (seq = _loop0_60_rule(p))
+ (seq = _loop0_65_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -12379,9 +13230,9 @@ _gather_59_rule(Parser *p)
return res;
}
-// _loop1_61: (',' star_expression)
+// _loop1_66: (',' star_expression)
static asdl_seq *
-_loop1_61_rule(Parser *p)
+_loop1_66_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12397,12 +13248,12 @@ _loop1_61_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // (',' star_expression)
- void *_tmp_129_var;
+ void *_tmp_133_var;
while (
- (_tmp_129_var = _tmp_129_rule(p))
+ (_tmp_133_var = _tmp_133_rule(p))
)
{
- res = _tmp_129_var;
+ res = _tmp_133_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -12422,19 +13273,19 @@ _loop1_61_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_61");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_66");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_61_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_66_type, seq);
return seq;
}
-// _loop0_63: ',' star_named_expression
+// _loop0_68: ',' star_named_expression
static asdl_seq *
-_loop0_63_rule(Parser *p)
+_loop0_68_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12479,32 +13330,32 @@ _loop0_63_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_63");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_68");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_63_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_68_type, seq);
return seq;
}
-// _gather_62: star_named_expression _loop0_63
+// _gather_67: star_named_expression _loop0_68
static asdl_seq *
-_gather_62_rule(Parser *p)
+_gather_67_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // star_named_expression _loop0_63
+ { // star_named_expression _loop0_68
expr_ty elem;
asdl_seq * seq;
if (
(elem = star_named_expression_rule(p))
&&
- (seq = _loop0_63_rule(p))
+ (seq = _loop0_68_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -12517,9 +13368,9 @@ _gather_62_rule(Parser *p)
return res;
}
-// _loop1_64: (',' expression)
+// _loop1_69: (',' expression)
static asdl_seq *
-_loop1_64_rule(Parser *p)
+_loop1_69_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12535,12 +13386,12 @@ _loop1_64_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // (',' expression)
- void *_tmp_130_var;
+ void *_tmp_134_var;
while (
- (_tmp_130_var = _tmp_130_rule(p))
+ (_tmp_134_var = _tmp_134_rule(p))
)
{
- res = _tmp_130_var;
+ res = _tmp_134_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -12560,19 +13411,19 @@ _loop1_64_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_64");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_69");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_64_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_69_type, seq);
return seq;
}
-// _tmp_65: ',' lambda_plain_names
+// _tmp_70: ',' lambda_plain_names
static void *
-_tmp_65_rule(Parser *p)
+_tmp_70_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12602,9 +13453,9 @@ _tmp_65_rule(Parser *p)
return res;
}
-// _tmp_66: ',' lambda_names_with_default
+// _tmp_71: ',' lambda_names_with_default
static void *
-_tmp_66_rule(Parser *p)
+_tmp_71_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12634,9 +13485,9 @@ _tmp_66_rule(Parser *p)
return res;
}
-// _tmp_67: ',' lambda_star_etc?
+// _tmp_72: ',' lambda_star_etc?
static void *
-_tmp_67_rule(Parser *p)
+_tmp_72_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12666,9 +13517,9 @@ _tmp_67_rule(Parser *p)
return res;
}
-// _tmp_68: ',' lambda_names_with_default
+// _tmp_73: ',' lambda_names_with_default
static void *
-_tmp_68_rule(Parser *p)
+_tmp_73_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12698,9 +13549,9 @@ _tmp_68_rule(Parser *p)
return res;
}
-// _tmp_69: ',' lambda_star_etc?
+// _tmp_74: ',' lambda_star_etc?
static void *
-_tmp_69_rule(Parser *p)
+_tmp_74_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12730,9 +13581,9 @@ _tmp_69_rule(Parser *p)
return res;
}
-// _tmp_70: ',' lambda_names_with_default
+// _tmp_75: ',' lambda_names_with_default
static void *
-_tmp_70_rule(Parser *p)
+_tmp_75_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12762,9 +13613,9 @@ _tmp_70_rule(Parser *p)
return res;
}
-// _tmp_71: ',' lambda_star_etc?
+// _tmp_76: ',' lambda_star_etc?
static void *
-_tmp_71_rule(Parser *p)
+_tmp_76_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12794,9 +13645,9 @@ _tmp_71_rule(Parser *p)
return res;
}
-// _tmp_72: ',' lambda_star_etc?
+// _tmp_77: ',' lambda_star_etc?
static void *
-_tmp_72_rule(Parser *p)
+_tmp_77_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12826,9 +13677,9 @@ _tmp_72_rule(Parser *p)
return res;
}
-// _tmp_73: lambda_plain_names ','
+// _tmp_78: lambda_plain_names ','
static void *
-_tmp_73_rule(Parser *p)
+_tmp_78_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12858,9 +13709,9 @@ _tmp_73_rule(Parser *p)
return res;
}
-// _loop0_74: lambda_name_with_optional_default
+// _loop0_79: lambda_name_with_optional_default
static asdl_seq *
-_loop0_74_rule(Parser *p)
+_loop0_79_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12897,19 +13748,19 @@ _loop0_74_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_74");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_79");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_74_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_79_type, seq);
return seq;
}
-// _tmp_75: ',' lambda_kwds
+// _tmp_80: ',' lambda_kwds
static void *
-_tmp_75_rule(Parser *p)
+_tmp_80_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12939,9 +13790,9 @@ _tmp_75_rule(Parser *p)
return res;
}
-// _loop1_76: lambda_name_with_optional_default
+// _loop1_81: lambda_name_with_optional_default
static asdl_seq *
-_loop1_76_rule(Parser *p)
+_loop1_81_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -12982,19 +13833,19 @@ _loop1_76_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_76");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_81");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_76_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_81_type, seq);
return seq;
}
-// _tmp_77: ',' lambda_kwds
+// _tmp_82: ',' lambda_kwds
static void *
-_tmp_77_rule(Parser *p)
+_tmp_82_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13024,9 +13875,9 @@ _tmp_77_rule(Parser *p)
return res;
}
-// _tmp_78: '=' expression
+// _tmp_83: '=' expression
static void *
-_tmp_78_rule(Parser *p)
+_tmp_83_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13056,9 +13907,9 @@ _tmp_78_rule(Parser *p)
return res;
}
-// _loop0_80: ',' lambda_name_with_default
+// _loop0_85: ',' lambda_name_with_default
static asdl_seq *
-_loop0_80_rule(Parser *p)
+_loop0_85_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13103,32 +13954,32 @@ _loop0_80_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_80");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_85");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_80_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_85_type, seq);
return seq;
}
-// _gather_79: lambda_name_with_default _loop0_80
+// _gather_84: lambda_name_with_default _loop0_85
static asdl_seq *
-_gather_79_rule(Parser *p)
+_gather_84_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // lambda_name_with_default _loop0_80
+ { // lambda_name_with_default _loop0_85
NameDefaultPair* elem;
asdl_seq * seq;
if (
(elem = lambda_name_with_default_rule(p))
&&
- (seq = _loop0_80_rule(p))
+ (seq = _loop0_85_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -13141,9 +13992,9 @@ _gather_79_rule(Parser *p)
return res;
}
-// _loop0_82: ',' (lambda_plain_name !'=')
+// _loop0_87: ',' (lambda_plain_name !'=')
static asdl_seq *
-_loop0_82_rule(Parser *p)
+_loop0_87_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13164,7 +14015,7 @@ _loop0_82_rule(Parser *p)
while (
(literal = _PyPegen_expect_token(p, 12))
&&
- (elem = _tmp_131_rule(p))
+ (elem = _tmp_135_rule(p))
)
{
res = elem;
@@ -13188,32 +14039,32 @@ _loop0_82_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_82");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_87");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_82_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_87_type, seq);
return seq;
}
-// _gather_81: (lambda_plain_name !'=') _loop0_82
+// _gather_86: (lambda_plain_name !'=') _loop0_87
static asdl_seq *
-_gather_81_rule(Parser *p)
+_gather_86_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // (lambda_plain_name !'=') _loop0_82
+ { // (lambda_plain_name !'=') _loop0_87
void *elem;
asdl_seq * seq;
if (
- (elem = _tmp_131_rule(p))
+ (elem = _tmp_135_rule(p))
&&
- (seq = _loop0_82_rule(p))
+ (seq = _loop0_87_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -13226,9 +14077,9 @@ _gather_81_rule(Parser *p)
return res;
}
-// _loop1_83: ('or' conjunction)
+// _loop1_88: ('or' conjunction)
static asdl_seq *
-_loop1_83_rule(Parser *p)
+_loop1_88_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13244,12 +14095,12 @@ _loop1_83_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('or' conjunction)
- void *_tmp_132_var;
+ void *_tmp_136_var;
while (
- (_tmp_132_var = _tmp_132_rule(p))
+ (_tmp_136_var = _tmp_136_rule(p))
)
{
- res = _tmp_132_var;
+ res = _tmp_136_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -13269,19 +14120,19 @@ _loop1_83_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_83");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_88");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_83_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_88_type, seq);
return seq;
}
-// _loop1_84: ('and' inversion)
+// _loop1_89: ('and' inversion)
static asdl_seq *
-_loop1_84_rule(Parser *p)
+_loop1_89_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13297,12 +14148,12 @@ _loop1_84_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('and' inversion)
- void *_tmp_133_var;
+ void *_tmp_137_var;
while (
- (_tmp_133_var = _tmp_133_rule(p))
+ (_tmp_137_var = _tmp_137_rule(p))
)
{
- res = _tmp_133_var;
+ res = _tmp_137_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -13322,19 +14173,19 @@ _loop1_84_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_84");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_89");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_84_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_89_type, seq);
return seq;
}
-// _loop1_85: compare_op_bitwise_or_pair
+// _loop1_90: compare_op_bitwise_or_pair
static asdl_seq *
-_loop1_85_rule(Parser *p)
+_loop1_90_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13375,19 +14226,19 @@ _loop1_85_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_85");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_90");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_85_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_90_type, seq);
return seq;
}
-// _tmp_86: '!='
+// _tmp_91: '!='
static void *
-_tmp_86_rule(Parser *p)
+_tmp_91_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13414,9 +14265,9 @@ _tmp_86_rule(Parser *p)
return res;
}
-// _loop0_88: ',' slice
+// _loop0_93: ',' slice
static asdl_seq *
-_loop0_88_rule(Parser *p)
+_loop0_93_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13461,32 +14312,32 @@ _loop0_88_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_88");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_93");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_88_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_93_type, seq);
return seq;
}
-// _gather_87: slice _loop0_88
+// _gather_92: slice _loop0_93
static asdl_seq *
-_gather_87_rule(Parser *p)
+_gather_92_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // slice _loop0_88
+ { // slice _loop0_93
expr_ty elem;
asdl_seq * seq;
if (
(elem = slice_rule(p))
&&
- (seq = _loop0_88_rule(p))
+ (seq = _loop0_93_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -13499,9 +14350,9 @@ _gather_87_rule(Parser *p)
return res;
}
-// _tmp_89: ':' expression?
+// _tmp_94: ':' expression?
static void *
-_tmp_89_rule(Parser *p)
+_tmp_94_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13531,9 +14382,9 @@ _tmp_89_rule(Parser *p)
return res;
}
-// _tmp_90: tuple | group | genexp
+// _tmp_95: tuple | group | genexp
static void *
-_tmp_90_rule(Parser *p)
+_tmp_95_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13578,9 +14429,9 @@ _tmp_90_rule(Parser *p)
return res;
}
-// _tmp_91: list | listcomp
+// _tmp_96: list | listcomp
static void *
-_tmp_91_rule(Parser *p)
+_tmp_96_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13614,9 +14465,9 @@ _tmp_91_rule(Parser *p)
return res;
}
-// _tmp_92: dict | set | dictcomp | setcomp
+// _tmp_97: dict | set | dictcomp | setcomp
static void *
-_tmp_92_rule(Parser *p)
+_tmp_97_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13672,9 +14523,9 @@ _tmp_92_rule(Parser *p)
return res;
}
-// _loop1_93: STRING
+// _loop1_98: STRING
static asdl_seq *
-_loop1_93_rule(Parser *p)
+_loop1_98_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13715,19 +14566,19 @@ _loop1_93_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_93");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_98");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_93_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_98_type, seq);
return seq;
}
-// _tmp_94: star_named_expression ',' star_named_expressions?
+// _tmp_99: star_named_expression ',' star_named_expressions?
static void *
-_tmp_94_rule(Parser *p)
+_tmp_99_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13760,9 +14611,9 @@ _tmp_94_rule(Parser *p)
return res;
}
-// _tmp_95: yield_expr | named_expression
+// _tmp_100: yield_expr | named_expression
static void *
-_tmp_95_rule(Parser *p)
+_tmp_100_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13796,9 +14647,9 @@ _tmp_95_rule(Parser *p)
return res;
}
-// _loop0_97: ',' kvpair
+// _loop0_102: ',' kvpair
static asdl_seq *
-_loop0_97_rule(Parser *p)
+_loop0_102_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13843,32 +14694,32 @@ _loop0_97_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_97");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_102");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_97_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_102_type, seq);
return seq;
}
-// _gather_96: kvpair _loop0_97
+// _gather_101: kvpair _loop0_102
static asdl_seq *
-_gather_96_rule(Parser *p)
+_gather_101_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // kvpair _loop0_97
+ { // kvpair _loop0_102
KeyValuePair* elem;
asdl_seq * seq;
if (
(elem = kvpair_rule(p))
&&
- (seq = _loop0_97_rule(p))
+ (seq = _loop0_102_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -13881,9 +14732,9 @@ _gather_96_rule(Parser *p)
return res;
}
-// _loop1_98: (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
+// _loop1_103: (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
static asdl_seq *
-_loop1_98_rule(Parser *p)
+_loop1_103_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13899,12 +14750,12 @@ _loop1_98_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // (ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*)
- void *_tmp_134_var;
+ void *_tmp_138_var;
while (
- (_tmp_134_var = _tmp_134_rule(p))
+ (_tmp_138_var = _tmp_138_rule(p))
)
{
- res = _tmp_134_var;
+ res = _tmp_138_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -13924,19 +14775,19 @@ _loop1_98_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_98");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_103");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop1_98_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop1_103_type, seq);
return seq;
}
-// _tmp_99: ',' args
+// _tmp_104: ',' args
static void *
-_tmp_99_rule(Parser *p)
+_tmp_104_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13966,9 +14817,9 @@ _tmp_99_rule(Parser *p)
return res;
}
-// _tmp_100: ',' args
+// _tmp_105: ',' args
static void *
-_tmp_100_rule(Parser *p)
+_tmp_105_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -13998,9 +14849,9 @@ _tmp_100_rule(Parser *p)
return res;
}
-// _loop0_102: ',' kwarg_or_starred
+// _loop0_107: ',' kwarg_or_starred
static asdl_seq *
-_loop0_102_rule(Parser *p)
+_loop0_107_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14045,32 +14896,32 @@ _loop0_102_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_102");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_107");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_102_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_107_type, seq);
return seq;
}
-// _gather_101: kwarg_or_starred _loop0_102
+// _gather_106: kwarg_or_starred _loop0_107
static asdl_seq *
-_gather_101_rule(Parser *p)
+_gather_106_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // kwarg_or_starred _loop0_102
+ { // kwarg_or_starred _loop0_107
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_starred_rule(p))
&&
- (seq = _loop0_102_rule(p))
+ (seq = _loop0_107_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14083,9 +14934,9 @@ _gather_101_rule(Parser *p)
return res;
}
-// _loop0_104: ',' kwarg_or_double_starred
+// _loop0_109: ',' kwarg_or_double_starred
static asdl_seq *
-_loop0_104_rule(Parser *p)
+_loop0_109_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14130,32 +14981,32 @@ _loop0_104_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_104");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_109");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_104_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_109_type, seq);
return seq;
}
-// _gather_103: kwarg_or_double_starred _loop0_104
+// _gather_108: kwarg_or_double_starred _loop0_109
static asdl_seq *
-_gather_103_rule(Parser *p)
+_gather_108_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // kwarg_or_double_starred _loop0_104
+ { // kwarg_or_double_starred _loop0_109
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_double_starred_rule(p))
&&
- (seq = _loop0_104_rule(p))
+ (seq = _loop0_109_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14168,9 +15019,9 @@ _gather_103_rule(Parser *p)
return res;
}
-// _loop0_106: ',' kwarg_or_starred
+// _loop0_111: ',' kwarg_or_starred
static asdl_seq *
-_loop0_106_rule(Parser *p)
+_loop0_111_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14215,32 +15066,32 @@ _loop0_106_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_106");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_111");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_106_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_111_type, seq);
return seq;
}
-// _gather_105: kwarg_or_starred _loop0_106
+// _gather_110: kwarg_or_starred _loop0_111
static asdl_seq *
-_gather_105_rule(Parser *p)
+_gather_110_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // kwarg_or_starred _loop0_106
+ { // kwarg_or_starred _loop0_111
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_starred_rule(p))
&&
- (seq = _loop0_106_rule(p))
+ (seq = _loop0_111_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14253,9 +15104,9 @@ _gather_105_rule(Parser *p)
return res;
}
-// _loop0_108: ',' kwarg_or_double_starred
+// _loop0_113: ',' kwarg_or_double_starred
static asdl_seq *
-_loop0_108_rule(Parser *p)
+_loop0_113_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14300,32 +15151,32 @@ _loop0_108_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_108");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_113");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_108_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_113_type, seq);
return seq;
}
-// _gather_107: kwarg_or_double_starred _loop0_108
+// _gather_112: kwarg_or_double_starred _loop0_113
static asdl_seq *
-_gather_107_rule(Parser *p)
+_gather_112_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // kwarg_or_double_starred _loop0_108
+ { // kwarg_or_double_starred _loop0_113
KeywordOrStarred* elem;
asdl_seq * seq;
if (
(elem = kwarg_or_double_starred_rule(p))
&&
- (seq = _loop0_108_rule(p))
+ (seq = _loop0_113_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14338,9 +15189,9 @@ _gather_107_rule(Parser *p)
return res;
}
-// _loop0_109: (',' star_target)
+// _loop0_114: (',' star_target)
static asdl_seq *
-_loop0_109_rule(Parser *p)
+_loop0_114_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14356,12 +15207,12 @@ _loop0_109_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // (',' star_target)
- void *_tmp_135_var;
+ void *_tmp_139_var;
while (
- (_tmp_135_var = _tmp_135_rule(p))
+ (_tmp_139_var = _tmp_139_rule(p))
)
{
- res = _tmp_135_var;
+ res = _tmp_139_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -14377,19 +15228,19 @@ _loop0_109_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_109");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_109_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq);
return seq;
}
-// _loop0_111: ',' star_target
+// _loop0_116: ',' star_target
static asdl_seq *
-_loop0_111_rule(Parser *p)
+_loop0_116_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14434,32 +15285,32 @@ _loop0_111_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_111");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_111_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq);
return seq;
}
-// _gather_110: star_target _loop0_111
+// _gather_115: star_target _loop0_116
static asdl_seq *
-_gather_110_rule(Parser *p)
+_gather_115_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // star_target _loop0_111
+ { // star_target _loop0_116
expr_ty elem;
asdl_seq * seq;
if (
(elem = star_target_rule(p))
&&
- (seq = _loop0_111_rule(p))
+ (seq = _loop0_116_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14472,9 +15323,9 @@ _gather_110_rule(Parser *p)
return res;
}
-// _tmp_112: !'*' star_target
+// _tmp_117: !'*' star_target
static void *
-_tmp_112_rule(Parser *p)
+_tmp_117_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14499,9 +15350,9 @@ _tmp_112_rule(Parser *p)
return res;
}
-// _loop0_114: ',' del_target
+// _loop0_119: ',' del_target
static asdl_seq *
-_loop0_114_rule(Parser *p)
+_loop0_119_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14546,32 +15397,32 @@ _loop0_114_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_114");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_119");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_114_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_119_type, seq);
return seq;
}
-// _gather_113: del_target _loop0_114
+// _gather_118: del_target _loop0_119
static asdl_seq *
-_gather_113_rule(Parser *p)
+_gather_118_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // del_target _loop0_114
+ { // del_target _loop0_119
expr_ty elem;
asdl_seq * seq;
if (
(elem = del_target_rule(p))
&&
- (seq = _loop0_114_rule(p))
+ (seq = _loop0_119_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14584,9 +15435,9 @@ _gather_113_rule(Parser *p)
return res;
}
-// _loop0_116: ',' target
+// _loop0_121: ',' target
static asdl_seq *
-_loop0_116_rule(Parser *p)
+_loop0_121_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14631,32 +15482,32 @@ _loop0_116_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_116");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_121");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_116_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_121_type, seq);
return seq;
}
-// _gather_115: target _loop0_116
+// _gather_120: target _loop0_121
static asdl_seq *
-_gather_115_rule(Parser *p)
+_gather_120_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
asdl_seq * res = NULL;
int mark = p->mark;
- { // target _loop0_116
+ { // target _loop0_121
expr_ty elem;
asdl_seq * seq;
if (
(elem = target_rule(p))
&&
- (seq = _loop0_116_rule(p))
+ (seq = _loop0_121_rule(p))
)
{
res = _PyPegen_seq_insert_in_front(p, elem, seq);
@@ -14669,9 +15520,9 @@ _gather_115_rule(Parser *p)
return res;
}
-// _tmp_117: args | expression for_if_clauses
+// _tmp_122: args | expression for_if_clauses
static void *
-_tmp_117_rule(Parser *p)
+_tmp_122_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14708,9 +15559,9 @@ _tmp_117_rule(Parser *p)
return res;
}
-// _tmp_118: '=' annotated_rhs
+// _tmp_123: '=' annotated_rhs
static void *
-_tmp_118_rule(Parser *p)
+_tmp_123_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14736,9 +15587,9 @@ _tmp_118_rule(Parser *p)
return res;
}
-// _tmp_119: '=' | augassign
+// _tmp_124: '=' | augassign
static void *
-_tmp_119_rule(Parser *p)
+_tmp_124_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14772,9 +15623,9 @@ _tmp_119_rule(Parser *p)
return res;
}
-// _tmp_120: yield_expr | star_expressions
+// _tmp_125: yield_expr | star_expressions
static void *
-_tmp_120_rule(Parser *p)
+_tmp_125_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14808,9 +15659,9 @@ _tmp_120_rule(Parser *p)
return res;
}
-// _tmp_121: '[' | '(' | '{'
+// _tmp_126: '[' | '(' | '{'
static void *
-_tmp_121_rule(Parser *p)
+_tmp_126_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14855,37 +15706,58 @@ _tmp_121_rule(Parser *p)
return res;
}
-// _tmp_122: plain_names ','
-static void *
-_tmp_122_rule(Parser *p)
+// _loop0_127: param_no_default
+static asdl_seq *
+_loop0_127_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
- void * res = NULL;
+ void *res = NULL;
int mark = p->mark;
- { // plain_names ','
- void *literal;
- asdl_seq* plain_names_var;
- if (
- (plain_names_var = plain_names_rule(p))
- &&
- (literal = _PyPegen_expect_token(p, 12))
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_no_default
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p))
)
{
- res = _PyPegen_dummy_name(p, plain_names_var, literal);
- goto done;
+ res = param_no_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
}
p->mark = mark;
}
- res = NULL;
- done:
- return res;
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_127");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop0_127_type, seq);
+ return seq;
}
-// _tmp_123: slash_with_default | names_with_default
+// _tmp_128: slash_with_default | param_with_default+
static void *
-_tmp_123_rule(Parser *p)
+_tmp_128_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14903,13 +15775,13 @@ _tmp_123_rule(Parser *p)
}
p->mark = mark;
}
- { // names_with_default
- asdl_seq* names_with_default_var;
+ { // param_with_default+
+ asdl_seq * _loop1_140_var;
if (
- (names_with_default_var = names_with_default_rule(p))
+ (_loop1_140_var = _loop1_140_rule(p))
)
{
- res = names_with_default_var;
+ res = _loop1_140_var;
goto done;
}
p->mark = mark;
@@ -14919,9 +15791,9 @@ _tmp_123_rule(Parser *p)
return res;
}
-// _tmp_124: star_targets '='
+// _tmp_129: star_targets '='
static void *
-_tmp_124_rule(Parser *p)
+_tmp_129_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14951,9 +15823,9 @@ _tmp_124_rule(Parser *p)
return res;
}
-// _tmp_125: '.' | '...'
+// _tmp_130: '.' | '...'
static void *
-_tmp_125_rule(Parser *p)
+_tmp_130_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -14987,9 +15859,9 @@ _tmp_125_rule(Parser *p)
return res;
}
-// _tmp_126: '.' | '...'
+// _tmp_131: '.' | '...'
static void *
-_tmp_126_rule(Parser *p)
+_tmp_131_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15023,36 +15895,9 @@ _tmp_126_rule(Parser *p)
return res;
}
-// _tmp_127: plain_name !'='
-static void *
-_tmp_127_rule(Parser *p)
-{
- if (p->error_indicator) {
- return NULL;
- }
- void * res = NULL;
- int mark = p->mark;
- { // plain_name !'='
- arg_ty plain_name_var;
- if (
- (plain_name_var = plain_name_rule(p))
- &&
- _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22)
- )
- {
- res = plain_name_var;
- goto done;
- }
- p->mark = mark;
- }
- res = NULL;
- done:
- return res;
-}
-
-// _tmp_128: '@' named_expression NEWLINE
+// _tmp_132: '@' named_expression NEWLINE
static void *
-_tmp_128_rule(Parser *p)
+_tmp_132_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15085,9 +15930,9 @@ _tmp_128_rule(Parser *p)
return res;
}
-// _tmp_129: ',' star_expression
+// _tmp_133: ',' star_expression
static void *
-_tmp_129_rule(Parser *p)
+_tmp_133_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15117,9 +15962,9 @@ _tmp_129_rule(Parser *p)
return res;
}
-// _tmp_130: ',' expression
+// _tmp_134: ',' expression
static void *
-_tmp_130_rule(Parser *p)
+_tmp_134_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15149,9 +15994,9 @@ _tmp_130_rule(Parser *p)
return res;
}
-// _tmp_131: lambda_plain_name !'='
+// _tmp_135: lambda_plain_name !'='
static void *
-_tmp_131_rule(Parser *p)
+_tmp_135_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15176,9 +16021,9 @@ _tmp_131_rule(Parser *p)
return res;
}
-// _tmp_132: 'or' conjunction
+// _tmp_136: 'or' conjunction
static void *
-_tmp_132_rule(Parser *p)
+_tmp_136_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15208,9 +16053,9 @@ _tmp_132_rule(Parser *p)
return res;
}
-// _tmp_133: 'and' inversion
+// _tmp_137: 'and' inversion
static void *
-_tmp_133_rule(Parser *p)
+_tmp_137_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15240,9 +16085,9 @@ _tmp_133_rule(Parser *p)
return res;
}
-// _tmp_134: ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
+// _tmp_138: ASYNC? 'for' star_targets 'in' disjunction (('if' disjunction))*
static void *
-_tmp_134_rule(Parser *p)
+_tmp_138_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15267,7 +16112,7 @@ _tmp_134_rule(Parser *p)
&&
(b = disjunction_rule(p))
&&
- (c = _loop0_136_rule(p))
+ (c = _loop0_141_rule(p))
)
{
res = _Py_comprehension ( a , b , c , y != NULL , p -> arena );
@@ -15284,9 +16129,9 @@ _tmp_134_rule(Parser *p)
return res;
}
-// _tmp_135: ',' star_target
+// _tmp_139: ',' star_target
static void *
-_tmp_135_rule(Parser *p)
+_tmp_139_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15316,9 +16161,62 @@ _tmp_135_rule(Parser *p)
return res;
}
-// _loop0_136: ('if' disjunction)
+// _loop1_140: param_with_default
static asdl_seq *
-_loop0_136_rule(Parser *p)
+_loop1_140_rule(Parser *p)
+{
+ if (p->error_indicator) {
+ return NULL;
+ }
+ void *res = NULL;
+ int mark = p->mark;
+ int start_mark = p->mark;
+ void **children = PyMem_Malloc(sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "Parser out of memory");
+ return NULL;
+ }
+ ssize_t children_capacity = 1;
+ ssize_t n = 0;
+ { // param_with_default
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p))
+ )
+ {
+ res = param_with_default_var;
+ if (n == children_capacity) {
+ children_capacity *= 2;
+ children = PyMem_Realloc(children, children_capacity*sizeof(void *));
+ if (!children) {
+ PyErr_Format(PyExc_MemoryError, "realloc None");
+ return NULL;
+ }
+ }
+ children[n++] = res;
+ mark = p->mark;
+ }
+ p->mark = mark;
+ }
+ if (n == 0) {
+ PyMem_Free(children);
+ return NULL;
+ }
+ asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
+ if (!seq) {
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop1_140");
+ PyMem_Free(children);
+ return NULL;
+ }
+ for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
+ PyMem_Free(children);
+ _PyPegen_insert_memo(p, start_mark, _loop1_140_type, seq);
+ return seq;
+}
+
+// _loop0_141: ('if' disjunction)
+static asdl_seq *
+_loop0_141_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15334,12 +16232,12 @@ _loop0_136_rule(Parser *p)
ssize_t children_capacity = 1;
ssize_t n = 0;
{ // ('if' disjunction)
- void *_tmp_137_var;
+ void *_tmp_142_var;
while (
- (_tmp_137_var = _tmp_137_rule(p))
+ (_tmp_142_var = _tmp_142_rule(p))
)
{
- res = _tmp_137_var;
+ res = _tmp_142_var;
if (n == children_capacity) {
children_capacity *= 2;
children = PyMem_Realloc(children, children_capacity*sizeof(void *));
@@ -15355,19 +16253,19 @@ _loop0_136_rule(Parser *p)
}
asdl_seq *seq = _Py_asdl_seq_new(n, p->arena);
if (!seq) {
- PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_136");
+ PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_141");
PyMem_Free(children);
return NULL;
}
for (int i = 0; i < n; i++) asdl_seq_SET(seq, i, children[i]);
PyMem_Free(children);
- _PyPegen_insert_memo(p, start_mark, _loop0_136_type, seq);
+ _PyPegen_insert_memo(p, start_mark, _loop0_141_type, seq);
return seq;
}
-// _tmp_137: 'if' disjunction
+// _tmp_142: 'if' disjunction
static void *
-_tmp_137_rule(Parser *p)
+_tmp_142_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
@@ -15412,6 +16310,8 @@ _PyPegen_parse(Parser *p)
result = interactive_rule(p);
} else if (p->start_rule == Py_eval_input) {
result = eval_rule(p);
+ } else if (p->start_rule == Py_func_type_input) {
+ result = func_type_rule(p);
} else if (p->start_rule == Py_fstring_input) {
result = fstring_rule(p);
}
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c
index 942447b..5a2491c 100644
--- a/Parser/pegen/pegen.c
+++ b/Parser/pegen/pegen.c
@@ -5,6 +5,39 @@
#include "pegen.h"
#include "parse_string.h"
+PyObject *
+_PyPegen_new_type_comment(Parser *p, char *s)
+{
+ PyObject *res = PyUnicode_DecodeUTF8(s, strlen(s), NULL);
+ if (res == NULL) {
+ return NULL;
+ }
+ if (PyArena_AddPyObject(p->arena, res) < 0) {
+ Py_DECREF(res);
+ return NULL;
+ }
+ return res;
+}
+
+arg_ty
+_PyPegen_add_type_comment_to_arg(Parser *p, arg_ty a, Token *tc)
+{
+ if (tc == NULL) {
+ return a;
+ }
+ char *bytes = PyBytes_AsString(tc->bytes);
+ if (bytes == NULL) {
+ return NULL;
+ }
+ PyObject *tco = _PyPegen_new_type_comment(p, bytes);
+ if (tco == NULL) {
+ return NULL;
+ }
+ return arg(a->arg, a->annotation, tco,
+ a->lineno, a->col_offset, a->end_lineno, a->end_col_offset,
+ p->arena);
+}
+
static int
init_normalization(Parser *p)
{
@@ -539,11 +572,66 @@ _get_keyword_or_name_type(Parser *p, const char *name, int name_len)
return NAME;
}
+static int
+growable_comment_array_init(growable_comment_array *arr, size_t initial_size) {
+ assert(initial_size > 0);
+ arr->items = PyMem_Malloc(initial_size * sizeof(*arr->items));
+ arr->size = initial_size;
+ arr->num_items = 0;
+
+ return arr->items != NULL;
+}
+
+static int
+growable_comment_array_add(growable_comment_array *arr, int lineno, char *comment) {
+ if (arr->num_items >= arr->size) {
+ size_t new_size = arr->size * 2;
+ void *new_items_array = PyMem_Realloc(arr->items, new_size * sizeof(*arr->items));
+ if (!new_items_array) {
+ return 0;
+ }
+ arr->items = new_items_array;
+ arr->size = new_size;
+ }
+
+ arr->items[arr->num_items].lineno = lineno;
+ arr->items[arr->num_items].comment = comment; // Take ownership
+ arr->num_items++;
+ return 1;
+}
+
+static void
+growable_comment_array_deallocate(growable_comment_array *arr) {
+ for (unsigned i = 0; i < arr->num_items; i++) {
+ PyMem_Free(arr->items[i].comment);
+ }
+ PyMem_Free(arr->items);
+}
+
int
_PyPegen_fill_token(Parser *p)
{
const char *start, *end;
int type = PyTokenizer_Get(p->tok, &start, &end);
+
+ // Record and skip '# type: ignore' comments
+ while (type == TYPE_IGNORE) {
+ Py_ssize_t len = end - start;
+ char *tag = PyMem_Malloc(len + 1);
+ if (tag == NULL) {
+ PyErr_NoMemory();
+ return -1;
+ }
+ strncpy(tag, start, len);
+ tag[len] = '\0';
+ // Ownership of tag passes to the growable array
+ if (!growable_comment_array_add(&p->type_ignore_comments, p->tok->lineno, tag)) {
+ PyErr_NoMemory();
+ return -1;
+ }
+ type = PyTokenizer_Get(p->tok, &start, &end);
+ }
+
if (type == ERRORTOKEN) {
if (p->tok->done == E_DECODE) {
return raise_decode_error(p);
@@ -919,6 +1007,7 @@ _PyPegen_Parser_Free(Parser *p)
PyMem_Free(p->tokens[i]);
}
PyMem_Free(p->tokens);
+ growable_comment_array_deallocate(&p->type_ignore_comments);
PyMem_Free(p);
}
@@ -961,13 +1050,19 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags,
PyMem_Free(p);
return (Parser *) PyErr_NoMemory();
}
- p->tokens[0] = PyMem_Malloc(sizeof(Token));
+ p->tokens[0] = PyMem_Calloc(1, sizeof(Token));
if (!p->tokens) {
PyMem_Free(p->tokens);
PyMem_Free(p);
return (Parser *) PyErr_NoMemory();
}
- memset(p->tokens[0], '\0', sizeof(Token));
+ if (!growable_comment_array_init(&p->type_ignore_comments, 10)) {
+ PyMem_Free(p->tokens[0]);
+ PyMem_Free(p->tokens);
+ PyMem_Free(p);
+ return (Parser *) PyErr_NoMemory();
+ }
+
p->mark = 0;
p->fill = 0;
p->size = 1;
@@ -1099,6 +1194,8 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
mod_ty result = NULL;
int parser_flags = compute_parser_flags(flags);
+ tok->type_comments = (parser_flags & PyPARSE_TYPE_COMMENTS) > 0;
+
Parser *p = _PyPegen_Parser_New(tok, start_rule, parser_flags, NULL, arena);
if (p == NULL) {
goto error;
@@ -1155,6 +1252,27 @@ _PyPegen_seq_insert_in_front(Parser *p, void *a, asdl_seq *seq)
return new_seq;
}
+/* Creates a copy of seq and appends a to it */
+asdl_seq *
+_PyPegen_seq_append_to_end(Parser *p, asdl_seq *seq, void *a)
+{
+ assert(a != NULL);
+ if (!seq) {
+ return _PyPegen_singleton_seq(p, a);
+ }
+
+ asdl_seq *new_seq = _Py_asdl_seq_new(asdl_seq_LEN(seq) + 1, p->arena);
+ if (!new_seq) {
+ return NULL;
+ }
+
+ for (Py_ssize_t i = 0, l = asdl_seq_LEN(new_seq); i + 1 < l; i++) {
+ asdl_seq_SET(new_seq, i, asdl_seq_GET(seq, i));
+ }
+ asdl_seq_SET(new_seq, asdl_seq_LEN(new_seq) - 1, a);
+ return new_seq;
+}
+
static Py_ssize_t
_get_flattened_seq_size(asdl_seq *seqs)
{
@@ -1483,13 +1601,13 @@ _PyPegen_get_values(Parser *p, asdl_seq *seq)
/* Constructs a NameDefaultPair */
NameDefaultPair *
-_PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value)
+_PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
{
NameDefaultPair *a = PyArena_Malloc(p->arena, sizeof(NameDefaultPair));
if (!a) {
return NULL;
}
- a->arg = arg;
+ a->arg = _PyPegen_add_type_comment_to_arg(p, arg, tc);
a->value = value;
return a;
}
@@ -1946,3 +2064,28 @@ error:
}
return NULL;
}
+
+mod_ty
+_PyPegen_make_module(Parser *p, asdl_seq *a) {
+ asdl_seq *type_ignores = NULL;
+ Py_ssize_t num = p->type_ignore_comments.num_items;
+ if (num > 0) {
+ // Turn the raw (comment, lineno) pairs into TypeIgnore objects in the arena
+ type_ignores = _Py_asdl_seq_new(num, p->arena);
+ if (type_ignores == NULL) {
+ return NULL;
+ }
+ for (int i = 0; i < num; i++) {
+ PyObject *tag = _PyPegen_new_type_comment(p, p->type_ignore_comments.items[i].comment);
+ if (tag == NULL) {
+ return NULL;
+ }
+ type_ignore_ty ti = TypeIgnore(p->type_ignore_comments.items[i].lineno, tag, p->arena);
+ if (ti == NULL) {
+ return NULL;
+ }
+ asdl_seq_SET(type_ignores, i, ti);
+ }
+ }
+ return Module(a, type_ignores, p->arena);
+}
diff --git a/Parser/pegen/pegen.h b/Parser/pegen/pegen.h
index 99ec0f4..3af4bb2 100644
--- a/Parser/pegen/pegen.h
+++ b/Parser/pegen/pegen.h
@@ -43,6 +43,16 @@ typedef struct {
int type;
} KeywordToken;
+
+typedef struct {
+ struct {
+ int lineno;
+ char *comment; // The " <tag>" in "# type: ignore <tag>"
+ } *items;
+ size_t size;
+ size_t num_items;
+} growable_comment_array;
+
typedef struct {
struct tok_state *tok;
Token **tokens;
@@ -59,6 +69,7 @@ typedef struct {
int starting_col_offset;
int error_indicator;
int flags;
+ growable_comment_array type_ignore_comments;
} Parser;
typedef struct {
@@ -110,13 +121,7 @@ int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *);
Token *_PyPegen_expect_token(Parser *p, int type);
Token *_PyPegen_get_last_nonnwhitespace_token(Parser *);
int _PyPegen_fill_token(Parser *p);
-void *_PyPegen_async_token(Parser *p);
-void *_PyPegen_await_token(Parser *p);
-void *_PyPegen_endmarker_token(Parser *p);
expr_ty _PyPegen_name_token(Parser *p);
-void *_PyPegen_newline_token(Parser *p);
-void *_PyPegen_indent_token(Parser *p);
-void *_PyPegen_dedent_token(Parser *p);
expr_ty _PyPegen_number_token(Parser *p);
void *_PyPegen_string_token(Parser *p);
const char *_PyPegen_get_expr_name(expr_ty);
@@ -153,6 +158,29 @@ CHECK_CALL_NULL_ALLOWED(Parser *p, void *result)
#define CHECK(result) CHECK_CALL(p, result)
#define CHECK_NULL_ALLOWED(result) CHECK_CALL_NULL_ALLOWED(p, result)
+PyObject *_PyPegen_new_type_comment(Parser *, char *);
+
+Py_LOCAL_INLINE(PyObject *)
+NEW_TYPE_COMMENT(Parser *p, Token *tc)
+{
+ if (tc == NULL) {
+ return NULL;
+ }
+ char *bytes = PyBytes_AsString(tc->bytes);
+ if (bytes == NULL) {
+ goto error;
+ }
+ PyObject *tco = _PyPegen_new_type_comment(p, bytes);
+ if (tco == NULL) {
+ goto error;
+ }
+ return tco;
+ error:
+ p->error_indicator = 1; // Inline CHECK_CALL
+ return NULL;
+}
+
+arg_ty _PyPegen_add_type_comment_to_arg(Parser *, arg_ty, Token *);
PyObject *_PyPegen_new_identifier(Parser *, char *);
Parser *_PyPegen_Parser_New(struct tok_state *, int, int, int *, PyArena *);
void _PyPegen_Parser_Free(Parser *);
@@ -164,6 +192,7 @@ mod_ty _PyPegen_run_parser_from_string(const char *, int, PyObject *, PyCompiler
void *_PyPegen_interactive_exit(Parser *);
asdl_seq *_PyPegen_singleton_seq(Parser *, void *);
asdl_seq *_PyPegen_seq_insert_in_front(Parser *, void *, asdl_seq *);
+asdl_seq *_PyPegen_seq_append_to_end(Parser *, asdl_seq *, void *);
asdl_seq *_PyPegen_seq_flatten(Parser *, asdl_seq *);
expr_ty _PyPegen_join_names_with_dot(Parser *, expr_ty, expr_ty);
int _PyPegen_seq_count_dots(asdl_seq *);
@@ -176,7 +205,7 @@ expr_ty _PyPegen_set_expr_context(Parser *, expr_ty, expr_context_ty);
KeyValuePair *_PyPegen_key_value_pair(Parser *, expr_ty, expr_ty);
asdl_seq *_PyPegen_get_keys(Parser *, asdl_seq *);
asdl_seq *_PyPegen_get_values(Parser *, asdl_seq *);
-NameDefaultPair *_PyPegen_name_default_pair(Parser *, arg_ty, expr_ty);
+NameDefaultPair *_PyPegen_name_default_pair(Parser *, arg_ty, expr_ty, Token *);
SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_seq *, asdl_seq *);
StarEtc *_PyPegen_star_etc(Parser *, arg_ty, asdl_seq *, arg_ty);
arguments_ty _PyPegen_make_arguments(Parser *, asdl_seq *, SlashWithDefault *,
@@ -192,6 +221,7 @@ expr_ty _PyPegen_concatenate_strings(Parser *p, asdl_seq *);
asdl_seq *_PyPegen_join_sequences(Parser *, asdl_seq *, asdl_seq *);
void *_PyPegen_arguments_parsing_error(Parser *, expr_ty);
int _PyPegen_check_barry_as_flufl(Parser *);
+mod_ty _PyPegen_make_module(Parser *, asdl_seq *);
void *_PyPegen_parse(Parser *);
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 14c3e96..82ca317 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -816,12 +816,8 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
if (str == NULL)
goto error;
- int current_use_peg = PyInterpreterState_Get()->config._use_peg_parser;
- if (flags & PyCF_TYPE_COMMENTS || feature_version >= 0 || compile_mode == 3) {
- PyInterpreterState_Get()->config._use_peg_parser = 0;
- }
result = Py_CompileStringObject(str, filename, start[compile_mode], &cf, optimize);
- PyInterpreterState_Get()->config._use_peg_parser = current_use_peg;
+
Py_XDECREF(source_copy);
goto finally;