summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Grammar/python.gram667
-rw-r--r--Parser/parser.c13168
2 files changed, 7029 insertions, 6806 deletions
diff --git a/Grammar/python.gram b/Grammar/python.gram
index 8219add..278ddfb 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -25,43 +25,89 @@ _PyPegen_parse(Parser *p)
return result;
}
-
-// The end
'''
+
+# ========================= START OF THE GRAMMAR =========================
+
+# General grammatical elements and rules:
+#
+# * Strings with double quotes (") denote SOFT KEYWORDS
+# * Strings with single quotes (') denote KEYWORDS
+# * Upper case names (NAME) denote tokens in the Grammar/Tokens file
+# * Rule names starting with "invalid_" are used for specialized syntax errors
+# - These rules are NOT used in the first pass of the parser.
+# - Only if the first pass fails to parse, a second pass including the invalid
+# rules will be executed.
+# - If the parser fails in the second phase with a generic syntax error, the
+# location of the generic failure of the first pass will be used (this avoids
+# reporting incorrect locations due to the invalid rules).
+# - The order of the alternatives involving invalid rules matter
+# (like any rule in PEG).
+#
+# Grammar Syntax (see PEP 617 for more information):
+#
+# rule_name: expression
+# Optionally, a type can be included right after the rule name, which
+# specifies the return type of the C or Python function corresponding to the
+# rule:
+# rule_name[return_type]: expression
+# If the return type is omitted, then a void * is returned in C and an Any in
+# Python.
+# e1 e2
+# Match e1, then match e2.
+# e1 | e2
+# Match e1 or e2.
+# The first alternative can also appear on the line after the rule name for
+# formatting purposes. In that case, a | must be used before the first
+# alternative, like so:
+# rule_name[return_type]:
+# | first_alt
+# | second_alt
+# ( e )
+# Match e (allows also to use other operators in the group like '(e)*')
+# [ e ] or e?
+# Optionally match e.
+# e*
+# Match zero or more occurrences of e.
+# e+
+# Match one or more occurrences of e.
+# s.e+
+# Match one or more occurrences of e, separated by s. The generated parse tree
+# does not include the separator. This is otherwise identical to (e (s e)*).
+# &e
+# Succeed if e can be parsed, without consuming any input.
+# !e
+# Fail if e can be parsed, without consuming any input.
+# ~
+# Commit to the current alternative, even if it fails to parse.
+#
+
+# STARTING RULES
+# ==============
+
file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }
interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p->arena) }
eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p->arena) }
func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }
fstring[expr_ty]: star_expressions
-# type_expressions allow */** but ignore them
-type_expressions[asdl_expr_seq*]:
- | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
- (asdl_expr_seq*)_PyPegen_seq_append_to_end(
- p,
- CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),
- c) }
- | a=','.expression+ ',' '*' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
- | a=','.expression+ ',' '**' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
- | '*' a=expression ',' '**' b=expression {
- (asdl_expr_seq*)_PyPegen_seq_append_to_end(
- p,
- CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),
- b) }
- | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
- | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
- | a[asdl_expr_seq*]=','.expression+ {a}
+# GENERAL STATEMENTS
+# ==================
statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }
+
statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmts { a }
+
statement_newline[asdl_stmt_seq*]:
| a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
| simple_stmts
| NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _PyAST_Pass(EXTRA))) }
| ENDMARKER { _PyPegen_interactive_exit(p) }
+
simple_stmts[asdl_stmt_seq*]:
| a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } # Not needed, there for speedup
| a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }
+
# NOTE: assignment MUST precede expression, else parsing a simple assignment
# will throw a SyntaxError.
simple_stmt[stmt_ty] (memo):
@@ -78,6 +124,7 @@ simple_stmt[stmt_ty] (memo):
| 'continue' { _PyAST_Continue(EXTRA) }
| &'global' global_stmt
| &'nonlocal' nonlocal_stmt
+
compound_stmt[stmt_ty]:
| &('def' | '@' | ASYNC) function_def
| &'if' if_stmt
@@ -88,6 +135,9 @@ compound_stmt[stmt_ty]:
| &'while' while_stmt
| match_stmt
+# SIMPLE STATEMENTS
+# =================
+
# NOTE: annotated_rhs may start with 'yield'; yield_expr must start with 'yield'
assignment[stmt_ty]:
| a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {
@@ -106,6 +156,8 @@ assignment[stmt_ty]:
_PyAST_AugAssign(a, b->kind, c, EXTRA) }
| invalid_assignment
+annotated_rhs[expr_ty]: yield_expr | star_expressions
+
augassign[AugOperator*]:
| '+=' { _PyPegen_augoperator(p, Add) }
| '-=' { _PyPegen_augoperator(p, Sub) }
@@ -121,20 +173,32 @@ augassign[AugOperator*]:
| '**=' { _PyPegen_augoperator(p, Pow) }
| '//=' { _PyPegen_augoperator(p, FloorDiv) }
+return_stmt[stmt_ty]:
+ | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }
+
+raise_stmt[stmt_ty]:
+ | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, EXTRA) }
+ | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }
+
global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {
_PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }
+
nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {
_PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, a)), EXTRA) }
-yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }
-
-assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
-
del_stmt[stmt_ty]:
| 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }
| invalid_del_stmt
+yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }
+
+assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _PyAST_Assert(a, b, EXTRA) }
+
import_stmt[stmt_ty]: import_name | import_from
+
+# Import statements
+# -----------------
+
import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, EXTRA) }
# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
import_from[stmt_ty]:
@@ -163,6 +227,123 @@ dotted_name[expr_ty]:
| a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }
| NAME
+# COMPOUND STATEMENTS
+# ===================
+
+# Common elements
+# ---------------
+
+block[asdl_stmt_seq*] (memo):
+ | NEWLINE INDENT a=statements DEDENT { a }
+ | simple_stmts
+ | invalid_block
+
+decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE { f })+ { a }
+
+# Class definitions
+# -----------------
+
+class_def[stmt_ty]:
+ | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, b) }
+ | class_def_raw
+
+class_def_raw[stmt_ty]:
+ | invalid_class_def_raw
+ | 'class' a=NAME b=['(' z=[arguments] ')' { z }] &&':' c=block {
+ _PyAST_ClassDef(a->v.Name.id,
+ (b) ? ((expr_ty) b)->v.Call.args : NULL,
+ (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
+ c, NULL, EXTRA) }
+
+# Function definitions
+# --------------------
+
+function_def[stmt_ty]:
+ | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, d, f) }
+ | function_def_raw
+
+function_def_raw[stmt_ty]:
+ | invalid_def_raw
+ | 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
+ _PyAST_FunctionDef(n->v.Name.id,
+ (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
+ b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) }
+ | ASYNC 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
+ CHECK_VERSION(
+ stmt_ty,
+ 5,
+ "Async functions are",
+ _PyAST_AsyncFunctionDef(n->v.Name.id,
+ (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
+ b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA)
+ ) }
+
+# Function parameters
+# -------------------
+
+params[arguments_ty]:
+ | invalid_parameters
+ | parameters
+
+parameters[arguments_ty]:
+ | a=slash_no_default b[asdl_arg_seq*]=param_no_default* c=param_with_default* d=[star_etc] {
+ _PyPegen_make_arguments(p, a, NULL, b, c, d) }
+ | a=slash_with_default b=param_with_default* c=[star_etc] {
+ _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
+ | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] {
+ _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
+ | 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) }
+
+# Some duplication here because we can't write (',' | &')'),
+# which is because we don't support empty alternatives (yet).
+
+slash_no_default[asdl_arg_seq*]:
+ | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }
+ | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }
+slash_with_default[SlashWithDefault*]:
+ | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+ | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+
+star_etc[StarEtc*]:
+ | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
+ _PyPegen_star_etc(p, a, b, c) }
+ | '*' ',' b=param_maybe_default+ c=[kwds] {
+ _PyPegen_star_etc(p, NULL, b, c) }
+ | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }
+ | invalid_star_etc
+
+kwds[arg_ty]: '**' 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? { _PyAST_arg(a->v.Name.id, b, NULL, EXTRA) }
+annotation[expr_ty]: ':' a=expression { a }
+default[expr_ty]: '=' a=expression { a }
+
+# If statement
+# ------------
+
if_stmt[stmt_ty]:
| invalid_if_stmt
| 'if' a=named_expression ':' b=block c=elif_stmt {
@@ -177,10 +358,16 @@ else_block[asdl_stmt_seq*]:
| invalid_else_stmt
| 'else' &&':' b=block { b }
+# While statement
+# ---------------
+
while_stmt[stmt_ty]:
| invalid_while_stmt
| 'while' a=named_expression ':' b=block c=[else_block] { _PyAST_While(a, b, c, EXTRA) }
+# For statement
+# -------------
+
for_stmt[stmt_ty]:
| invalid_for_stmt
| 'for' t=star_targets 'in' ~ ex=star_expressions &&':' tc=[TYPE_COMMENT] b=block el=[else_block] {
@@ -189,6 +376,9 @@ for_stmt[stmt_ty]:
CHECK_VERSION(stmt_ty, 5, "Async for loops are", _PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }
| invalid_for_target
+# With statement
+# --------------
+
with_stmt[stmt_ty]:
| invalid_with_stmt_indent
| 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block {
@@ -206,10 +396,17 @@ with_item[withitem_ty]:
| invalid_with_item
| e=expression { _PyAST_withitem(e, NULL, p->arena) }
+# Try statement
+# -------------
+
try_stmt[stmt_ty]:
| invalid_try_stmt
| 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, EXTRA) }
| 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }
+
+# Except statement
+# ----------------
+
except_block[excepthandler_ty]:
| invalid_except_stmt_indent
| 'except' e=expression t=['as' z=NAME { z }] ':' b=block {
@@ -220,34 +417,44 @@ finally_block[asdl_stmt_seq*]:
| invalid_finally_stmt
| 'finally' &&':' a=block { a }
+# Match statement
+# ---------------
+
match_stmt[stmt_ty]:
| "match" subject=subject_expr ':' NEWLINE INDENT cases[asdl_match_case_seq*]=case_block+ DEDENT {
CHECK_VERSION(stmt_ty, 10, "Pattern matching is", _PyAST_Match(subject, cases, EXTRA)) }
| invalid_match_stmt
+
subject_expr[expr_ty]:
| value=star_named_expression ',' values=star_named_expressions? {
_PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, value, values)), Load, EXTRA) }
| named_expression
+
case_block[match_case_ty]:
| invalid_case_block
| "case" pattern=patterns guard=guard? ':' body=block {
_PyAST_match_case(pattern, guard, body, p->arena) }
+
guard[expr_ty]: 'if' guard=named_expression { guard }
patterns[pattern_ty]:
| patterns[asdl_pattern_seq*]=open_sequence_pattern {
_PyAST_MatchSequence(patterns, EXTRA) }
| pattern
+
pattern[pattern_ty]:
| as_pattern
| or_pattern
+
as_pattern[pattern_ty]:
| pattern=or_pattern 'as' target=pattern_capture_target {
_PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }
| invalid_as_pattern
+
or_pattern[pattern_ty]:
| patterns[asdl_pattern_seq*]='|'.closed_pattern+ {
asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : _PyAST_MatchOr(patterns, EXTRA) }
+
closed_pattern[pattern_ty]:
| literal_pattern
| capture_pattern
@@ -308,9 +515,11 @@ wildcard_pattern[pattern_ty]:
value_pattern[pattern_ty]:
| attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }
+
attr[expr_ty]:
| value=name_or_attr '.' attr=NAME {
_PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }
+
name_or_attr[expr_ty]:
| attr
| NAME
@@ -321,14 +530,18 @@ group_pattern[pattern_ty]:
sequence_pattern[pattern_ty]:
| '[' patterns=maybe_sequence_pattern? ']' { _PyAST_MatchSequence(patterns, EXTRA) }
| '(' patterns=open_sequence_pattern? ')' { _PyAST_MatchSequence(patterns, EXTRA) }
+
open_sequence_pattern[asdl_seq*]:
| pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {
_PyPegen_seq_insert_in_front(p, pattern, patterns) }
+
maybe_sequence_pattern[asdl_seq*]:
| patterns=','.maybe_star_pattern+ ','? { patterns }
+
maybe_star_pattern[pattern_ty]:
| star_pattern
| pattern
+
star_pattern[pattern_ty]:
| '*' target=pattern_capture_target {
_PyAST_MatchStar(target->v.Name.id, EXTRA) }
@@ -352,11 +565,14 @@ mapping_pattern[pattern_ty]:
CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
NULL,
EXTRA) }
+
items_pattern[asdl_seq*]:
| ','.key_value_pattern+
+
key_value_pattern[KeyPatternPair*]:
| key=(literal_expr | attr) ':' pattern=pattern {
_PyPegen_key_pattern_pair(p, key, pattern) }
+
double_star_pattern[expr_ty]:
| '**' target=pattern_capture_target { target }
@@ -381,137 +597,51 @@ class_pattern[pattern_ty]:
CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),
EXTRA) }
| invalid_class_pattern
+
positional_patterns[asdl_pattern_seq*]:
| args[asdl_pattern_seq*]=','.pattern+ { args }
+
keyword_patterns[asdl_seq*]:
| ','.keyword_pattern+
+
keyword_pattern[KeyPatternPair*]:
| arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, value) }
-return_stmt[stmt_ty]:
- | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }
-
-raise_stmt[stmt_ty]:
- | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, b, EXTRA) }
- | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }
-
-function_def[stmt_ty]:
- | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, d, f) }
- | function_def_raw
-
-function_def_raw[stmt_ty]:
- | invalid_def_raw
- | 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
- _PyAST_FunctionDef(n->v.Name.id,
- (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
- b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA) }
- | ASYNC 'def' n=NAME '(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[func_type_comment] b=block {
- CHECK_VERSION(
- stmt_ty,
- 5,
- "Async functions are",
- _PyAST_AsyncFunctionDef(n->v.Name.id,
- (params) ? params : CHECK(arguments_ty, _PyPegen_empty_arguments(p)),
- b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA)
- ) }
-func_type_comment[Token*]:
- | 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
+# EXPRESSIONS
+# -----------
-parameters[arguments_ty]:
- | a=slash_no_default b[asdl_arg_seq*]=param_no_default* c=param_with_default* d=[star_etc] {
- _PyPegen_make_arguments(p, a, NULL, b, c, d) }
- | a=slash_with_default b=param_with_default* c=[star_etc] {
- _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
- | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] {
- _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
- | 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) }
-
-# Some duplication here because we can't write (',' | &')'),
-# which is because we don't support empty alternatives (yet).
-#
-slash_no_default[asdl_arg_seq*]:
- | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }
- | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }
-slash_with_default[SlashWithDefault*]:
- | a=param_no_default* b=param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
- | a=param_no_default* b=param_with_default+ '/' &')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
-
-star_etc[StarEtc*]:
- | '*' a=param_no_default b=param_maybe_default* c=[kwds] {
- _PyPegen_star_etc(p, a, b, c) }
- | '*' ',' b=param_maybe_default+ c=[kwds] {
- _PyPegen_star_etc(p, NULL, b, c) }
- | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }
- | invalid_star_etc
-
-kwds[arg_ty]: '**' 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? { _PyAST_arg(a->v.Name.id, b, NULL, EXTRA) }
-
-annotation[expr_ty]: ':' a=expression { a }
-default[expr_ty]: '=' a=expression { a }
-
-decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression NEWLINE { f })+ { a }
+expressions[expr_ty]:
+ | a=expression b=(',' c=expression { c })+ [','] {
+ _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
+ | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
+ | expression
-class_def[stmt_ty]:
- | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, b) }
- | class_def_raw
-class_def_raw[stmt_ty]:
- | invalid_class_def_raw
- | 'class' a=NAME b=['(' z=[arguments] ')' { z }] &&':' c=block {
- _PyAST_ClassDef(a->v.Name.id,
- (b) ? ((expr_ty) b)->v.Call.args : NULL,
- (b) ? ((expr_ty) b)->v.Call.keywords : NULL,
- c, NULL, EXTRA) }
+expression[expr_ty] (memo):
+ | invalid_expression
+ | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
+ | disjunction
+ | lambdef
-block[asdl_stmt_seq*] (memo):
- | NEWLINE INDENT a=statements DEDENT { a }
- | simple_stmts
- | invalid_block
+yield_expr[expr_ty]:
+ | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
+ | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }
star_expressions[expr_ty]:
| a=star_expression b=(',' c=star_expression { c })+ [','] {
_PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
| a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
| star_expression
+
star_expression[expr_ty] (memo):
| '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
| expression
star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_named_expression+ [','] { a }
+
star_named_expression[expr_ty]:
| '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }
| named_expression
-
assigment_expression[expr_ty]:
| a=NAME ':=' ~ b=expression { _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), b, EXTRA) }
@@ -520,84 +650,27 @@ named_expression[expr_ty]:
| invalid_named_expression
| expression !':='
-annotated_rhs[expr_ty]: yield_expr | star_expressions
-
-expressions[expr_ty]:
- | a=expression b=(',' c=expression { c })+ [','] {
- _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Load, EXTRA) }
- | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_singleton_seq(p, a)), Load, EXTRA) }
- | expression
-expression[expr_ty] (memo):
- | invalid_expression
- | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) }
- | disjunction
- | lambdef
-
-lambdef[expr_ty]:
- | 'lambda' a=[lambda_params] ':' b=expression {
- _PyAST_Lambda((a) ? a : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), b, EXTRA) }
-
-lambda_params[arguments_ty]:
- | invalid_lambda_parameters
- | lambda_parameters
-
-# lambda_parameters etc. duplicates parameters but without annotations
-# or type comments, and if there's no comma after a parameter, we expect
-# a colon, not a close parenthesis. (For more, see parameters above.)
-#
-lambda_parameters[arguments_ty]:
- | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
- _PyPegen_make_arguments(p, a, NULL, b, c, d) }
- | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] {
- _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
- | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
- _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
- | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
- | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
-
-lambda_slash_no_default[asdl_arg_seq*]:
- | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }
- | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }
-lambda_slash_with_default[SlashWithDefault*]:
- | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
- | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
-
-lambda_star_etc[StarEtc*]:
- | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] {
- _PyPegen_star_etc(p, a, b, c) }
- | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {
- _PyPegen_star_etc(p, NULL, b, c) }
- | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }
- | invalid_lambda_star_etc
-
-lambda_kwds[arg_ty]: '**' a=lambda_param_no_default { a }
-
-lambda_param_no_default[arg_ty]:
- | a=lambda_param ',' { a }
- | a=lambda_param &':' { a }
-lambda_param_with_default[NameDefaultPair*]:
- | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
- | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
-lambda_param_maybe_default[NameDefaultPair*]:
- | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
- | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
-lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }
-
disjunction[expr_ty] (memo):
| a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(
Or,
CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
EXTRA) }
| conjunction
+
conjunction[expr_ty] (memo):
| a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(
And,
CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),
EXTRA) }
| inversion
+
inversion[expr_ty] (memo):
| 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }
| comparison
+
+# Comparisons operators
+# ---------------------
+
comparison[expr_ty]:
| a=bitwise_or b=compare_op_bitwise_or_pair+ {
_PyAST_Compare(
@@ -606,6 +679,7 @@ comparison[expr_ty]:
CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),
EXTRA) }
| bitwise_or
+
compare_op_bitwise_or_pair[CmpopExprPair*]:
| eq_bitwise_or
| noteq_bitwise_or
@@ -617,6 +691,7 @@ compare_op_bitwise_or_pair[CmpopExprPair*]:
| in_bitwise_or
| isnot_bitwise_or
| is_bitwise_or
+
eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Eq, a) }
noteq_bitwise_or[CmpopExprPair*]:
| (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }
@@ -629,24 +704,34 @@ in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, I
isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, IsNot, a) }
is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or { _PyPegen_cmpop_expr_pair(p, Is, a) }
+# Logical operators
+# -----------------
+
bitwise_or[expr_ty]:
| a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }
| bitwise_xor
+
bitwise_xor[expr_ty]:
| a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }
| bitwise_and
+
bitwise_and[expr_ty]:
| a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }
| shift_expr
+
shift_expr[expr_ty]:
| a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }
| a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }
| sum
+# Arithmetic operators
+# --------------------
+
sum[expr_ty]:
| a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }
| a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }
| term
+
term[expr_ty]:
| a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }
| a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }
@@ -654,17 +739,26 @@ term[expr_ty]:
| a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }
| a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, "The '@' operator is", _PyAST_BinOp(a, MatMult, b, EXTRA)) }
| factor
+
factor[expr_ty] (memo):
| '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }
| '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }
| '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }
| power
+
power[expr_ty]:
| a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }
| await_primary
+
+# Primary elements
+# ----------------
+
+# Primary elements are things like "obj.something.something", "obj[something]", "obj(something)", "obj" ...
+
await_primary[expr_ty] (memo):
| AWAIT a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
| primary
+
primary[expr_ty]:
| a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
| a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
@@ -679,9 +773,11 @@ primary[expr_ty]:
slices[expr_ty]:
| a=slice !',' { a }
| a[asdl_expr_seq*]=','.slice+ [','] { _PyAST_Tuple(a, Load, EXTRA) }
+
slice[expr_ty]:
| a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { _PyAST_Slice(a, b, c, EXTRA) }
| a=named_expression { a }
+
atom[expr_ty]:
| NAME
| 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }
@@ -694,25 +790,81 @@ atom[expr_ty]:
| &'{' (dict | set | dictcomp | setcomp)
| '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }
+group[expr_ty]:
+ | '(' a=(yield_expr | named_expression) ')' { a }
+ | invalid_group
+
+# Lambda functions
+# ----------------
+
+lambdef[expr_ty]:
+ | 'lambda' a=[lambda_params] ':' b=expression {
+ _PyAST_Lambda((a) ? a : CHECK(arguments_ty, _PyPegen_empty_arguments(p)), b, EXTRA) }
+
+lambda_params[arguments_ty]:
+ | invalid_lambda_parameters
+ | lambda_parameters
+
+# lambda_parameters etc. duplicates parameters but without annotations
+# or type comments, and if there's no comma after a parameter, we expect
+# a colon, not a close parenthesis. (For more, see parameters above.)
+#
+lambda_parameters[arguments_ty]:
+ | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* c=lambda_param_with_default* d=[lambda_star_etc] {
+ _PyPegen_make_arguments(p, a, NULL, b, c, d) }
+ | a=lambda_slash_with_default b=lambda_param_with_default* c=[lambda_star_etc] {
+ _PyPegen_make_arguments(p, NULL, a, NULL, b, c) }
+ | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* c=[lambda_star_etc] {
+ _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }
+ | a=lambda_param_with_default+ b=[lambda_star_etc] { _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}
+ | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }
+
+lambda_slash_no_default[asdl_arg_seq*]:
+ | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }
+ | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }
+
+lambda_slash_with_default[SlashWithDefault*]:
+ | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+ | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }
+
+lambda_star_etc[StarEtc*]:
+ | '*' a=lambda_param_no_default b=lambda_param_maybe_default* c=[lambda_kwds] {
+ _PyPegen_star_etc(p, a, b, c) }
+ | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {
+ _PyPegen_star_etc(p, NULL, b, c) }
+ | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }
+ | invalid_lambda_star_etc
+
+lambda_kwds[arg_ty]: '**' a=lambda_param_no_default { a }
+
+lambda_param_no_default[arg_ty]:
+ | a=lambda_param ',' { a }
+ | a=lambda_param &':' { a }
+lambda_param_with_default[NameDefaultPair*]:
+ | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
+ | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
+lambda_param_maybe_default[NameDefaultPair*]:
+ | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, NULL) }
+ | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, NULL) }
+lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, EXTRA) }
+
+# LITERALS
+# ========
+
strings[expr_ty] (memo): a=STRING+ { _PyPegen_concatenate_strings(p, a) }
+
list[expr_ty]:
| '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }
-listcomp[expr_ty]:
- | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, EXTRA) }
- | invalid_comprehension
+
tuple[expr_ty]:
| '(' a=[y=star_named_expression ',' z=[star_named_expressions] { _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {
_PyAST_Tuple(a, Load, EXTRA) }
-group[expr_ty]:
- | '(' a=(yield_expr | named_expression) ')' { a }
- | invalid_group
-genexp[expr_ty]:
- | '(' a=( assigment_expression | expression !':=') b=for_if_clauses ')' { _PyAST_GeneratorExp(a, b, EXTRA) }
- | invalid_comprehension
+
set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }
-setcomp[expr_ty]:
- | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, EXTRA) }
- | invalid_comprehension
+
+# Dicts
+# -----
+
dict[expr_ty]:
| '{' a=[double_starred_kvpairs] '}' {
_PyAST_Dict(
@@ -721,16 +873,20 @@ dict[expr_ty]:
EXTRA) }
| '{' invalid_double_starred_kvpairs '}'
-dictcomp[expr_ty]:
- | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, b, EXTRA) }
- | invalid_dict_comprehension
double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }
+
double_starred_kvpair[KeyValuePair*]:
| '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }
| kvpair
+
kvpair[KeyValuePair*]: a=expression ':' b=expression { _PyPegen_key_value_pair(p, a, b) }
+
+# Comprehensions & Generators
+# ---------------------------
+
for_if_clauses[asdl_comprehension_seq*]:
| a[asdl_comprehension_seq*]=for_if_clause+ { a }
+
for_if_clause[comprehension_ty]:
| ASYNC 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' z=disjunction { z })* {
CHECK_VERSION(comprehension_ty, 6, "Async comprehensions are", _PyAST_comprehension(a, b, c, 1, p->arena)) }
@@ -738,13 +894,29 @@ for_if_clause[comprehension_ty]:
_PyAST_comprehension(a, b, c, 0, p->arena) }
| invalid_for_target
-yield_expr[expr_ty]:
- | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }
- | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }
+listcomp[expr_ty]:
+ | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, EXTRA) }
+ | invalid_comprehension
+
+setcomp[expr_ty]:
+ | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, EXTRA) }
+ | invalid_comprehension
+
+genexp[expr_ty]:
+ | '(' a=( assigment_expression | expression !':=') b=for_if_clauses ')' { _PyAST_GeneratorExp(a, b, EXTRA) }
+ | invalid_comprehension
+
+dictcomp[expr_ty]:
+ | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, b, EXTRA) }
+ | invalid_dict_comprehension
+
+# FUNCTION CALL ARGUMENTS
+# =======================
arguments[expr_ty] (memo):
| a=args [','] &')' { a }
| invalid_arguments
+
args[expr_ty]:
| a[asdl_expr_seq*]=','.(starred_expression | ( assigment_expression | expression !':=') !'=')+ b=[',' k=kwargs {k}] {
_PyPegen_collect_call_seqs(p, a, b, EXTRA) }
@@ -757,36 +929,50 @@ kwargs[asdl_seq*]:
| a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ { _PyPegen_join_sequences(p, a, b) }
| ','.kwarg_or_starred+
| ','.kwarg_or_double_starred+
+
starred_expression[expr_ty]:
| '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }
+
kwarg_or_starred[KeywordOrStarred*]:
| invalid_kwarg
| a=NAME '=' b=expression {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
| a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }
+
kwarg_or_double_starred[KeywordOrStarred*]:
| invalid_kwarg
| a=NAME '=' b=expression {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
| '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(NULL, a, EXTRA)), 1) }
+# ASSIGNMENT TARGETS
+# ==================
+
+# Generic targets
+# ---------------
+
# NOTE: star_targets may contain *bitwise_or, targets may not.
star_targets[expr_ty]:
| a=star_target !',' { a }
| a=star_target b=(',' c=star_target { c })* [','] {
_PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)), Store, EXTRA) }
+
star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ [','] { a }
+
star_targets_tuple_seq[asdl_expr_seq*]:
| a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) _PyPegen_seq_insert_in_front(p, a, b) }
| a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }
+
star_target[expr_ty] (memo):
| '*' a=(!'*' star_target) {
_PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, Store)), Store, EXTRA) }
| target_with_star_atom
+
target_with_star_atom[expr_ty] (memo):
| a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
| a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }
| star_atom
+
star_atom[expr_ty]:
| a=NAME { _PyPegen_set_expr_context(p, a, Store) }
| '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, Store) }
@@ -797,21 +983,11 @@ single_target[expr_ty]:
| single_subscript_attribute_target
| a=NAME { _PyPegen_set_expr_context(p, a, Store) }
| '(' a=single_target ')' { a }
+
single_subscript_attribute_target[expr_ty]:
| a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Store, EXTRA) }
| a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Store, EXTRA) }
-del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }
-del_target[expr_ty] (memo):
- | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Del, EXTRA) }
- | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, EXTRA) }
- | del_t_atom
-del_t_atom[expr_ty]:
- | a=NAME { _PyPegen_set_expr_context(p, a, Del) }
- | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
- | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }
- | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }
-
t_primary[expr_ty]:
| a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
| a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, Load, EXTRA) }
@@ -823,8 +999,57 @@ t_primary[expr_ty]:
(b) ? ((expr_ty) b)->v.Call.keywords : NULL,
EXTRA) }
| a=atom &t_lookahead { a }
+
t_lookahead: '(' | '[' | '.'
+# Targets for del statements
+# --------------------------
+
+del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }
+
+del_target[expr_ty] (memo):
+ | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name.id, Del, EXTRA) }
+ | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, Del, EXTRA) }
+ | del_t_atom
+
+del_t_atom[expr_ty]:
+ | a=NAME { _PyPegen_set_expr_context(p, a, Del) }
+ | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
+ | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }
+ | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }
+
+# TYPING ELEMENTS
+# ---------------
+
+# type_expressions allow */** but ignore them
+type_expressions[asdl_expr_seq*]:
+ | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {
+ (asdl_expr_seq*)_PyPegen_seq_append_to_end(
+ p,
+ CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),
+ c) }
+ | a=','.expression+ ',' '*' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
+ | a=','.expression+ ',' '**' b=expression { (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }
+ | '*' a=expression ',' '**' b=expression {
+ (asdl_expr_seq*)_PyPegen_seq_append_to_end(
+ p,
+ CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),
+ b) }
+ | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+ | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }
+ | a[asdl_expr_seq*]=','.expression+ {a}
+
+func_type_comment[Token*]:
+ | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by indented block
+ | invalid_double_type_comments
+ | TYPE_COMMENT
+
+# ========================= END OF THE GRAMMAR ===========================
+
+
+
+# ========================= START OF INVALID RULES =======================
+
# From here on, there are rules for invalid syntax with specialised error messages
invalid_arguments:
| a=args ',' '*' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable argument unpacking follows keyword argument unpacking") }
diff --git a/Parser/parser.c b/Parser/parser.c
index d01d2b8..c05fc31 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -12,29 +12,29 @@ static KeywordToken *reserved_keywords[] = {
(KeywordToken[]) {{NULL, -1}},
(KeywordToken[]) {
{"if", 510},
- {"in", 518},
- {"as", 520},
- {"is", 530},
+ {"in", 520},
+ {"as", 522},
+ {"is", 529},
{"or", 531},
{NULL, -1},
},
(KeywordToken[]) {
{"del", 503},
{"try", 511},
- {"for", 517},
- {"def", 526},
- {"not", 529},
+ {"def", 516},
+ {"for", 519},
+ {"not", 528},
{"and", 532},
{NULL, -1},
},
(KeywordToken[]) {
{"pass", 502},
{"from", 514},
- {"elif", 515},
- {"else", 516},
- {"with", 519},
- {"None", 523},
- {"True", 524},
+ {"elif", 517},
+ {"else", 518},
+ {"with", 521},
+ {"None", 525},
+ {"True", 526},
{NULL, -1},
},
(KeywordToken[]) {
@@ -42,8 +42,8 @@ static KeywordToken *reserved_keywords[] = {
{"yield", 504},
{"break", 506},
{"while", 512},
- {"False", 525},
- {"class", 527},
+ {"class", 515},
+ {"False", 527},
{NULL, -1},
},
(KeywordToken[]) {
@@ -51,12 +51,12 @@ static KeywordToken *reserved_keywords[] = {
{"assert", 505},
{"global", 508},
{"import", 513},
- {"except", 521},
- {"lambda", 528},
+ {"except", 523},
+ {"lambda", 530},
{NULL, -1},
},
(KeywordToken[]) {
- {"finally", 522},
+ {"finally", 524},
{NULL, -1},
},
(KeywordToken[]) {
@@ -76,179 +76,179 @@ static char *soft_keywords[] = {
#define eval_type 1002
#define func_type_type 1003
#define fstring_type 1004
-#define type_expressions_type 1005
-#define statements_type 1006
-#define statement_type 1007
-#define statement_newline_type 1008
-#define simple_stmts_type 1009
-#define simple_stmt_type 1010
-#define compound_stmt_type 1011
-#define assignment_type 1012
+#define statements_type 1005
+#define statement_type 1006
+#define statement_newline_type 1007
+#define simple_stmts_type 1008
+#define simple_stmt_type 1009
+#define compound_stmt_type 1010
+#define assignment_type 1011
+#define annotated_rhs_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 return_stmt_type 1014
+#define raise_stmt_type 1015
+#define global_stmt_type 1016
+#define nonlocal_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 match_stmt_type 1038
-#define subject_expr_type 1039
-#define case_block_type 1040
-#define guard_type 1041
-#define patterns_type 1042
-#define pattern_type 1043
-#define as_pattern_type 1044
-#define or_pattern_type 1045
-#define closed_pattern_type 1046
-#define literal_pattern_type 1047
-#define literal_expr_type 1048
-#define complex_number_type 1049
-#define signed_number_type 1050
-#define signed_real_number_type 1051
-#define real_number_type 1052
-#define imaginary_number_type 1053
-#define capture_pattern_type 1054
-#define pattern_capture_target_type 1055
-#define wildcard_pattern_type 1056
-#define value_pattern_type 1057
-#define attr_type 1058 // Left-recursive
-#define name_or_attr_type 1059 // Left-recursive
-#define group_pattern_type 1060
-#define sequence_pattern_type 1061
-#define open_sequence_pattern_type 1062
-#define maybe_sequence_pattern_type 1063
-#define maybe_star_pattern_type 1064
-#define star_pattern_type 1065
-#define mapping_pattern_type 1066
-#define items_pattern_type 1067
-#define key_value_pattern_type 1068
-#define double_star_pattern_type 1069
-#define class_pattern_type 1070
-#define positional_patterns_type 1071
-#define keyword_patterns_type 1072
-#define keyword_pattern_type 1073
-#define return_stmt_type 1074
-#define raise_stmt_type 1075
-#define function_def_type 1076
-#define function_def_raw_type 1077
-#define func_type_comment_type 1078
-#define params_type 1079
-#define parameters_type 1080
-#define slash_no_default_type 1081
-#define slash_with_default_type 1082
-#define star_etc_type 1083
-#define kwds_type 1084
-#define param_no_default_type 1085
-#define param_with_default_type 1086
-#define param_maybe_default_type 1087
-#define param_type 1088
-#define annotation_type 1089
-#define default_type 1090
-#define decorators_type 1091
-#define class_def_type 1092
-#define class_def_raw_type 1093
-#define block_type 1094
-#define star_expressions_type 1095
-#define star_expression_type 1096
-#define star_named_expressions_type 1097
-#define star_named_expression_type 1098
-#define assigment_expression_type 1099
-#define named_expression_type 1100
-#define annotated_rhs_type 1101
-#define expressions_type 1102
-#define expression_type 1103
-#define lambdef_type 1104
-#define lambda_params_type 1105
-#define lambda_parameters_type 1106
-#define lambda_slash_no_default_type 1107
-#define lambda_slash_with_default_type 1108
-#define lambda_star_etc_type 1109
-#define lambda_kwds_type 1110
-#define lambda_param_no_default_type 1111
-#define lambda_param_with_default_type 1112
-#define lambda_param_maybe_default_type 1113
-#define lambda_param_type 1114
-#define disjunction_type 1115
-#define conjunction_type 1116
-#define inversion_type 1117
-#define comparison_type 1118
-#define compare_op_bitwise_or_pair_type 1119
-#define eq_bitwise_or_type 1120
-#define noteq_bitwise_or_type 1121
-#define lte_bitwise_or_type 1122
-#define lt_bitwise_or_type 1123
-#define gte_bitwise_or_type 1124
-#define gt_bitwise_or_type 1125
-#define notin_bitwise_or_type 1126
-#define in_bitwise_or_type 1127
-#define isnot_bitwise_or_type 1128
-#define is_bitwise_or_type 1129
-#define bitwise_or_type 1130 // Left-recursive
-#define bitwise_xor_type 1131 // Left-recursive
-#define bitwise_and_type 1132 // Left-recursive
-#define shift_expr_type 1133 // Left-recursive
-#define sum_type 1134 // Left-recursive
-#define term_type 1135 // Left-recursive
-#define factor_type 1136
-#define power_type 1137
-#define await_primary_type 1138
-#define primary_type 1139 // Left-recursive
-#define slices_type 1140
-#define slice_type 1141
-#define atom_type 1142
+#define yield_stmt_type 1019
+#define assert_stmt_type 1020
+#define import_stmt_type 1021
+#define import_name_type 1022
+#define import_from_type 1023
+#define import_from_targets_type 1024
+#define import_from_as_names_type 1025
+#define import_from_as_name_type 1026
+#define dotted_as_names_type 1027
+#define dotted_as_name_type 1028
+#define dotted_name_type 1029 // Left-recursive
+#define block_type 1030
+#define decorators_type 1031
+#define class_def_type 1032
+#define class_def_raw_type 1033
+#define function_def_type 1034
+#define function_def_raw_type 1035
+#define params_type 1036
+#define parameters_type 1037
+#define slash_no_default_type 1038
+#define slash_with_default_type 1039
+#define star_etc_type 1040
+#define kwds_type 1041
+#define param_no_default_type 1042
+#define param_with_default_type 1043
+#define param_maybe_default_type 1044
+#define param_type 1045
+#define annotation_type 1046
+#define default_type 1047
+#define if_stmt_type 1048
+#define elif_stmt_type 1049
+#define else_block_type 1050
+#define while_stmt_type 1051
+#define for_stmt_type 1052
+#define with_stmt_type 1053
+#define with_item_type 1054
+#define try_stmt_type 1055
+#define except_block_type 1056
+#define finally_block_type 1057
+#define match_stmt_type 1058
+#define subject_expr_type 1059
+#define case_block_type 1060
+#define guard_type 1061
+#define patterns_type 1062
+#define pattern_type 1063
+#define as_pattern_type 1064
+#define or_pattern_type 1065
+#define closed_pattern_type 1066
+#define literal_pattern_type 1067
+#define literal_expr_type 1068
+#define complex_number_type 1069
+#define signed_number_type 1070
+#define signed_real_number_type 1071
+#define real_number_type 1072
+#define imaginary_number_type 1073
+#define capture_pattern_type 1074
+#define pattern_capture_target_type 1075
+#define wildcard_pattern_type 1076
+#define value_pattern_type 1077
+#define attr_type 1078 // Left-recursive
+#define name_or_attr_type 1079 // Left-recursive
+#define group_pattern_type 1080
+#define sequence_pattern_type 1081
+#define open_sequence_pattern_type 1082
+#define maybe_sequence_pattern_type 1083
+#define maybe_star_pattern_type 1084
+#define star_pattern_type 1085
+#define mapping_pattern_type 1086
+#define items_pattern_type 1087
+#define key_value_pattern_type 1088
+#define double_star_pattern_type 1089
+#define class_pattern_type 1090
+#define positional_patterns_type 1091
+#define keyword_patterns_type 1092
+#define keyword_pattern_type 1093
+#define expressions_type 1094
+#define expression_type 1095
+#define yield_expr_type 1096
+#define star_expressions_type 1097
+#define star_expression_type 1098
+#define star_named_expressions_type 1099
+#define star_named_expression_type 1100
+#define assigment_expression_type 1101
+#define named_expression_type 1102
+#define disjunction_type 1103
+#define conjunction_type 1104
+#define inversion_type 1105
+#define comparison_type 1106
+#define compare_op_bitwise_or_pair_type 1107
+#define eq_bitwise_or_type 1108
+#define noteq_bitwise_or_type 1109
+#define lte_bitwise_or_type 1110
+#define lt_bitwise_or_type 1111
+#define gte_bitwise_or_type 1112
+#define gt_bitwise_or_type 1113
+#define notin_bitwise_or_type 1114
+#define in_bitwise_or_type 1115
+#define isnot_bitwise_or_type 1116
+#define is_bitwise_or_type 1117
+#define bitwise_or_type 1118 // Left-recursive
+#define bitwise_xor_type 1119 // Left-recursive
+#define bitwise_and_type 1120 // Left-recursive
+#define shift_expr_type 1121 // Left-recursive
+#define sum_type 1122 // Left-recursive
+#define term_type 1123 // Left-recursive
+#define factor_type 1124
+#define power_type 1125
+#define await_primary_type 1126
+#define primary_type 1127 // Left-recursive
+#define slices_type 1128
+#define slice_type 1129
+#define atom_type 1130
+#define group_type 1131
+#define lambdef_type 1132
+#define lambda_params_type 1133
+#define lambda_parameters_type 1134
+#define lambda_slash_no_default_type 1135
+#define lambda_slash_with_default_type 1136
+#define lambda_star_etc_type 1137
+#define lambda_kwds_type 1138
+#define lambda_param_no_default_type 1139
+#define lambda_param_with_default_type 1140
+#define lambda_param_maybe_default_type 1141
+#define lambda_param_type 1142
#define strings_type 1143
#define list_type 1144
-#define listcomp_type 1145
-#define tuple_type 1146
-#define group_type 1147
-#define genexp_type 1148
-#define set_type 1149
-#define setcomp_type 1150
-#define dict_type 1151
-#define dictcomp_type 1152
-#define double_starred_kvpairs_type 1153
-#define double_starred_kvpair_type 1154
-#define kvpair_type 1155
-#define for_if_clauses_type 1156
-#define for_if_clause_type 1157
-#define yield_expr_type 1158
-#define arguments_type 1159
-#define args_type 1160
-#define kwargs_type 1161
-#define starred_expression_type 1162
-#define kwarg_or_starred_type 1163
-#define kwarg_or_double_starred_type 1164
-#define star_targets_type 1165
-#define star_targets_list_seq_type 1166
-#define star_targets_tuple_seq_type 1167
-#define star_target_type 1168
-#define target_with_star_atom_type 1169
-#define star_atom_type 1170
-#define single_target_type 1171
-#define single_subscript_attribute_target_type 1172
+#define tuple_type 1145
+#define set_type 1146
+#define dict_type 1147
+#define double_starred_kvpairs_type 1148
+#define double_starred_kvpair_type 1149
+#define kvpair_type 1150
+#define for_if_clauses_type 1151
+#define for_if_clause_type 1152
+#define listcomp_type 1153
+#define setcomp_type 1154
+#define genexp_type 1155
+#define dictcomp_type 1156
+#define arguments_type 1157
+#define args_type 1158
+#define kwargs_type 1159
+#define starred_expression_type 1160
+#define kwarg_or_starred_type 1161
+#define kwarg_or_double_starred_type 1162
+#define star_targets_type 1163
+#define star_targets_list_seq_type 1164
+#define star_targets_tuple_seq_type 1165
+#define star_target_type 1166
+#define target_with_star_atom_type 1167
+#define star_atom_type 1168
+#define single_target_type 1169
+#define single_subscript_attribute_target_type 1170
+#define t_primary_type 1171 // Left-recursive
+#define t_lookahead_type 1172
#define del_targets_type 1173
#define del_target_type 1174
#define del_t_atom_type 1175
-#define t_primary_type 1176 // Left-recursive
-#define t_lookahead_type 1177
+#define type_expressions_type 1176
+#define func_type_comment_type 1177
#define invalid_arguments_type 1178
#define invalid_kwarg_type 1179
#define expression_without_invalid_type 1180
@@ -294,144 +294,144 @@ static char *soft_keywords[] = {
#define invalid_kvpair_type 1220
#define _loop0_1_type 1221
#define _loop0_2_type 1222
-#define _loop0_4_type 1223
-#define _gather_3_type 1224
-#define _loop0_6_type 1225
-#define _gather_5_type 1226
-#define _loop0_8_type 1227
-#define _gather_7_type 1228
-#define _loop0_10_type 1229
-#define _gather_9_type 1230
-#define _loop1_11_type 1231
-#define _loop0_13_type 1232
-#define _gather_12_type 1233
-#define _tmp_14_type 1234
+#define _loop1_3_type 1223
+#define _loop0_5_type 1224
+#define _gather_4_type 1225
+#define _tmp_6_type 1226
+#define _tmp_7_type 1227
+#define _tmp_8_type 1228
+#define _tmp_9_type 1229
+#define _tmp_10_type 1230
+#define _tmp_11_type 1231
+#define _tmp_12_type 1232
+#define _tmp_13_type 1233
+#define _loop1_14_type 1234
#define _tmp_15_type 1235
#define _tmp_16_type 1236
#define _tmp_17_type 1237
-#define _tmp_18_type 1238
-#define _tmp_19_type 1239
-#define _tmp_20_type 1240
-#define _tmp_21_type 1241
-#define _loop1_22_type 1242
+#define _loop0_19_type 1238
+#define _gather_18_type 1239
+#define _loop0_21_type 1240
+#define _gather_20_type 1241
+#define _tmp_22_type 1242
#define _tmp_23_type 1243
-#define _tmp_24_type 1244
-#define _loop0_26_type 1245
-#define _gather_25_type 1246
-#define _loop0_28_type 1247
-#define _gather_27_type 1248
-#define _tmp_29_type 1249
-#define _tmp_30_type 1250
-#define _loop0_31_type 1251
+#define _loop0_24_type 1244
+#define _loop1_25_type 1245
+#define _loop0_27_type 1246
+#define _gather_26_type 1247
+#define _tmp_28_type 1248
+#define _loop0_30_type 1249
+#define _gather_29_type 1250
+#define _tmp_31_type 1251
#define _loop1_32_type 1252
-#define _loop0_34_type 1253
-#define _gather_33_type 1254
+#define _tmp_33_type 1253
+#define _tmp_34_type 1254
#define _tmp_35_type 1255
-#define _loop0_37_type 1256
-#define _gather_36_type 1257
-#define _tmp_38_type 1258
-#define _loop0_40_type 1259
-#define _gather_39_type 1260
-#define _loop0_42_type 1261
-#define _gather_41_type 1262
-#define _loop0_44_type 1263
-#define _gather_43_type 1264
-#define _loop0_46_type 1265
-#define _gather_45_type 1266
-#define _tmp_47_type 1267
-#define _loop1_48_type 1268
-#define _tmp_49_type 1269
-#define _loop1_50_type 1270
-#define _loop0_52_type 1271
-#define _gather_51_type 1272
-#define _tmp_53_type 1273
-#define _tmp_54_type 1274
-#define _tmp_55_type 1275
-#define _tmp_56_type 1276
-#define _loop0_58_type 1277
-#define _gather_57_type 1278
-#define _loop0_60_type 1279
-#define _gather_59_type 1280
-#define _tmp_61_type 1281
+#define _loop0_36_type 1256
+#define _loop0_37_type 1257
+#define _loop0_38_type 1258
+#define _loop1_39_type 1259
+#define _loop0_40_type 1260
+#define _loop1_41_type 1261
+#define _loop1_42_type 1262
+#define _loop1_43_type 1263
+#define _loop0_44_type 1264
+#define _loop1_45_type 1265
+#define _loop0_46_type 1266
+#define _loop1_47_type 1267
+#define _loop0_48_type 1268
+#define _loop1_49_type 1269
+#define _loop0_51_type 1270
+#define _gather_50_type 1271
+#define _loop0_53_type 1272
+#define _gather_52_type 1273
+#define _loop0_55_type 1274
+#define _gather_54_type 1275
+#define _loop0_57_type 1276
+#define _gather_56_type 1277
+#define _tmp_58_type 1278
+#define _loop1_59_type 1279
+#define _tmp_60_type 1280
+#define _loop1_61_type 1281
#define _loop0_63_type 1282
#define _gather_62_type 1283
-#define _loop0_65_type 1284
-#define _gather_64_type 1285
+#define _tmp_64_type 1284
+#define _tmp_65_type 1285
#define _tmp_66_type 1286
#define _tmp_67_type 1287
-#define _tmp_68_type 1288
-#define _tmp_69_type 1289
-#define _loop0_70_type 1290
-#define _loop0_71_type 1291
-#define _loop0_72_type 1292
-#define _loop1_73_type 1293
-#define _loop0_74_type 1294
-#define _loop1_75_type 1295
-#define _loop1_76_type 1296
+#define _loop0_69_type 1288
+#define _gather_68_type 1289
+#define _loop0_71_type 1290
+#define _gather_70_type 1291
+#define _tmp_72_type 1292
+#define _loop0_74_type 1293
+#define _gather_73_type 1294
+#define _loop0_76_type 1295
+#define _gather_75_type 1296
#define _loop1_77_type 1297
-#define _loop0_78_type 1298
-#define _loop1_79_type 1299
-#define _loop0_80_type 1300
+#define _loop1_78_type 1298
+#define _loop0_80_type 1299
+#define _gather_79_type 1300
#define _loop1_81_type 1301
-#define _loop0_82_type 1302
+#define _loop1_82_type 1302
#define _loop1_83_type 1303
-#define _loop1_84_type 1304
-#define _tmp_85_type 1305
-#define _loop1_86_type 1306
-#define _loop0_88_type 1307
-#define _gather_87_type 1308
-#define _loop1_89_type 1309
-#define _loop0_90_type 1310
-#define _loop0_91_type 1311
+#define _tmp_84_type 1304
+#define _loop0_86_type 1305
+#define _gather_85_type 1306
+#define _tmp_87_type 1307
+#define _tmp_88_type 1308
+#define _tmp_89_type 1309
+#define _tmp_90_type 1310
+#define _tmp_91_type 1311
#define _loop0_92_type 1312
-#define _loop1_93_type 1313
+#define _loop0_93_type 1313
#define _loop0_94_type 1314
#define _loop1_95_type 1315
-#define _loop1_96_type 1316
+#define _loop0_96_type 1316
#define _loop1_97_type 1317
-#define _loop0_98_type 1318
+#define _loop1_98_type 1318
#define _loop1_99_type 1319
#define _loop0_100_type 1320
#define _loop1_101_type 1321
#define _loop0_102_type 1322
#define _loop1_103_type 1323
-#define _loop1_104_type 1324
+#define _loop0_104_type 1324
#define _loop1_105_type 1325
#define _loop1_106_type 1326
#define _tmp_107_type 1327
#define _loop0_109_type 1328
#define _gather_108_type 1329
-#define _tmp_110_type 1330
-#define _tmp_111_type 1331
-#define _tmp_112_type 1332
+#define _loop1_110_type 1330
+#define _loop0_111_type 1331
+#define _loop0_112_type 1332
#define _tmp_113_type 1333
-#define _loop1_114_type 1334
-#define _tmp_115_type 1335
+#define _loop0_115_type 1334
+#define _gather_114_type 1335
#define _tmp_116_type 1336
-#define _tmp_117_type 1337
-#define _loop0_119_type 1338
-#define _gather_118_type 1339
-#define _loop1_120_type 1340
-#define _loop0_121_type 1341
-#define _loop0_122_type 1342
+#define _loop0_118_type 1337
+#define _gather_117_type 1338
+#define _loop0_120_type 1339
+#define _gather_119_type 1340
+#define _loop0_122_type 1341
+#define _gather_121_type 1342
#define _loop0_124_type 1343
#define _gather_123_type 1344
-#define _tmp_125_type 1345
+#define _loop0_125_type 1345
#define _loop0_127_type 1346
#define _gather_126_type 1347
-#define _loop0_129_type 1348
-#define _gather_128_type 1349
+#define _loop1_128_type 1348
+#define _tmp_129_type 1349
#define _loop0_131_type 1350
#define _gather_130_type 1351
#define _loop0_133_type 1352
#define _gather_132_type 1353
-#define _loop0_134_type 1354
-#define _loop0_136_type 1355
-#define _gather_135_type 1356
-#define _loop1_137_type 1357
-#define _tmp_138_type 1358
-#define _loop0_140_type 1359
-#define _gather_139_type 1360
+#define _loop0_135_type 1354
+#define _gather_134_type 1355
+#define _loop0_137_type 1356
+#define _gather_136_type 1357
+#define _loop0_139_type 1358
+#define _gather_138_type 1359
+#define _tmp_140_type 1360
#define _tmp_141_type 1361
#define _tmp_142_type 1362
#define _tmp_143_type 1363
@@ -502,7 +502,6 @@ 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_expr_seq* type_expressions_rule(Parser *p);
static asdl_stmt_seq* statements_rule(Parser *p);
static asdl_stmt_seq* statement_rule(Parser *p);
static asdl_stmt_seq* statement_newline_rule(Parser *p);
@@ -510,12 +509,15 @@ static asdl_stmt_seq* simple_stmts_rule(Parser *p);
static stmt_ty simple_stmt_rule(Parser *p);
static stmt_ty compound_stmt_rule(Parser *p);
static stmt_ty assignment_rule(Parser *p);
+static expr_ty annotated_rhs_rule(Parser *p);
static AugOperator* augassign_rule(Parser *p);
+static stmt_ty return_stmt_rule(Parser *p);
+static stmt_ty raise_stmt_rule(Parser *p);
static stmt_ty global_stmt_rule(Parser *p);
static stmt_ty nonlocal_stmt_rule(Parser *p);
+static stmt_ty del_stmt_rule(Parser *p);
static stmt_ty yield_stmt_rule(Parser *p);
static stmt_ty assert_stmt_rule(Parser *p);
-static stmt_ty del_stmt_rule(Parser *p);
static stmt_ty import_stmt_rule(Parser *p);
static stmt_ty import_name_rule(Parser *p);
static stmt_ty import_from_rule(Parser *p);
@@ -525,6 +527,24 @@ static alias_ty import_from_as_name_rule(Parser *p);
static asdl_alias_seq* dotted_as_names_rule(Parser *p);
static alias_ty dotted_as_name_rule(Parser *p);
static expr_ty dotted_name_rule(Parser *p);
+static asdl_stmt_seq* block_rule(Parser *p);
+static asdl_expr_seq* decorators_rule(Parser *p);
+static stmt_ty class_def_rule(Parser *p);
+static stmt_ty class_def_raw_rule(Parser *p);
+static stmt_ty function_def_rule(Parser *p);
+static stmt_ty function_def_raw_rule(Parser *p);
+static arguments_ty params_rule(Parser *p);
+static arguments_ty parameters_rule(Parser *p);
+static asdl_arg_seq* slash_no_default_rule(Parser *p);
+static SlashWithDefault* slash_with_default_rule(Parser *p);
+static StarEtc* star_etc_rule(Parser *p);
+static arg_ty kwds_rule(Parser *p);
+static arg_ty param_no_default_rule(Parser *p);
+static NameDefaultPair* param_with_default_rule(Parser *p);
+static NameDefaultPair* param_maybe_default_rule(Parser *p);
+static arg_ty param_rule(Parser *p);
+static expr_ty annotation_rule(Parser *p);
+static expr_ty default_rule(Parser *p);
static stmt_ty if_stmt_rule(Parser *p);
static stmt_ty elif_stmt_rule(Parser *p);
static asdl_stmt_seq* else_block_rule(Parser *p);
@@ -571,47 +591,15 @@ static pattern_ty class_pattern_rule(Parser *p);
static asdl_pattern_seq* positional_patterns_rule(Parser *p);
static asdl_seq* keyword_patterns_rule(Parser *p);
static KeyPatternPair* keyword_pattern_rule(Parser *p);
-static stmt_ty return_stmt_rule(Parser *p);
-static stmt_ty raise_stmt_rule(Parser *p);
-static stmt_ty function_def_rule(Parser *p);
-static stmt_ty function_def_raw_rule(Parser *p);
-static Token* func_type_comment_rule(Parser *p);
-static arguments_ty params_rule(Parser *p);
-static arguments_ty parameters_rule(Parser *p);
-static asdl_arg_seq* slash_no_default_rule(Parser *p);
-static SlashWithDefault* slash_with_default_rule(Parser *p);
-static StarEtc* star_etc_rule(Parser *p);
-static arg_ty kwds_rule(Parser *p);
-static arg_ty param_no_default_rule(Parser *p);
-static NameDefaultPair* param_with_default_rule(Parser *p);
-static NameDefaultPair* param_maybe_default_rule(Parser *p);
-static arg_ty param_rule(Parser *p);
-static expr_ty annotation_rule(Parser *p);
-static expr_ty default_rule(Parser *p);
-static asdl_expr_seq* decorators_rule(Parser *p);
-static stmt_ty class_def_rule(Parser *p);
-static stmt_ty class_def_raw_rule(Parser *p);
-static asdl_stmt_seq* block_rule(Parser *p);
+static expr_ty expressions_rule(Parser *p);
+static expr_ty expression_rule(Parser *p);
+static expr_ty yield_expr_rule(Parser *p);
static expr_ty star_expressions_rule(Parser *p);
static expr_ty star_expression_rule(Parser *p);
static asdl_expr_seq* star_named_expressions_rule(Parser *p);
static expr_ty star_named_expression_rule(Parser *p);
static expr_ty assigment_expression_rule(Parser *p);
static expr_ty named_expression_rule(Parser *p);
-static expr_ty annotated_rhs_rule(Parser *p);
-static expr_ty expressions_rule(Parser *p);
-static expr_ty expression_rule(Parser *p);
-static expr_ty lambdef_rule(Parser *p);
-static arguments_ty lambda_params_rule(Parser *p);
-static arguments_ty lambda_parameters_rule(Parser *p);
-static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
-static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
-static StarEtc* lambda_star_etc_rule(Parser *p);
-static arg_ty lambda_kwds_rule(Parser *p);
-static arg_ty lambda_param_no_default_rule(Parser *p);
-static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
-static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
-static arg_ty lambda_param_rule(Parser *p);
static expr_ty disjunction_rule(Parser *p);
static expr_ty conjunction_rule(Parser *p);
static expr_ty inversion_rule(Parser *p);
@@ -640,22 +628,32 @@ static expr_ty primary_rule(Parser *p);
static expr_ty slices_rule(Parser *p);
static expr_ty slice_rule(Parser *p);
static expr_ty atom_rule(Parser *p);
+static expr_ty group_rule(Parser *p);
+static expr_ty lambdef_rule(Parser *p);
+static arguments_ty lambda_params_rule(Parser *p);
+static arguments_ty lambda_parameters_rule(Parser *p);
+static asdl_arg_seq* lambda_slash_no_default_rule(Parser *p);
+static SlashWithDefault* lambda_slash_with_default_rule(Parser *p);
+static StarEtc* lambda_star_etc_rule(Parser *p);
+static arg_ty lambda_kwds_rule(Parser *p);
+static arg_ty lambda_param_no_default_rule(Parser *p);
+static NameDefaultPair* lambda_param_with_default_rule(Parser *p);
+static NameDefaultPair* lambda_param_maybe_default_rule(Parser *p);
+static arg_ty lambda_param_rule(Parser *p);
static expr_ty strings_rule(Parser *p);
static expr_ty list_rule(Parser *p);
-static expr_ty listcomp_rule(Parser *p);
static expr_ty tuple_rule(Parser *p);
-static expr_ty group_rule(Parser *p);
-static expr_ty genexp_rule(Parser *p);
static expr_ty set_rule(Parser *p);
-static expr_ty setcomp_rule(Parser *p);
static expr_ty dict_rule(Parser *p);
-static expr_ty dictcomp_rule(Parser *p);
static asdl_seq* double_starred_kvpairs_rule(Parser *p);
static KeyValuePair* double_starred_kvpair_rule(Parser *p);
static KeyValuePair* kvpair_rule(Parser *p);
static asdl_comprehension_seq* for_if_clauses_rule(Parser *p);
static comprehension_ty for_if_clause_rule(Parser *p);
-static expr_ty yield_expr_rule(Parser *p);
+static expr_ty listcomp_rule(Parser *p);
+static expr_ty setcomp_rule(Parser *p);
+static expr_ty genexp_rule(Parser *p);
+static expr_ty dictcomp_rule(Parser *p);
static expr_ty arguments_rule(Parser *p);
static expr_ty args_rule(Parser *p);
static asdl_seq* kwargs_rule(Parser *p);
@@ -670,11 +668,13 @@ static expr_ty target_with_star_atom_rule(Parser *p);
static expr_ty star_atom_rule(Parser *p);
static expr_ty single_target_rule(Parser *p);
static expr_ty single_subscript_attribute_target_rule(Parser *p);
+static expr_ty t_primary_rule(Parser *p);
+static void *t_lookahead_rule(Parser *p);
static asdl_expr_seq* del_targets_rule(Parser *p);
static expr_ty del_target_rule(Parser *p);
static expr_ty del_t_atom_rule(Parser *p);
-static expr_ty t_primary_rule(Parser *p);
-static void *t_lookahead_rule(Parser *p);
+static asdl_expr_seq* type_expressions_rule(Parser *p);
+static Token* func_type_comment_rule(Parser *p);
static void *invalid_arguments_rule(Parser *p);
static void *invalid_kwarg_rule(Parser *p);
static expr_ty expression_without_invalid_rule(Parser *p);
@@ -720,144 +720,144 @@ static void *invalid_double_starred_kvpairs_rule(Parser *p);
static void *invalid_kvpair_rule(Parser *p);
static asdl_seq *_loop0_1_rule(Parser *p);
static asdl_seq *_loop0_2_rule(Parser *p);
-static asdl_seq *_loop0_4_rule(Parser *p);
-static asdl_seq *_gather_3_rule(Parser *p);
-static asdl_seq *_loop0_6_rule(Parser *p);
-static asdl_seq *_gather_5_rule(Parser *p);
-static asdl_seq *_loop0_8_rule(Parser *p);
-static asdl_seq *_gather_7_rule(Parser *p);
-static asdl_seq *_loop0_10_rule(Parser *p);
-static asdl_seq *_gather_9_rule(Parser *p);
-static asdl_seq *_loop1_11_rule(Parser *p);
-static asdl_seq *_loop0_13_rule(Parser *p);
-static asdl_seq *_gather_12_rule(Parser *p);
-static void *_tmp_14_rule(Parser *p);
+static asdl_seq *_loop1_3_rule(Parser *p);
+static asdl_seq *_loop0_5_rule(Parser *p);
+static asdl_seq *_gather_4_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 void *_tmp_13_rule(Parser *p);
+static asdl_seq *_loop1_14_rule(Parser *p);
static void *_tmp_15_rule(Parser *p);
static void *_tmp_16_rule(Parser *p);
static void *_tmp_17_rule(Parser *p);
-static void *_tmp_18_rule(Parser *p);
-static void *_tmp_19_rule(Parser *p);
-static void *_tmp_20_rule(Parser *p);
-static void *_tmp_21_rule(Parser *p);
-static asdl_seq *_loop1_22_rule(Parser *p);
+static asdl_seq *_loop0_19_rule(Parser *p);
+static asdl_seq *_gather_18_rule(Parser *p);
+static asdl_seq *_loop0_21_rule(Parser *p);
+static asdl_seq *_gather_20_rule(Parser *p);
+static void *_tmp_22_rule(Parser *p);
static void *_tmp_23_rule(Parser *p);
-static void *_tmp_24_rule(Parser *p);
-static asdl_seq *_loop0_26_rule(Parser *p);
-static asdl_seq *_gather_25_rule(Parser *p);
-static asdl_seq *_loop0_28_rule(Parser *p);
-static asdl_seq *_gather_27_rule(Parser *p);
-static void *_tmp_29_rule(Parser *p);
-static void *_tmp_30_rule(Parser *p);
-static asdl_seq *_loop0_31_rule(Parser *p);
+static asdl_seq *_loop0_24_rule(Parser *p);
+static asdl_seq *_loop1_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 asdl_seq *_loop0_30_rule(Parser *p);
+static asdl_seq *_gather_29_rule(Parser *p);
+static void *_tmp_31_rule(Parser *p);
static asdl_seq *_loop1_32_rule(Parser *p);
-static asdl_seq *_loop0_34_rule(Parser *p);
-static asdl_seq *_gather_33_rule(Parser *p);
+static void *_tmp_33_rule(Parser *p);
+static void *_tmp_34_rule(Parser *p);
static void *_tmp_35_rule(Parser *p);
+static asdl_seq *_loop0_36_rule(Parser *p);
static asdl_seq *_loop0_37_rule(Parser *p);
-static asdl_seq *_gather_36_rule(Parser *p);
-static void *_tmp_38_rule(Parser *p);
+static asdl_seq *_loop0_38_rule(Parser *p);
+static asdl_seq *_loop1_39_rule(Parser *p);
static asdl_seq *_loop0_40_rule(Parser *p);
-static asdl_seq *_gather_39_rule(Parser *p);
-static asdl_seq *_loop0_42_rule(Parser *p);
-static asdl_seq *_gather_41_rule(Parser *p);
+static asdl_seq *_loop1_41_rule(Parser *p);
+static asdl_seq *_loop1_42_rule(Parser *p);
+static asdl_seq *_loop1_43_rule(Parser *p);
static asdl_seq *_loop0_44_rule(Parser *p);
-static asdl_seq *_gather_43_rule(Parser *p);
+static asdl_seq *_loop1_45_rule(Parser *p);
static asdl_seq *_loop0_46_rule(Parser *p);
-static asdl_seq *_gather_45_rule(Parser *p);
-static void *_tmp_47_rule(Parser *p);
-static asdl_seq *_loop1_48_rule(Parser *p);
-static void *_tmp_49_rule(Parser *p);
-static asdl_seq *_loop1_50_rule(Parser *p);
-static asdl_seq *_loop0_52_rule(Parser *p);
-static asdl_seq *_gather_51_rule(Parser *p);
-static void *_tmp_53_rule(Parser *p);
-static void *_tmp_54_rule(Parser *p);
-static void *_tmp_55_rule(Parser *p);
-static void *_tmp_56_rule(Parser *p);
-static asdl_seq *_loop0_58_rule(Parser *p);
-static asdl_seq *_gather_57_rule(Parser *p);
-static asdl_seq *_loop0_60_rule(Parser *p);
-static asdl_seq *_gather_59_rule(Parser *p);
-static void *_tmp_61_rule(Parser *p);
+static asdl_seq *_loop1_47_rule(Parser *p);
+static asdl_seq *_loop0_48_rule(Parser *p);
+static asdl_seq *_loop1_49_rule(Parser *p);
+static asdl_seq *_loop0_51_rule(Parser *p);
+static asdl_seq *_gather_50_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 asdl_seq *_loop0_57_rule(Parser *p);
+static asdl_seq *_gather_56_rule(Parser *p);
+static void *_tmp_58_rule(Parser *p);
+static asdl_seq *_loop1_59_rule(Parser *p);
+static void *_tmp_60_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 *_loop0_65_rule(Parser *p);
-static asdl_seq *_gather_64_rule(Parser *p);
+static void *_tmp_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 *_loop0_70_rule(Parser *p);
+static asdl_seq *_loop0_69_rule(Parser *p);
+static asdl_seq *_gather_68_rule(Parser *p);
static asdl_seq *_loop0_71_rule(Parser *p);
-static asdl_seq *_loop0_72_rule(Parser *p);
-static asdl_seq *_loop1_73_rule(Parser *p);
+static asdl_seq *_gather_70_rule(Parser *p);
+static void *_tmp_72_rule(Parser *p);
static asdl_seq *_loop0_74_rule(Parser *p);
-static asdl_seq *_loop1_75_rule(Parser *p);
-static asdl_seq *_loop1_76_rule(Parser *p);
+static asdl_seq *_gather_73_rule(Parser *p);
+static asdl_seq *_loop0_76_rule(Parser *p);
+static asdl_seq *_gather_75_rule(Parser *p);
static asdl_seq *_loop1_77_rule(Parser *p);
-static asdl_seq *_loop0_78_rule(Parser *p);
-static asdl_seq *_loop1_79_rule(Parser *p);
+static asdl_seq *_loop1_78_rule(Parser *p);
static asdl_seq *_loop0_80_rule(Parser *p);
+static asdl_seq *_gather_79_rule(Parser *p);
static asdl_seq *_loop1_81_rule(Parser *p);
-static asdl_seq *_loop0_82_rule(Parser *p);
+static asdl_seq *_loop1_82_rule(Parser *p);
static asdl_seq *_loop1_83_rule(Parser *p);
-static asdl_seq *_loop1_84_rule(Parser *p);
-static void *_tmp_85_rule(Parser *p);
-static asdl_seq *_loop1_86_rule(Parser *p);
-static asdl_seq *_loop0_88_rule(Parser *p);
-static asdl_seq *_gather_87_rule(Parser *p);
-static asdl_seq *_loop1_89_rule(Parser *p);
-static asdl_seq *_loop0_90_rule(Parser *p);
-static asdl_seq *_loop0_91_rule(Parser *p);
+static void *_tmp_84_rule(Parser *p);
+static asdl_seq *_loop0_86_rule(Parser *p);
+static asdl_seq *_gather_85_rule(Parser *p);
+static void *_tmp_87_rule(Parser *p);
+static void *_tmp_88_rule(Parser *p);
+static void *_tmp_89_rule(Parser *p);
+static void *_tmp_90_rule(Parser *p);
+static void *_tmp_91_rule(Parser *p);
static asdl_seq *_loop0_92_rule(Parser *p);
-static asdl_seq *_loop1_93_rule(Parser *p);
+static asdl_seq *_loop0_93_rule(Parser *p);
static asdl_seq *_loop0_94_rule(Parser *p);
static asdl_seq *_loop1_95_rule(Parser *p);
-static asdl_seq *_loop1_96_rule(Parser *p);
+static asdl_seq *_loop0_96_rule(Parser *p);
static asdl_seq *_loop1_97_rule(Parser *p);
-static asdl_seq *_loop0_98_rule(Parser *p);
+static asdl_seq *_loop1_98_rule(Parser *p);
static asdl_seq *_loop1_99_rule(Parser *p);
static asdl_seq *_loop0_100_rule(Parser *p);
static asdl_seq *_loop1_101_rule(Parser *p);
static asdl_seq *_loop0_102_rule(Parser *p);
static asdl_seq *_loop1_103_rule(Parser *p);
-static asdl_seq *_loop1_104_rule(Parser *p);
+static asdl_seq *_loop0_104_rule(Parser *p);
static asdl_seq *_loop1_105_rule(Parser *p);
static asdl_seq *_loop1_106_rule(Parser *p);
static void *_tmp_107_rule(Parser *p);
static asdl_seq *_loop0_109_rule(Parser *p);
static asdl_seq *_gather_108_rule(Parser *p);
-static void *_tmp_110_rule(Parser *p);
-static void *_tmp_111_rule(Parser *p);
-static void *_tmp_112_rule(Parser *p);
+static asdl_seq *_loop1_110_rule(Parser *p);
+static asdl_seq *_loop0_111_rule(Parser *p);
+static asdl_seq *_loop0_112_rule(Parser *p);
static void *_tmp_113_rule(Parser *p);
-static asdl_seq *_loop1_114_rule(Parser *p);
-static void *_tmp_115_rule(Parser *p);
+static asdl_seq *_loop0_115_rule(Parser *p);
+static asdl_seq *_gather_114_rule(Parser *p);
static void *_tmp_116_rule(Parser *p);
-static void *_tmp_117_rule(Parser *p);
-static asdl_seq *_loop0_119_rule(Parser *p);
-static asdl_seq *_gather_118_rule(Parser *p);
-static asdl_seq *_loop1_120_rule(Parser *p);
-static asdl_seq *_loop0_121_rule(Parser *p);
+static asdl_seq *_loop0_118_rule(Parser *p);
+static asdl_seq *_gather_117_rule(Parser *p);
+static asdl_seq *_loop0_120_rule(Parser *p);
+static asdl_seq *_gather_119_rule(Parser *p);
static asdl_seq *_loop0_122_rule(Parser *p);
+static asdl_seq *_gather_121_rule(Parser *p);
static asdl_seq *_loop0_124_rule(Parser *p);
static asdl_seq *_gather_123_rule(Parser *p);
-static void *_tmp_125_rule(Parser *p);
+static asdl_seq *_loop0_125_rule(Parser *p);
static asdl_seq *_loop0_127_rule(Parser *p);
static asdl_seq *_gather_126_rule(Parser *p);
-static asdl_seq *_loop0_129_rule(Parser *p);
-static asdl_seq *_gather_128_rule(Parser *p);
+static asdl_seq *_loop1_128_rule(Parser *p);
+static void *_tmp_129_rule(Parser *p);
static asdl_seq *_loop0_131_rule(Parser *p);
static asdl_seq *_gather_130_rule(Parser *p);
static asdl_seq *_loop0_133_rule(Parser *p);
static asdl_seq *_gather_132_rule(Parser *p);
-static asdl_seq *_loop0_134_rule(Parser *p);
-static asdl_seq *_loop0_136_rule(Parser *p);
-static asdl_seq *_gather_135_rule(Parser *p);
-static asdl_seq *_loop1_137_rule(Parser *p);
-static void *_tmp_138_rule(Parser *p);
-static asdl_seq *_loop0_140_rule(Parser *p);
-static asdl_seq *_gather_139_rule(Parser *p);
+static asdl_seq *_loop0_135_rule(Parser *p);
+static asdl_seq *_gather_134_rule(Parser *p);
+static asdl_seq *_loop0_137_rule(Parser *p);
+static asdl_seq *_gather_136_rule(Parser *p);
+static asdl_seq *_loop0_139_rule(Parser *p);
+static asdl_seq *_gather_138_rule(Parser *p);
+static void *_tmp_140_rule(Parser *p);
static void *_tmp_141_rule(Parser *p);
static void *_tmp_142_rule(Parser *p);
static void *_tmp_143_rule(Parser *p);
@@ -1151,252 +1151,6 @@ fstring_rule(Parser *p)
return _res;
}
-// type_expressions:
-// | ','.expression+ ',' '*' expression ',' '**' expression
-// | ','.expression+ ',' '*' expression
-// | ','.expression+ ',' '**' expression
-// | '*' expression ',' '**' expression
-// | '*' expression
-// | '**' expression
-// | ','.expression+
-static asdl_expr_seq*
-type_expressions_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_expr_seq* _res = NULL;
- int _mark = p->mark;
- { // ','.expression+ ',' '*' expression ',' '**' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
- Token * _literal;
- Token * _literal_1;
- Token * _literal_2;
- Token * _literal_3;
- asdl_seq * a;
- expr_ty b;
- expr_ty c;
- if (
- (a = _gather_3_rule(p)) // ','.expression+
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (b = expression_rule(p)) // expression
- &&
- (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (c = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
- }
- { // ','.expression+ ',' '*' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * a;
- expr_ty b;
- if (
- (a = _gather_5_rule(p)) // ','.expression+
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (b = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
- }
- { // ','.expression+ ',' '**' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * a;
- expr_ty b;
- if (
- (a = _gather_7_rule(p)) // ','.expression+
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (b = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
- }
- { // '*' expression ',' '**' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
- Token * _literal;
- Token * _literal_1;
- Token * _literal_2;
- expr_ty a;
- expr_ty b;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (a = expression_rule(p)) // expression
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (b = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
- }
- { // '*' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
- Token * _literal;
- expr_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (a = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
- }
- { // '**' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
- Token * _literal;
- expr_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (a = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
- _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
- }
- { // ','.expression+
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
- asdl_expr_seq* a;
- if (
- (a = (asdl_expr_seq*)_gather_9_rule(p)) // ','.expression+
- )
- {
- D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
// statements: statement+
static asdl_stmt_seq*
statements_rule(Parser *p)
@@ -1416,7 +1170,7 @@ statements_rule(Parser *p)
D(fprintf(stderr, "%*c> statements[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement+"));
asdl_seq * a;
if (
- (a = _loop1_11_rule(p)) // statement+
+ (a = _loop1_3_rule(p)) // statement+
)
{
D(fprintf(stderr, "%*c+ statements[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "statement+"));
@@ -1683,7 +1437,7 @@ simple_stmts_rule(Parser *p)
asdl_stmt_seq* a;
Token * newline_var;
if (
- (a = (asdl_stmt_seq*)_gather_12_rule(p)) // ';'.simple_stmt+
+ (a = (asdl_stmt_seq*)_gather_4_rule(p)) // ';'.simple_stmt+
&&
(_opt_var = _PyPegen_expect_token(p, 13), 1) // ';'?
&&
@@ -1827,7 +1581,7 @@ simple_stmt_rule(Parser *p)
D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('import' | 'from') import_stmt"));
stmt_ty import_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_14_rule, p)
+ _PyPegen_lookahead(1, _tmp_6_rule, p)
&&
(import_stmt_var = import_stmt_rule(p)) // import_stmt
)
@@ -2099,7 +1853,7 @@ compound_stmt_rule(Parser *p)
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('def' | '@' | ASYNC) function_def"));
stmt_ty function_def_var;
if (
- _PyPegen_lookahead(1, _tmp_15_rule, p)
+ _PyPegen_lookahead(1, _tmp_7_rule, p)
&&
(function_def_var = function_def_rule(p)) // function_def
)
@@ -2141,7 +1895,7 @@ compound_stmt_rule(Parser *p)
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('class' | '@') class_def"));
stmt_ty class_def_var;
if (
- _PyPegen_lookahead(1, _tmp_16_rule, p)
+ _PyPegen_lookahead(1, _tmp_8_rule, p)
&&
(class_def_var = class_def_rule(p)) // class_def
)
@@ -2162,7 +1916,7 @@ compound_stmt_rule(Parser *p)
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('with' | ASYNC) with_stmt"));
stmt_ty with_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_17_rule, p)
+ _PyPegen_lookahead(1, _tmp_9_rule, p)
&&
(with_stmt_var = with_stmt_rule(p)) // with_stmt
)
@@ -2183,7 +1937,7 @@ compound_stmt_rule(Parser *p)
D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&('for' | ASYNC) for_stmt"));
stmt_ty for_stmt_var;
if (
- _PyPegen_lookahead(1, _tmp_18_rule, p)
+ _PyPegen_lookahead(1, _tmp_10_rule, p)
&&
(for_stmt_var = for_stmt_rule(p)) // for_stmt
)
@@ -2305,7 +2059,7 @@ assignment_rule(Parser *p)
&&
(b = expression_rule(p)) // expression
&&
- (c = _tmp_19_rule(p), 1) // ['=' annotated_rhs]
+ (c = _tmp_11_rule(p), 1) // ['=' annotated_rhs]
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ':' expression ['=' annotated_rhs]"));
@@ -2341,13 +2095,13 @@ assignment_rule(Parser *p)
expr_ty b;
void *c;
if (
- (a = _tmp_20_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
+ (a = _tmp_12_rule(p)) // '(' single_target ')' | single_subscript_attribute_target
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
(b = expression_rule(p)) // expression
&&
- (c = _tmp_21_rule(p), 1) // ['=' annotated_rhs]
+ (c = _tmp_13_rule(p), 1) // ['=' annotated_rhs]
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "('(' single_target ')' | single_subscript_attribute_target) ':' expression ['=' annotated_rhs]"));
@@ -2382,9 +2136,9 @@ assignment_rule(Parser *p)
void *b;
void *tc;
if (
- (a = (asdl_expr_seq*)_loop1_22_rule(p)) // ((star_targets '='))+
+ (a = (asdl_expr_seq*)_loop1_14_rule(p)) // ((star_targets '='))+
&&
- (b = _tmp_23_rule(p)) // yield_expr | star_expressions
+ (b = _tmp_15_rule(p)) // yield_expr | star_expressions
&&
_PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='='
&&
@@ -2430,7 +2184,7 @@ assignment_rule(Parser *p)
&&
(_cut_var = 1)
&&
- (c = _tmp_24_rule(p)) // yield_expr | star_expressions
+ (c = _tmp_16_rule(p)) // yield_expr | star_expressions
)
{
D(fprintf(stderr, "%*c+ assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_target augassign ~ (yield_expr | star_expressions)"));
@@ -2484,6 +2238,61 @@ assignment_rule(Parser *p)
return _res;
}
+// annotated_rhs: yield_expr | star_expressions
+static expr_ty
+annotated_rhs_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ { // yield_expr
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ expr_ty yield_expr_var;
+ if (
+ (yield_expr_var = yield_expr_rule(p)) // yield_expr
+ )
+ {
+ D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ _res = yield_expr_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+ }
+ { // star_expressions
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ expr_ty star_expressions_var;
+ if (
+ (star_expressions_var = star_expressions_rule(p)) // star_expressions
+ )
+ {
+ D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ _res = star_expressions_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
// augassign:
// | '+='
// | '-='
@@ -2826,9 +2635,9 @@ augassign_rule(Parser *p)
return _res;
}
-// global_stmt: 'global' ','.NAME+
+// return_stmt: 'return' star_expressions?
static stmt_ty
-global_stmt_rule(Parser *p)
+return_stmt_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -2846,21 +2655,21 @@ global_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
- { // 'global' ','.NAME+
+ { // 'return' star_expressions?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
+ D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
Token * _keyword;
- asdl_expr_seq* a;
+ void *a;
if (
- (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
+ (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
&&
- (a = (asdl_expr_seq*)_gather_25_rule(p)) // ','.NAME+
+ (a = star_expressions_rule(p), 1) // star_expressions?
)
{
- D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
+ D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -2870,7 +2679,7 @@ global_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 = _PyAST_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
+ _res = _PyAST_Return ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -2879,8 +2688,8 @@ global_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
+ D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
}
_res = NULL;
done:
@@ -2888,9 +2697,9 @@ global_stmt_rule(Parser *p)
return _res;
}
-// nonlocal_stmt: 'nonlocal' ','.NAME+
+// raise_stmt: 'raise' expression ['from' expression] | 'raise'
static stmt_ty
-nonlocal_stmt_rule(Parser *p)
+raise_stmt_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -2908,21 +2717,24 @@ nonlocal_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
- { // 'nonlocal' ','.NAME+
+ { // 'raise' expression ['from' expression]
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
+ D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
Token * _keyword;
- asdl_expr_seq* a;
+ expr_ty a;
+ void *b;
if (
- (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
+ (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
&&
- (a = (asdl_expr_seq*)_gather_27_rule(p)) // ','.NAME+
+ (a = expression_rule(p)) // expression
+ &&
+ (b = _tmp_17_rule(p), 1) // ['from' expression]
)
{
- D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
+ D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -2932,7 +2744,7 @@ nonlocal_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 = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
+ _res = _PyAST_Raise ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -2941,8 +2753,41 @@ nonlocal_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
+ D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
+ }
+ { // 'raise'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
+ Token * _keyword;
+ if (
+ (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
+ )
+ {
+ D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Raise ( NULL , NULL , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
}
_res = NULL;
done:
@@ -2950,9 +2795,9 @@ nonlocal_stmt_rule(Parser *p)
return _res;
}
-// yield_stmt: yield_expr
+// global_stmt: 'global' ','.NAME+
static stmt_ty
-yield_stmt_rule(Parser *p)
+global_stmt_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -2970,18 +2815,21 @@ yield_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
- { // yield_expr
+ { // 'global' ','.NAME+
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
- expr_ty y;
+ D(fprintf(stderr, "%*c> global_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
+ Token * _keyword;
+ asdl_expr_seq* a;
if (
- (y = yield_expr_rule(p)) // yield_expr
+ (_keyword = _PyPegen_expect_token(p, 508)) // token='global'
+ &&
+ (a = (asdl_expr_seq*)_gather_18_rule(p)) // ','.NAME+
)
{
- D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c+ global_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'global' ','.NAME+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -2991,7 +2839,7 @@ yield_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 = _PyAST_Expr ( y , EXTRA );
+ _res = _PyAST_Global ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -3000,8 +2848,8 @@ yield_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c%s global_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'global' ','.NAME+"));
}
_res = NULL;
done:
@@ -3009,9 +2857,9 @@ yield_stmt_rule(Parser *p)
return _res;
}
-// assert_stmt: 'assert' expression [',' expression]
+// nonlocal_stmt: 'nonlocal' ','.NAME+
static stmt_ty
-assert_stmt_rule(Parser *p)
+nonlocal_stmt_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -3029,24 +2877,21 @@ assert_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
- { // 'assert' expression [',' expression]
+ { // 'nonlocal' ','.NAME+
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+ D(fprintf(stderr, "%*c> nonlocal_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
Token * _keyword;
- expr_ty a;
- void *b;
+ asdl_expr_seq* a;
if (
- (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
- &&
- (a = expression_rule(p)) // expression
+ (_keyword = _PyPegen_expect_token(p, 509)) // token='nonlocal'
&&
- (b = _tmp_29_rule(p), 1) // [',' expression]
+ (a = (asdl_expr_seq*)_gather_20_rule(p)) // ','.NAME+
)
{
- D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+ D(fprintf(stderr, "%*c+ nonlocal_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'nonlocal' ','.NAME+"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -3056,7 +2901,7 @@ assert_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 = _PyAST_Assert ( a , b , EXTRA );
+ _res = _PyAST_Nonlocal ( CHECK ( asdl_identifier_seq * , _PyPegen_map_names_to_ids ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -3065,8 +2910,8 @@ assert_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
+ D(fprintf(stderr, "%*c%s nonlocal_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'nonlocal' ','.NAME+"));
}
_res = NULL;
done:
@@ -3107,7 +2952,7 @@ del_stmt_rule(Parser *p)
&&
(a = del_targets_rule(p)) // del_targets
&&
- _PyPegen_lookahead(1, _tmp_30_rule, p)
+ _PyPegen_lookahead(1, _tmp_22_rule, p)
)
{
D(fprintf(stderr, "%*c+ del_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'del' del_targets &(';' | NEWLINE)"));
@@ -3157,6 +3002,130 @@ del_stmt_rule(Parser *p)
return _res;
}
+// yield_stmt: yield_expr
+static stmt_ty
+yield_stmt_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // yield_expr
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> yield_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ expr_ty y;
+ if (
+ (y = yield_expr_rule(p)) // yield_expr
+ )
+ {
+ D(fprintf(stderr, "%*c+ yield_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Expr ( y , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s yield_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// assert_stmt: 'assert' expression [',' expression]
+static stmt_ty
+assert_stmt_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // 'assert' expression [',' expression]
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> assert_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+ Token * _keyword;
+ expr_ty a;
+ void *b;
+ if (
+ (_keyword = _PyPegen_expect_token(p, 505)) // token='assert'
+ &&
+ (a = expression_rule(p)) // expression
+ &&
+ (b = _tmp_23_rule(p), 1) // [',' expression]
+ )
+ {
+ D(fprintf(stderr, "%*c+ assert_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'assert' expression [',' expression]"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Assert ( a , b , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s assert_stmt[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'assert' expression [',' expression]"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
// import_stmt: import_name | import_from
static stmt_ty
import_stmt_rule(Parser *p)
@@ -3310,7 +3279,7 @@ import_from_rule(Parser *p)
if (
(_keyword = _PyPegen_expect_token(p, 514)) // token='from'
&&
- (a = _loop0_31_rule(p)) // (('.' | '...'))*
+ (a = _loop0_24_rule(p)) // (('.' | '...'))*
&&
(b = dotted_name_rule(p)) // dotted_name
&&
@@ -3354,7 +3323,7 @@ import_from_rule(Parser *p)
if (
(_keyword = _PyPegen_expect_token(p, 514)) // token='from'
&&
- (a = _loop1_32_rule(p)) // (('.' | '...'))+
+ (a = _loop1_25_rule(p)) // (('.' | '...'))+
&&
(_keyword_1 = _PyPegen_expect_token(p, 513)) // token='import'
&&
@@ -3545,7 +3514,7 @@ import_from_as_names_rule(Parser *p)
D(fprintf(stderr, "%*c> import_from_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
asdl_alias_seq* a;
if (
- (a = (asdl_alias_seq*)_gather_33_rule(p)) // ','.import_from_as_name+
+ (a = (asdl_alias_seq*)_gather_26_rule(p)) // ','.import_from_as_name+
)
{
D(fprintf(stderr, "%*c+ import_from_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.import_from_as_name+"));
@@ -3598,7 +3567,7 @@ import_from_as_name_rule(Parser *p)
if (
(a = _PyPegen_name_token(p)) // NAME
&&
- (b = _tmp_35_rule(p), 1) // ['as' NAME]
+ (b = _tmp_28_rule(p), 1) // ['as' NAME]
)
{
D(fprintf(stderr, "%*c+ import_from_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME ['as' NAME]"));
@@ -3648,7 +3617,7 @@ dotted_as_names_rule(Parser *p)
D(fprintf(stderr, "%*c> dotted_as_names[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
asdl_alias_seq* a;
if (
- (a = (asdl_alias_seq*)_gather_36_rule(p)) // ','.dotted_as_name+
+ (a = (asdl_alias_seq*)_gather_29_rule(p)) // ','.dotted_as_name+
)
{
D(fprintf(stderr, "%*c+ dotted_as_names[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.dotted_as_name+"));
@@ -3701,7 +3670,7 @@ dotted_as_name_rule(Parser *p)
if (
(a = dotted_name_rule(p)) // dotted_name
&&
- (b = _tmp_38_rule(p), 1) // ['as' NAME]
+ (b = _tmp_31_rule(p), 1) // ['as' NAME]
)
{
D(fprintf(stderr, "%*c+ dotted_as_name[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_name ['as' NAME]"));
@@ -3832,6 +3801,1468 @@ dotted_name_raw(Parser *p)
return _res;
}
+// block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block
+static asdl_stmt_seq*
+block_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_stmt_seq* _res = NULL;
+ if (_PyPegen_is_memoized(p, block_type, &_res)) {
+ D(p->level--);
+ return _res;
+ }
+ int _mark = p->mark;
+ { // NEWLINE INDENT statements DEDENT
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+ asdl_stmt_seq* a;
+ Token * dedent_var;
+ Token * indent_var;
+ Token * newline_var;
+ if (
+ (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
+ &&
+ (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
+ &&
+ (a = statements_rule(p)) // statements
+ &&
+ (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
+ )
+ {
+ D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
+ }
+ { // simple_stmts
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+ asdl_stmt_seq* simple_stmts_var;
+ if (
+ (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
+ )
+ {
+ D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
+ _res = simple_stmts_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
+ }
+ if (p->call_invalid_rules) { // invalid_block
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
+ void *invalid_block_var;
+ if (
+ (invalid_block_var = invalid_block_rule(p)) // invalid_block
+ )
+ {
+ D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
+ _res = invalid_block_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
+ }
+ _res = NULL;
+ done:
+ _PyPegen_insert_memo(p, _mark, block_type, _res);
+ D(p->level--);
+ return _res;
+}
+
+// decorators: (('@' named_expression NEWLINE))+
+static asdl_expr_seq*
+decorators_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_expr_seq* _res = NULL;
+ int _mark = p->mark;
+ { // (('@' named_expression NEWLINE))+
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+ asdl_expr_seq* a;
+ if (
+ (a = (asdl_expr_seq*)_loop1_32_rule(p)) // (('@' named_expression NEWLINE))+
+ )
+ {
+ D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// class_def: decorators class_def_raw | class_def_raw
+static stmt_ty
+class_def_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ { // decorators class_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
+ asdl_expr_seq* a;
+ stmt_ty b;
+ if (
+ (a = decorators_rule(p)) // decorators
+ &&
+ (b = class_def_raw_rule(p)) // class_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
+ _res = _PyPegen_class_def_decorators ( p , a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
+ }
+ { // class_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
+ stmt_ty class_def_raw_var;
+ if (
+ (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
+ _res = class_def_raw_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// class_def_raw: invalid_class_def_raw | 'class' NAME ['(' arguments? ')'] &&':' block
+static stmt_ty
+class_def_raw_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ if (p->call_invalid_rules) { // invalid_class_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
+ void *invalid_class_def_raw_var;
+ if (
+ (invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
+ _res = invalid_class_def_raw_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw"));
+ }
+ { // 'class' NAME ['(' arguments? ')'] &&':' block
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+ Token * _keyword;
+ Token * _literal;
+ expr_ty a;
+ void *b;
+ asdl_stmt_seq* c;
+ if (
+ (_keyword = _PyPegen_expect_token(p, 515)) // token='class'
+ &&
+ (a = _PyPegen_name_token(p)) // NAME
+ &&
+ (b = _tmp_33_rule(p), 1) // ['(' arguments? ')']
+ &&
+ (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
+ &&
+ (c = block_rule(p)) // block
+ )
+ {
+ D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// function_def: decorators function_def_raw | function_def_raw
+static stmt_ty
+function_def_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ { // decorators function_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
+ asdl_expr_seq* d;
+ stmt_ty f;
+ if (
+ (d = decorators_rule(p)) // decorators
+ &&
+ (f = function_def_raw_rule(p)) // function_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
+ _res = _PyPegen_function_def_decorators ( p , d , f );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
+ }
+ { // function_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
+ stmt_ty function_def_raw_var;
+ if (
+ (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
+ _res = function_def_raw_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// function_def_raw:
+// | invalid_def_raw
+// | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+// | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+static stmt_ty
+function_def_raw_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ stmt_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ if (p->call_invalid_rules) { // invalid_def_raw
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
+ void *invalid_def_raw_var;
+ if (
+ (invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw
+ )
+ {
+ D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
+ _res = invalid_def_raw_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw"));
+ }
+ { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ Token * _keyword;
+ Token * _literal;
+ Token * _literal_1;
+ Token * _literal_2;
+ void *a;
+ asdl_stmt_seq* b;
+ expr_ty n;
+ void *params;
+ void *tc;
+ if (
+ (_keyword = _PyPegen_expect_token(p, 516)) // token='def'
+ &&
+ (n = _PyPegen_name_token(p)) // NAME
+ &&
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ &&
+ (params = params_rule(p), 1) // params?
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ &&
+ (a = _tmp_34_rule(p), 1) // ['->' expression]
+ &&
+ (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
+ &&
+ (tc = func_type_comment_rule(p), 1) // func_type_comment?
+ &&
+ (b = block_rule(p)) // block
+ )
+ {
+ D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ }
+ { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ Token * _keyword;
+ Token * _literal;
+ Token * _literal_1;
+ Token * _literal_2;
+ void *a;
+ Token * async_var;
+ asdl_stmt_seq* b;
+ expr_ty n;
+ void *params;
+ void *tc;
+ if (
+ (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
+ &&
+ (_keyword = _PyPegen_expect_token(p, 516)) // token='def'
+ &&
+ (n = _PyPegen_name_token(p)) // NAME
+ &&
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ &&
+ (params = params_rule(p), 1) // params?
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ &&
+ (a = _tmp_35_rule(p), 1) // ['->' expression]
+ &&
+ (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
+ &&
+ (tc = func_type_comment_rule(p), 1) // func_type_comment?
+ &&
+ (b = block_rule(p)) // block
+ )
+ {
+ D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// params: invalid_parameters | parameters
+static arguments_ty
+params_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ arguments_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->call_invalid_rules) { // invalid_parameters
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
+ void *invalid_parameters_var;
+ if (
+ (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
+ )
+ {
+ D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
+ _res = invalid_parameters_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
+ }
+ { // parameters
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
+ arguments_ty parameters_var;
+ if (
+ (parameters_var = parameters_rule(p)) // parameters
+ )
+ {
+ D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
+ _res = parameters_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// parameters:
+// | 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)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ arguments_ty _res = NULL;
+ int _mark = p->mark;
+ { // slash_no_default param_no_default* param_with_default* star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+ asdl_arg_seq* a;
+ asdl_arg_seq* b;
+ asdl_seq * c;
+ void *d;
+ if (
+ (a = slash_no_default_rule(p)) // slash_no_default
+ &&
+ (b = (asdl_arg_seq*)_loop0_36_rule(p)) // param_no_default*
+ &&
+ (c = _loop0_37_rule(p)) // param_with_default*
+ &&
+ (d = star_etc_rule(p), 1) // star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+ _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
+ }
+ { // slash_with_default param_with_default* star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+ SlashWithDefault* a;
+ asdl_seq * b;
+ void *c;
+ if (
+ (a = slash_with_default_rule(p)) // slash_with_default
+ &&
+ (b = _loop0_38_rule(p)) // param_with_default*
+ &&
+ (c = star_etc_rule(p), 1) // star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
+ }
+ { // param_no_default+ param_with_default* star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+ asdl_arg_seq* a;
+ asdl_seq * b;
+ void *c;
+ if (
+ (a = (asdl_arg_seq*)_loop1_39_rule(p)) // param_no_default+
+ &&
+ (b = _loop0_40_rule(p)) // param_with_default*
+ &&
+ (c = star_etc_rule(p), 1) // star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
+ }
+ { // param_with_default+ star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
+ asdl_seq * a;
+ void *b;
+ if (
+ (a = _loop1_41_rule(p)) // param_with_default+
+ &&
+ (b = star_etc_rule(p), 1) // star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
+ }
+ { // star_etc
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
+ StarEtc* a;
+ if (
+ (a = star_etc_rule(p)) // star_etc
+ )
+ {
+ D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
+static asdl_arg_seq*
+slash_no_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_arg_seq* _res = NULL;
+ int _mark = p->mark;
+ { // param_no_default+ '/' ','
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
+ Token * _literal;
+ Token * _literal_1;
+ asdl_arg_seq* a;
+ if (
+ (a = (asdl_arg_seq*)_loop1_42_rule(p)) // param_no_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
+ )
+ {
+ D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
+ }
+ { // param_no_default+ '/' &')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
+ Token * _literal;
+ asdl_arg_seq* a;
+ if (
+ (a = (asdl_arg_seq*)_loop1_43_rule(p)) // param_no_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ )
+ {
+ D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// slash_with_default:
+// | param_no_default* param_with_default+ '/' ','
+// | param_no_default* param_with_default+ '/' &')'
+static SlashWithDefault*
+slash_with_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ SlashWithDefault* _res = NULL;
+ int _mark = p->mark;
+ { // param_no_default* param_with_default+ '/' ','
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+ Token * _literal;
+ Token * _literal_1;
+ asdl_seq * a;
+ asdl_seq * b;
+ if (
+ (a = _loop0_44_rule(p)) // param_no_default*
+ &&
+ (b = _loop1_45_rule(p)) // param_with_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
+ )
+ {
+ D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+ _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
+ }
+ { // param_no_default* param_with_default+ '/' &')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+ Token * _literal;
+ asdl_seq * a;
+ asdl_seq * b;
+ if (
+ (a = _loop0_46_rule(p)) // param_no_default*
+ &&
+ (b = _loop1_47_rule(p)) // param_with_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ )
+ {
+ D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+ _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// star_etc:
+// | '*' param_no_default param_maybe_default* kwds?
+// | '*' ',' param_maybe_default+ kwds?
+// | kwds
+// | invalid_star_etc
+static StarEtc*
+star_etc_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ StarEtc* _res = NULL;
+ int _mark = p->mark;
+ { // '*' param_no_default param_maybe_default* kwds?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+ Token * _literal;
+ arg_ty a;
+ asdl_seq * b;
+ void *c;
+ if (
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
+ &&
+ (a = param_no_default_rule(p)) // param_no_default
+ &&
+ (b = _loop0_48_rule(p)) // param_maybe_default*
+ &&
+ (c = kwds_rule(p), 1) // kwds?
+ )
+ {
+ D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+ _res = _PyPegen_star_etc ( p , a , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
+ }
+ { // '*' ',' param_maybe_default+ kwds?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+ Token * _literal;
+ Token * _literal_1;
+ asdl_seq * b;
+ void *c;
+ if (
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (b = _loop1_49_rule(p)) // param_maybe_default+
+ &&
+ (c = kwds_rule(p), 1) // kwds?
+ )
+ {
+ D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+ _res = _PyPegen_star_etc ( p , NULL , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
+ }
+ { // kwds
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
+ arg_ty a;
+ if (
+ (a = kwds_rule(p)) // kwds
+ )
+ {
+ D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
+ _res = _PyPegen_star_etc ( p , NULL , NULL , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
+ }
+ if (p->call_invalid_rules) { // invalid_star_etc
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
+ void *invalid_star_etc_var;
+ if (
+ (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
+ )
+ {
+ D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
+ _res = invalid_star_etc_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// kwds: '**' param_no_default
+static arg_ty
+kwds_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ arg_ty _res = NULL;
+ int _mark = p->mark;
+ { // '**' param_no_default
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
+ Token * _literal;
+ arg_ty a;
+ if (
+ (_literal = _PyPegen_expect_token(p, 35)) // token='**'
+ &&
+ (a = param_no_default_rule(p)) // param_no_default
+ )
+ {
+ D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
+static arg_ty
+param_no_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ arg_ty _res = NULL;
+ int _mark = p->mark;
+ { // param ',' TYPE_COMMENT?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
+ Token * _literal;
+ arg_ty a;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
+ _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
+ }
+ { // param TYPE_COMMENT? &')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
+ arg_ty a;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
+ _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
+static NameDefaultPair*
+param_with_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ NameDefaultPair* _res = NULL;
+ int _mark = p->mark;
+ { // param default ',' TYPE_COMMENT?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+ Token * _literal;
+ arg_ty a;
+ expr_ty c;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (c = default_rule(p)) // default
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+ _res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
+ }
+ { // param default TYPE_COMMENT? &')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+ arg_ty a;
+ expr_ty c;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (c = default_rule(p)) // default
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+ _res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// param_maybe_default:
+// | param default? ',' TYPE_COMMENT?
+// | param default? TYPE_COMMENT? &')'
+static NameDefaultPair*
+param_maybe_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ NameDefaultPair* _res = NULL;
+ int _mark = p->mark;
+ { // param default? ',' TYPE_COMMENT?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+ Token * _literal;
+ arg_ty a;
+ void *c;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (c = default_rule(p), 1) // default?
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+ _res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+ }
+ { // param default? TYPE_COMMENT? &')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+ arg_ty a;
+ void *c;
+ void *tc;
+ if (
+ (a = param_rule(p)) // param
+ &&
+ (c = default_rule(p), 1) // default?
+ &&
+ (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ )
+ {
+ D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+ _res = _PyPegen_name_default_pair ( p , a , c , tc );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// param: NAME annotation?
+static arg_ty
+param_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ arg_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+ expr_ty a;
+ void *b;
+ if (
+ (a = _PyPegen_name_token(p)) // NAME
+ &&
+ (b = annotation_rule(p), 1) // annotation?
+ )
+ {
+ D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// annotation: ':' expression
+static expr_ty
+annotation_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ { // ':' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
+ Token * _literal;
+ expr_ty a;
+ if (
+ (_literal = _PyPegen_expect_token(p, 11)) // token=':'
+ &&
+ (a = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// default: '=' expression
+static expr_ty
+default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ { // '=' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
+ Token * _literal;
+ expr_ty a;
+ if (
+ (_literal = _PyPegen_expect_token(p, 22)) // token='='
+ &&
+ (a = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
// if_stmt:
// | invalid_if_stmt
// | 'if' named_expression ':' block elif_stmt
@@ -4024,7 +5455,7 @@ elif_stmt_rule(Parser *p)
asdl_stmt_seq* b;
stmt_ty c;
if (
- (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
+ (_keyword = _PyPegen_expect_token(p, 517)) // token='elif'
&&
(a = named_expression_rule(p)) // named_expression
&&
@@ -4069,7 +5500,7 @@ elif_stmt_rule(Parser *p)
asdl_stmt_seq* b;
void *c;
if (
- (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
+ (_keyword = _PyPegen_expect_token(p, 517)) // token='elif'
&&
(a = named_expression_rule(p)) // named_expression
&&
@@ -4148,7 +5579,7 @@ else_block_rule(Parser *p)
Token * _literal;
asdl_stmt_seq* b;
if (
- (_keyword = _PyPegen_expect_token(p, 516)) // token='else'
+ (_keyword = _PyPegen_expect_token(p, 518)) // token='else'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
@@ -4323,11 +5754,11 @@ for_stmt_rule(Parser *p)
expr_ty t;
void *tc;
if (
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
&&
(t = star_targets_rule(p)) // star_targets
&&
- (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword_1 = _PyPegen_expect_token(p, 520)) // token='in'
&&
(_cut_var = 1)
&&
@@ -4387,11 +5818,11 @@ for_stmt_rule(Parser *p)
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
&&
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
&&
(t = star_targets_rule(p)) // star_targets
&&
- (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword_1 = _PyPegen_expect_token(p, 520)) // token='in'
&&
(_cut_var = 1)
&&
@@ -4517,11 +5948,11 @@ with_stmt_rule(Parser *p)
asdl_withitem_seq* a;
asdl_stmt_seq* b;
if (
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
- (a = (asdl_withitem_seq*)_gather_39_rule(p)) // ','.with_item+
+ (a = (asdl_withitem_seq*)_gather_50_rule(p)) // ','.with_item+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
&&
@@ -4566,9 +5997,9 @@ with_stmt_rule(Parser *p)
asdl_stmt_seq* b;
void *tc;
if (
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
- (a = (asdl_withitem_seq*)_gather_41_rule(p)) // ','.with_item+
+ (a = (asdl_withitem_seq*)_gather_52_rule(p)) // ','.with_item+
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -4617,11 +6048,11 @@ with_stmt_rule(Parser *p)
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
&&
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
- (a = (asdl_withitem_seq*)_gather_43_rule(p)) // ','.with_item+
+ (a = (asdl_withitem_seq*)_gather_54_rule(p)) // ','.with_item+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
&&
@@ -4669,9 +6100,9 @@ with_stmt_rule(Parser *p)
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
&&
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
- (a = (asdl_withitem_seq*)_gather_45_rule(p)) // ','.with_item+
+ (a = (asdl_withitem_seq*)_gather_56_rule(p)) // ','.with_item+
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -4753,11 +6184,11 @@ with_item_rule(Parser *p)
if (
(e = expression_rule(p)) // expression
&&
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(t = star_target_rule(p)) // star_target
&&
- _PyPegen_lookahead(1, _tmp_47_rule, p)
+ _PyPegen_lookahead(1, _tmp_58_rule, p)
)
{
D(fprintf(stderr, "%*c+ with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' star_target &(',' | ')' | ':')"));
@@ -4925,7 +6356,7 @@ try_stmt_rule(Parser *p)
&&
(b = block_rule(p)) // block
&&
- (ex = (asdl_excepthandler_seq*)_loop1_48_rule(p)) // except_block+
+ (ex = (asdl_excepthandler_seq*)_loop1_59_rule(p)) // except_block+
&&
(el = else_block_rule(p), 1) // else_block?
&&
@@ -5015,11 +6446,11 @@ except_block_rule(Parser *p)
expr_ty e;
void *t;
if (
- (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
+ (_keyword = _PyPegen_expect_token(p, 523)) // token='except'
&&
(e = expression_rule(p)) // expression
&&
- (t = _tmp_49_rule(p), 1) // ['as' NAME]
+ (t = _tmp_60_rule(p), 1) // ['as' NAME]
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -5058,7 +6489,7 @@ except_block_rule(Parser *p)
Token * _literal;
asdl_stmt_seq* b;
if (
- (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
+ (_keyword = _PyPegen_expect_token(p, 523)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -5152,7 +6583,7 @@ finally_block_rule(Parser *p)
Token * _literal;
asdl_stmt_seq* a;
if (
- (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
+ (_keyword = _PyPegen_expect_token(p, 524)) // token='finally'
&&
(_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
&&
@@ -5224,7 +6655,7 @@ match_stmt_rule(Parser *p)
&&
(indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
&&
- (cases = (asdl_match_case_seq*)_loop1_50_rule(p)) // case_block+
+ (cases = (asdl_match_case_seq*)_loop1_61_rule(p)) // case_block+
&&
(dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
)
@@ -5641,7 +7072,7 @@ as_pattern_rule(Parser *p)
if (
(pattern = or_pattern_rule(p)) // or_pattern
&&
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(target = pattern_capture_target_rule(p)) // pattern_capture_target
)
@@ -5721,7 +7152,7 @@ or_pattern_rule(Parser *p)
D(fprintf(stderr, "%*c> or_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
asdl_pattern_seq* patterns;
if (
- (patterns = (asdl_pattern_seq*)_gather_51_rule(p)) // '|'.closed_pattern+
+ (patterns = (asdl_pattern_seq*)_gather_62_rule(p)) // '|'.closed_pattern+
)
{
D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+"));
@@ -5965,7 +7396,7 @@ literal_pattern_rule(Parser *p)
if (
(value = signed_number_rule(p)) // signed_number
&&
- _PyPegen_lookahead(0, _tmp_53_rule, p)
+ _PyPegen_lookahead(0, _tmp_64_rule, p)
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
@@ -6064,7 +7495,7 @@ literal_pattern_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 523)) // token='None'
+ (_keyword = _PyPegen_expect_token(p, 525)) // token='None'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
@@ -6097,7 +7528,7 @@ literal_pattern_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 524)) // token='True'
+ (_keyword = _PyPegen_expect_token(p, 526)) // token='True'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
@@ -6130,7 +7561,7 @@ literal_pattern_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 525)) // token='False'
+ (_keyword = _PyPegen_expect_token(p, 527)) // token='False'
)
{
D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
@@ -6197,7 +7628,7 @@ literal_expr_rule(Parser *p)
if (
(signed_number_var = signed_number_rule(p)) // signed_number
&&
- _PyPegen_lookahead(0, _tmp_54_rule, p)
+ _PyPegen_lookahead(0, _tmp_65_rule, p)
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')"));
@@ -6254,7 +7685,7 @@ literal_expr_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 523)) // token='None'
+ (_keyword = _PyPegen_expect_token(p, 525)) // token='None'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
@@ -6287,7 +7718,7 @@ literal_expr_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 524)) // token='True'
+ (_keyword = _PyPegen_expect_token(p, 526)) // token='True'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
@@ -6320,7 +7751,7 @@ literal_expr_rule(Parser *p)
D(fprintf(stderr, "%*c> literal_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 525)) // token='False'
+ (_keyword = _PyPegen_expect_token(p, 527)) // token='False'
)
{
D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
@@ -6783,7 +8214,7 @@ pattern_capture_target_rule(Parser *p)
&&
(name = _PyPegen_name_token(p)) // NAME
&&
- _PyPegen_lookahead(0, _tmp_55_rule, p)
+ _PyPegen_lookahead(0, _tmp_66_rule, p)
)
{
D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')"));
@@ -6894,7 +8325,7 @@ value_pattern_rule(Parser *p)
if (
(attr = attr_rule(p)) // attr
&&
- _PyPegen_lookahead(0, _tmp_56_rule, p)
+ _PyPegen_lookahead(0, _tmp_67_rule, p)
)
{
D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')"));
@@ -7299,7 +8730,7 @@ maybe_sequence_pattern_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq * patterns;
if (
- (patterns = _gather_57_rule(p)) // ','.maybe_star_pattern+
+ (patterns = _gather_68_rule(p)) // ','.maybe_star_pattern+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -7694,13 +9125,13 @@ items_pattern_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> items_pattern[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
- asdl_seq * _gather_59_var;
+ asdl_seq * _gather_70_var;
if (
- (_gather_59_var = _gather_59_rule(p)) // ','.key_value_pattern+
+ (_gather_70_var = _gather_70_rule(p)) // ','.key_value_pattern+
)
{
D(fprintf(stderr, "%*c+ items_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.key_value_pattern+"));
- _res = _gather_59_var;
+ _res = _gather_70_var;
goto done;
}
p->mark = _mark;
@@ -7734,7 +9165,7 @@ key_value_pattern_rule(Parser *p)
void *key;
pattern_ty pattern;
if (
- (key = _tmp_61_rule(p)) // literal_expr | attr
+ (key = _tmp_72_rule(p)) // literal_expr | attr
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -8056,7 +9487,7 @@ positional_patterns_rule(Parser *p)
D(fprintf(stderr, "%*c> positional_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
asdl_pattern_seq* args;
if (
- (args = (asdl_pattern_seq*)_gather_62_rule(p)) // ','.pattern+
+ (args = (asdl_pattern_seq*)_gather_73_rule(p)) // ','.pattern+
)
{
D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+"));
@@ -8095,13 +9526,13 @@ keyword_patterns_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> keyword_patterns[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
- asdl_seq * _gather_64_var;
+ asdl_seq * _gather_75_var;
if (
- (_gather_64_var = _gather_64_rule(p)) // ','.keyword_pattern+
+ (_gather_75_var = _gather_75_rule(p)) // ','.keyword_pattern+
)
{
D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+"));
- _res = _gather_64_var;
+ _res = _gather_75_var;
goto done;
}
p->mark = _mark;
@@ -8161,16 +9592,16 @@ keyword_pattern_rule(Parser *p)
return _res;
}
-// return_stmt: 'return' star_expressions?
-static stmt_ty
-return_stmt_rule(Parser *p)
+// expressions: expression ((',' expression))+ ','? | expression ',' | expression
+static expr_ty
+expressions_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- stmt_ty _res = NULL;
+ expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
@@ -8181,21 +9612,25 @@ return_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
- { // 'return' star_expressions?
+ { // expression ((',' expression))+ ','?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> return_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
- Token * _keyword;
- void *a;
+ D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
+ void *_opt_var;
+ UNUSED(_opt_var); // Silence compiler warnings
+ expr_ty a;
+ asdl_seq * b;
if (
- (_keyword = _PyPegen_expect_token(p, 500)) // token='return'
+ (a = expression_rule(p)) // expression
&&
- (a = star_expressions_rule(p), 1) // star_expressions?
+ (b = _loop1_77_rule(p)) // ((',' expression))+
+ &&
+ (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
{
- D(fprintf(stderr, "%*c+ return_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'return' star_expressions?"));
+ D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -8205,7 +9640,7 @@ return_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 = _PyAST_Return ( a , EXTRA );
+ _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -8214,53 +9649,24 @@ return_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s return_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'return' star_expressions?"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// raise_stmt: 'raise' expression ['from' expression] | 'raise'
-static stmt_ty
-raise_stmt_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- stmt_ty _res = NULL;
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
}
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // 'raise' expression ['from' expression]
+ { // expression ','
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
- Token * _keyword;
+ D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
+ Token * _literal;
expr_ty a;
- void *b;
if (
- (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
- &&
(a = expression_rule(p)) // expression
&&
- (b = _tmp_66_rule(p), 1) // ['from' expression]
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
- D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise' expression ['from' expression]"));
+ D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -8270,7 +9676,7 @@ raise_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 = _PyAST_Raise ( a , b , EXTRA );
+ _res = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -8279,41 +9685,27 @@ raise_stmt_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise' expression ['from' expression]"));
+ D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
}
- { // 'raise'
+ { // expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> raise_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'raise'"));
- Token * _keyword;
+ D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
+ expr_ty expression_var;
if (
- (_keyword = _PyPegen_expect_token(p, 501)) // token='raise'
+ (expression_var = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ raise_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'raise'"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Raise ( NULL , NULL , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
+ _res = expression_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s raise_stmt[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'raise'"));
+ D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
}
_res = NULL;
done:
@@ -8321,82 +9713,24 @@ raise_stmt_rule(Parser *p)
return _res;
}
-// function_def: decorators function_def_raw | function_def_raw
-static stmt_ty
-function_def_rule(Parser *p)
+// expression:
+// | invalid_expression
+// | disjunction 'if' disjunction 'else' expression
+// | disjunction
+// | lambdef
+static expr_ty
+expression_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- stmt_ty _res = NULL;
- int _mark = p->mark;
- { // decorators function_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
- asdl_expr_seq* d;
- stmt_ty f;
- if (
- (d = decorators_rule(p)) // decorators
- &&
- (f = function_def_raw_rule(p)) // function_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators function_def_raw"));
- _res = _PyPegen_function_def_decorators ( p , d , f );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators function_def_raw"));
- }
- { // function_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> function_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
- stmt_ty function_def_raw_var;
- if (
- (function_def_raw_var = function_def_raw_rule(p)) // function_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ function_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "function_def_raw"));
- _res = function_def_raw_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s function_def[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "function_def_raw"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// function_def_raw:
-// | invalid_def_raw
-// | 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
-// | ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
-static stmt_ty
-function_def_raw_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
+ expr_ty _res = NULL;
+ if (_PyPegen_is_memoized(p, expression_type, &_res)) {
D(p->level--);
- return NULL;
+ return _res;
}
- stmt_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
@@ -8407,121 +9741,49 @@ 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
- if (p->call_invalid_rules) { // invalid_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
- void *invalid_def_raw_var;
- if (
- (invalid_def_raw_var = invalid_def_raw_rule(p)) // invalid_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_def_raw"));
- _res = invalid_def_raw_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_def_raw"));
- }
- { // 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+ if (p->call_invalid_rules) { // invalid_expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
- Token * _keyword;
- Token * _literal;
- Token * _literal_1;
- Token * _literal_2;
- void *a;
- asdl_stmt_seq* b;
- expr_ty n;
- void *params;
- void *tc;
+ D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
+ void *invalid_expression_var;
if (
- (_keyword = _PyPegen_expect_token(p, 526)) // token='def'
- &&
- (n = _PyPegen_name_token(p)) // NAME
- &&
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
- &&
- (params = params_rule(p), 1) // params?
- &&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
- &&
- (a = _tmp_67_rule(p), 1) // ['->' expression]
- &&
- (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
- &&
- (tc = func_type_comment_rule(p), 1) // func_type_comment?
- &&
- (b = block_rule(p)) // block
+ (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression
)
{
- D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_FunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
+ _res = invalid_expression_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression"));
}
- { // ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block
+ { // disjunction 'if' disjunction 'else' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> function_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token * _keyword;
- Token * _literal;
- Token * _literal_1;
- Token * _literal_2;
- void *a;
- Token * async_var;
- asdl_stmt_seq* b;
- expr_ty n;
- void *params;
- void *tc;
+ Token * _keyword_1;
+ expr_ty a;
+ expr_ty b;
+ expr_ty c;
if (
- (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
- &&
- (_keyword = _PyPegen_expect_token(p, 526)) // token='def'
- &&
- (n = _PyPegen_name_token(p)) // NAME
- &&
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
- &&
- (params = params_rule(p), 1) // params?
+ (a = disjunction_rule(p)) // disjunction
&&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
&&
- (a = _tmp_68_rule(p), 1) // ['->' expression]
+ (b = disjunction_rule(p)) // disjunction
&&
- (_literal_2 = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
+ (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='else'
&&
- (tc = func_type_comment_rule(p), 1) // func_type_comment?
- &&
- (b = block_rule(p)) // block
+ (c = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ function_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
+ D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -8531,807 +9793,7 @@ 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 = CHECK_VERSION ( stmt_ty , 5 , "Async functions are" , _PyAST_AsyncFunctionDef ( n -> v . Name . id , ( params ) ? params : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , NULL , a , NEW_TYPE_COMMENT ( p , tc ) , EXTRA ) );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s function_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC 'def' NAME '(' params? ')' ['->' expression] &&':' func_type_comment? block"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// func_type_comment:
-// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
-// | invalid_double_type_comments
-// | TYPE_COMMENT
-static Token*
-func_type_comment_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- Token* _res = NULL;
- int _mark = p->mark;
- { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
- Token * newline_var;
- Token * t;
- if (
- (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
- &&
- (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
- &&
- _PyPegen_lookahead(1, _tmp_69_rule, p)
- )
- {
- D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
- _res = t;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
- }
- if (p->call_invalid_rules) { // invalid_double_type_comments
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
- void *invalid_double_type_comments_var;
- if (
- (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
- )
- {
- D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
- _res = invalid_double_type_comments_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
- }
- { // TYPE_COMMENT
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
- Token * type_comment_var;
- if (
- (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
- )
- {
- D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
- _res = type_comment_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// params: invalid_parameters | parameters
-static arguments_ty
-params_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arguments_ty _res = NULL;
- int _mark = p->mark;
- if (p->call_invalid_rules) { // invalid_parameters
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
- void *invalid_parameters_var;
- if (
- (invalid_parameters_var = invalid_parameters_rule(p)) // invalid_parameters
- )
- {
- D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_parameters"));
- _res = invalid_parameters_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_parameters"));
- }
- { // parameters
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "parameters"));
- arguments_ty parameters_var;
- if (
- (parameters_var = parameters_rule(p)) // parameters
- )
- {
- D(fprintf(stderr, "%*c+ params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "parameters"));
- _res = parameters_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s params[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "parameters"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// parameters:
-// | 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)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arguments_ty _res = NULL;
- int _mark = p->mark;
- { // slash_no_default param_no_default* param_with_default* star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
- asdl_arg_seq* a;
- asdl_arg_seq* b;
- asdl_seq * c;
- void *d;
- if (
- (a = slash_no_default_rule(p)) // slash_no_default
- &&
- (b = (asdl_arg_seq*)_loop0_70_rule(p)) // param_no_default*
- &&
- (c = _loop0_71_rule(p)) // param_with_default*
- &&
- (d = star_etc_rule(p), 1) // star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
- _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_no_default param_no_default* param_with_default* star_etc?"));
- }
- { // slash_with_default param_with_default* star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
- SlashWithDefault* a;
- asdl_seq * b;
- void *c;
- if (
- (a = slash_with_default_rule(p)) // slash_with_default
- &&
- (b = _loop0_72_rule(p)) // param_with_default*
- &&
- (c = star_etc_rule(p), 1) // star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slash_with_default param_with_default* star_etc?"));
- }
- { // param_no_default+ param_with_default* star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
- asdl_arg_seq* a;
- asdl_seq * b;
- void *c;
- if (
- (a = (asdl_arg_seq*)_loop1_73_rule(p)) // param_no_default+
- &&
- (b = _loop0_74_rule(p)) // param_with_default*
- &&
- (c = star_etc_rule(p), 1) // star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ param_with_default* star_etc?"));
- }
- { // param_with_default+ star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
- asdl_seq * a;
- void *b;
- if (
- (a = _loop1_75_rule(p)) // param_with_default+
- &&
- (b = star_etc_rule(p), 1) // star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+ star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default+ star_etc?"));
- }
- { // star_etc
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_etc"));
- StarEtc* a;
- if (
- (a = star_etc_rule(p)) // star_etc
- )
- {
- D(fprintf(stderr, "%*c+ parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_etc"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_etc"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
-static asdl_arg_seq*
-slash_no_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_arg_seq* _res = NULL;
- int _mark = p->mark;
- { // param_no_default+ '/' ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
- Token * _literal;
- Token * _literal_1;
- asdl_arg_seq* a;
- if (
- (a = (asdl_arg_seq*)_loop1_76_rule(p)) // param_no_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' ','"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' ','"));
- }
- { // param_no_default+ '/' &')'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
- Token * _literal;
- asdl_arg_seq* a;
- if (
- (a = (asdl_arg_seq*)_loop1_77_rule(p)) // param_no_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
- )
- {
- D(fprintf(stderr, "%*c+ slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default+ '/' &')'"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default+ '/' &')'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// slash_with_default:
-// | param_no_default* param_with_default+ '/' ','
-// | param_no_default* param_with_default+ '/' &')'
-static SlashWithDefault*
-slash_with_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- SlashWithDefault* _res = NULL;
- int _mark = p->mark;
- { // param_no_default* param_with_default+ '/' ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * a;
- asdl_seq * b;
- if (
- (a = _loop0_78_rule(p)) // param_no_default*
- &&
- (b = _loop1_79_rule(p)) // param_with_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
- _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' ','"));
- }
- { // param_no_default* param_with_default+ '/' &')'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
- Token * _literal;
- asdl_seq * a;
- asdl_seq * b;
- if (
- (a = _loop0_80_rule(p)) // param_no_default*
- &&
- (b = _loop1_81_rule(p)) // param_with_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
- )
- {
- D(fprintf(stderr, "%*c+ slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
- _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default* param_with_default+ '/' &')'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// star_etc:
-// | '*' param_no_default param_maybe_default* kwds?
-// | '*' ',' param_maybe_default+ kwds?
-// | kwds
-// | invalid_star_etc
-static StarEtc*
-star_etc_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- StarEtc* _res = NULL;
- int _mark = p->mark;
- { // '*' param_no_default param_maybe_default* kwds?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
- Token * _literal;
- arg_ty a;
- asdl_seq * b;
- void *c;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (a = param_no_default_rule(p)) // param_no_default
- &&
- (b = _loop0_82_rule(p)) // param_maybe_default*
- &&
- (c = kwds_rule(p), 1) // kwds?
- )
- {
- D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
- _res = _PyPegen_star_etc ( p , a , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' param_no_default param_maybe_default* kwds?"));
- }
- { // '*' ',' param_maybe_default+ kwds?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * b;
- void *c;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (b = _loop1_83_rule(p)) // param_maybe_default+
- &&
- (c = kwds_rule(p), 1) // kwds?
- )
- {
- D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
- _res = _PyPegen_star_etc ( p , NULL , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' param_maybe_default+ kwds?"));
- }
- { // kwds
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwds"));
- arg_ty a;
- if (
- (a = kwds_rule(p)) // kwds
- )
- {
- D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwds"));
- _res = _PyPegen_star_etc ( p , NULL , NULL , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwds"));
- }
- if (p->call_invalid_rules) { // invalid_star_etc
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
- void *invalid_star_etc_var;
- if (
- (invalid_star_etc_var = invalid_star_etc_rule(p)) // invalid_star_etc
- )
- {
- D(fprintf(stderr, "%*c+ star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_star_etc"));
- _res = invalid_star_etc_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_star_etc"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// kwds: '**' param_no_default
-static arg_ty
-kwds_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arg_ty _res = NULL;
- int _mark = p->mark;
- { // '**' param_no_default
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
- Token * _literal;
- arg_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (a = param_no_default_rule(p)) // param_no_default
- )
- {
- D(fprintf(stderr, "%*c+ kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' param_no_default"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s kwds[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' param_no_default"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
-static arg_ty
-param_no_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arg_ty _res = NULL;
- int _mark = p->mark;
- { // param ',' TYPE_COMMENT?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
- Token * _literal;
- arg_ty a;
- void *tc;
- if (
- (a = param_rule(p)) // param
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
- )
- {
- D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param ',' TYPE_COMMENT?"));
- _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param ',' TYPE_COMMENT?"));
- }
- { // param TYPE_COMMENT? &')'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
- arg_ty a;
- void *tc;
- if (
- (a = param_rule(p)) // param
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
- )
- {
- D(fprintf(stderr, "%*c+ param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param TYPE_COMMENT? &')'"));
- _res = _PyPegen_add_type_comment_to_arg ( p , a , tc );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param TYPE_COMMENT? &')'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
-static NameDefaultPair*
-param_with_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- NameDefaultPair* _res = NULL;
- int _mark = p->mark;
- { // param default ',' TYPE_COMMENT?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
- Token * _literal;
- arg_ty a;
- expr_ty c;
- void *tc;
- if (
- (a = param_rule(p)) // param
- &&
- (c = default_rule(p)) // default
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
- )
- {
- D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default ',' TYPE_COMMENT?"));
- _res = _PyPegen_name_default_pair ( p , a , c , tc );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default ',' TYPE_COMMENT?"));
- }
- { // param default TYPE_COMMENT? &')'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
- arg_ty a;
- expr_ty c;
- void *tc;
- if (
- (a = param_rule(p)) // param
- &&
- (c = default_rule(p)) // default
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
- )
- {
- D(fprintf(stderr, "%*c+ param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default TYPE_COMMENT? &')'"));
- _res = _PyPegen_name_default_pair ( p , a , c , tc );
+ _res = _PyAST_IfExp ( b , a , c , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -9340,109 +9802,64 @@ param_with_default_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default TYPE_COMMENT? &')'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// param_maybe_default:
-// | param default? ',' TYPE_COMMENT?
-// | param default? TYPE_COMMENT? &')'
-static NameDefaultPair*
-param_maybe_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
}
- NameDefaultPair* _res = NULL;
- int _mark = p->mark;
- { // param default? ',' TYPE_COMMENT?
+ { // disjunction
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
- Token * _literal;
- arg_ty a;
- void *c;
- void *tc;
+ D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
+ expr_ty disjunction_var;
if (
- (a = param_rule(p)) // param
- &&
- (c = default_rule(p), 1) // default?
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
+ (disjunction_var = disjunction_rule(p)) // disjunction
)
{
- D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
- _res = _PyPegen_name_default_pair ( p , a , c , tc );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
+ _res = disjunction_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? ',' TYPE_COMMENT?"));
+ D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
}
- { // param default? TYPE_COMMENT? &')'
+ { // lambdef
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
- arg_ty a;
- void *c;
- void *tc;
+ D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
+ expr_ty lambdef_var;
if (
- (a = param_rule(p)) // param
- &&
- (c = default_rule(p), 1) // default?
- &&
- (tc = _PyPegen_expect_token(p, TYPE_COMMENT), 1) // TYPE_COMMENT?
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 8) // token=')'
+ (lambdef_var = lambdef_rule(p)) // lambdef
)
{
- D(fprintf(stderr, "%*c+ param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
- _res = _PyPegen_name_default_pair ( p , a , c , tc );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
+ _res = lambdef_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param default? TYPE_COMMENT? &')'"));
+ D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
}
_res = NULL;
done:
+ _PyPegen_insert_memo(p, _mark, expression_type, _res);
D(p->level--);
return _res;
}
-// param: NAME annotation?
-static arg_ty
-param_rule(Parser *p)
+// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
+static expr_ty
+yield_expr_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- arg_ty _res = NULL;
+ expr_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
@@ -9453,21 +9870,24 @@ param_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?
+ { // 'yield' 'from' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+ D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
+ Token * _keyword;
+ Token * _keyword_1;
expr_ty a;
- void *b;
if (
- (a = _PyPegen_name_token(p)) // NAME
+ (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
&&
- (b = annotation_rule(p), 1) // annotation?
+ (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
+ &&
+ (a = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME annotation?"));
+ D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -9477,180 +9897,7 @@ param_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 = _PyAST_arg ( a -> v . Name . id , b , NULL , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s param[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME annotation?"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// annotation: ':' expression
-static expr_ty
-annotation_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- int _mark = p->mark;
- { // ':' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> annotation[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression"));
- Token * _literal;
- expr_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 11)) // token=':'
- &&
- (a = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ annotation[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s annotation[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// default: '=' expression
-static expr_ty
-default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- int _mark = p->mark;
- { // '=' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' expression"));
- Token * _literal;
- expr_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 22)) // token='='
- &&
- (a = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' expression"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' expression"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// decorators: (('@' named_expression NEWLINE))+
-static asdl_expr_seq*
-decorators_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_expr_seq* _res = NULL;
- int _mark = p->mark;
- { // (('@' named_expression NEWLINE))+
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> decorators[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
- asdl_expr_seq* a;
- if (
- (a = (asdl_expr_seq*)_loop1_84_rule(p)) // (('@' named_expression NEWLINE))+
- )
- {
- D(fprintf(stderr, "%*c+ decorators[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(('@' named_expression NEWLINE))+"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s decorators[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(('@' named_expression NEWLINE))+"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// class_def: decorators class_def_raw | class_def_raw
-static stmt_ty
-class_def_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- stmt_ty _res = NULL;
- int _mark = p->mark;
- { // decorators class_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
- asdl_expr_seq* a;
- stmt_ty b;
- if (
- (a = decorators_rule(p)) // decorators
- &&
- (b = class_def_raw_rule(p)) // class_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "decorators class_def_raw"));
- _res = _PyPegen_class_def_decorators ( p , a , b );
+ _res = _PyAST_YieldFrom ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -9659,97 +9906,24 @@ class_def_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "decorators class_def_raw"));
- }
- { // class_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> class_def[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
- stmt_ty class_def_raw_var;
- if (
- (class_def_raw_var = class_def_raw_rule(p)) // class_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ class_def[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "class_def_raw"));
- _res = class_def_raw_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s class_def[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "class_def_raw"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// class_def_raw: invalid_class_def_raw | 'class' NAME ['(' arguments? ')'] &&':' block
-static stmt_ty
-class_def_raw_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- stmt_ty _res = NULL;
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- if (p->call_invalid_rules) { // invalid_class_def_raw
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
- void *invalid_class_def_raw_var;
- if (
- (invalid_class_def_raw_var = invalid_class_def_raw_rule(p)) // invalid_class_def_raw
- )
- {
- D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_class_def_raw"));
- _res = invalid_class_def_raw_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_class_def_raw"));
+ D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
}
- { // 'class' NAME ['(' arguments? ')'] &&':' block
+ { // 'yield' star_expressions?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> class_def_raw[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+ D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
Token * _keyword;
- Token * _literal;
- expr_ty a;
- void *b;
- asdl_stmt_seq* c;
+ void *a;
if (
- (_keyword = _PyPegen_expect_token(p, 527)) // token='class'
- &&
- (a = _PyPegen_name_token(p)) // NAME
- &&
- (b = _tmp_85_rule(p), 1) // ['(' arguments? ')']
- &&
- (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':'
+ (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
&&
- (c = block_rule(p)) // block
+ (a = star_expressions_rule(p), 1) // star_expressions?
)
{
- D(fprintf(stderr, "%*c+ class_def_raw[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
+ D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -9759,61 +9933,7 @@ class_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 = _PyAST_ClassDef ( a -> v . Name . id , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , c , NULL , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s class_def_raw[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class' NAME ['(' arguments? ')'] &&':' block"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// block: NEWLINE INDENT statements DEDENT | simple_stmts | invalid_block
-static asdl_stmt_seq*
-block_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_stmt_seq* _res = NULL;
- if (_PyPegen_is_memoized(p, block_type, &_res)) {
- D(p->level--);
- return _res;
- }
- int _mark = p->mark;
- { // NEWLINE INDENT statements DEDENT
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
- asdl_stmt_seq* a;
- Token * dedent_var;
- Token * indent_var;
- Token * newline_var;
- if (
- (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
- &&
- (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
- &&
- (a = statements_rule(p)) // statements
- &&
- (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT'
- )
- {
- D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
- _res = a;
+ _res = _PyAST_Yield ( a , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -9822,50 +9942,11 @@ block_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT statements DEDENT"));
- }
- { // simple_stmts
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
- asdl_stmt_seq* simple_stmts_var;
- if (
- (simple_stmts_var = simple_stmts_rule(p)) // simple_stmts
- )
- {
- D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmts"));
- _res = simple_stmts_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmts"));
- }
- if (p->call_invalid_rules) { // invalid_block
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_block"));
- void *invalid_block_var;
- if (
- (invalid_block_var = invalid_block_rule(p)) // invalid_block
- )
- {
- D(fprintf(stderr, "%*c+ block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_block"));
- _res = invalid_block_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s block[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_block"));
+ D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
}
_res = NULL;
done:
- _PyPegen_insert_memo(p, _mark, block_type, _res);
D(p->level--);
return _res;
}
@@ -9906,7 +9987,7 @@ star_expressions_rule(Parser *p)
if (
(a = star_expression_rule(p)) // star_expression
&&
- (b = _loop1_86_rule(p)) // ((',' star_expression))+
+ (b = _loop1_78_rule(p)) // ((',' star_expression))+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -10101,7 +10182,7 @@ star_named_expressions_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
- (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.star_named_expression+
+ (a = (asdl_expr_seq*)_gather_79_rule(p)) // ','.star_named_expression+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -10354,1225 +10435,6 @@ named_expression_rule(Parser *p)
return _res;
}
-// annotated_rhs: yield_expr | star_expressions
-static expr_ty
-annotated_rhs_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- int _mark = p->mark;
- { // yield_expr
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
- expr_ty yield_expr_var;
- if (
- (yield_expr_var = yield_expr_rule(p)) // yield_expr
- )
- {
- D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
- _res = yield_expr_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
- }
- { // star_expressions
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> annotated_rhs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
- expr_ty star_expressions_var;
- if (
- (star_expressions_var = star_expressions_rule(p)) // star_expressions
- )
- {
- D(fprintf(stderr, "%*c+ annotated_rhs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
- _res = star_expressions_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s annotated_rhs[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// expressions: expression ((',' expression))+ ','? | expression ',' | expression
-static expr_ty
-expressions_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // expression ((',' expression))+ ','?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
- void *_opt_var;
- UNUSED(_opt_var); // Silence compiler warnings
- expr_ty a;
- asdl_seq * b;
- if (
- (a = expression_rule(p)) // expression
- &&
- (b = _loop1_89_rule(p)) // ((',' expression))+
- &&
- (_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
- )
- {
- D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ((',' expression))+ ','?"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_seq_insert_in_front ( p , a , b ) ) , Load , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ((',' expression))+ ','?"));
- }
- { // expression ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ','"));
- Token * _literal;
- expr_ty a;
- if (
- (a = expression_rule(p)) // expression
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ','"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Tuple ( CHECK ( asdl_expr_seq * , _PyPegen_singleton_seq ( p , a ) ) , Load , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ','"));
- }
- { // expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
- expr_ty expression_var;
- if (
- (expression_var = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
- _res = expression_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expressions[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// expression:
-// | invalid_expression
-// | disjunction 'if' disjunction 'else' expression
-// | disjunction
-// | lambdef
-static expr_ty
-expression_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- if (_PyPegen_is_memoized(p, expression_type, &_res)) {
- D(p->level--);
- return _res;
- }
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- if (p->call_invalid_rules) { // invalid_expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
- void *invalid_expression_var;
- if (
- (invalid_expression_var = invalid_expression_rule(p)) // invalid_expression
- )
- {
- D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_expression"));
- _res = invalid_expression_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_expression"));
- }
- { // disjunction 'if' disjunction 'else' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
- Token * _keyword;
- Token * _keyword_1;
- expr_ty a;
- expr_ty b;
- expr_ty c;
- if (
- (a = disjunction_rule(p)) // disjunction
- &&
- (_keyword = _PyPegen_expect_token(p, 510)) // token='if'
- &&
- (b = disjunction_rule(p)) // disjunction
- &&
- (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
- &&
- (c = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_IfExp ( b , a , c , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction 'if' disjunction 'else' expression"));
- }
- { // disjunction
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "disjunction"));
- expr_ty disjunction_var;
- if (
- (disjunction_var = disjunction_rule(p)) // disjunction
- )
- {
- D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction"));
- _res = disjunction_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "disjunction"));
- }
- { // lambdef
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> expression[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambdef"));
- expr_ty lambdef_var;
- if (
- (lambdef_var = lambdef_rule(p)) // lambdef
- )
- {
- D(fprintf(stderr, "%*c+ expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambdef"));
- _res = lambdef_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s expression[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambdef"));
- }
- _res = NULL;
- done:
- _PyPegen_insert_memo(p, _mark, expression_type, _res);
- D(p->level--);
- return _res;
-}
-
-// lambdef: 'lambda' lambda_params? ':' expression
-static expr_ty
-lambdef_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- expr_ty _res = NULL;
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // 'lambda' lambda_params? ':' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
- Token * _keyword;
- Token * _literal;
- void *a;
- expr_ty b;
- if (
- (_keyword = _PyPegen_expect_token(p, 528)) // token='lambda'
- &&
- (a = lambda_params_rule(p), 1) // lambda_params?
- &&
- (_literal = _PyPegen_expect_token(p, 11)) // token=':'
- &&
- (b = expression_rule(p)) // expression
- )
- {
- D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_params: invalid_lambda_parameters | lambda_parameters
-static arguments_ty
-lambda_params_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arguments_ty _res = NULL;
- int _mark = p->mark;
- if (p->call_invalid_rules) { // invalid_lambda_parameters
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
- void *invalid_lambda_parameters_var;
- if (
- (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
- )
- {
- D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
- _res = invalid_lambda_parameters_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
- }
- { // lambda_parameters
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
- arguments_ty lambda_parameters_var;
- if (
- (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
- )
- {
- D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
- _res = lambda_parameters_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_parameters:
-// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
-// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
-// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
-// | lambda_param_with_default+ lambda_star_etc?
-// | lambda_star_etc
-static arguments_ty
-lambda_parameters_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arguments_ty _res = NULL;
- int _mark = p->mark;
- { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
- asdl_arg_seq* a;
- asdl_arg_seq* b;
- asdl_seq * c;
- void *d;
- if (
- (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
- &&
- (b = (asdl_arg_seq*)_loop0_90_rule(p)) // lambda_param_no_default*
- &&
- (c = _loop0_91_rule(p)) // lambda_param_with_default*
- &&
- (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
- _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
- }
- { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
- SlashWithDefault* a;
- asdl_seq * b;
- void *c;
- if (
- (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
- &&
- (b = _loop0_92_rule(p)) // lambda_param_with_default*
- &&
- (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
- }
- { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
- asdl_arg_seq* a;
- asdl_seq * b;
- void *c;
- if (
- (a = (asdl_arg_seq*)_loop1_93_rule(p)) // lambda_param_no_default+
- &&
- (b = _loop0_94_rule(p)) // lambda_param_with_default*
- &&
- (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
- }
- { // lambda_param_with_default+ lambda_star_etc?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
- asdl_seq * a;
- void *b;
- if (
- (a = _loop1_95_rule(p)) // lambda_param_with_default+
- &&
- (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
- }
- { // lambda_star_etc
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
- StarEtc* a;
- if (
- (a = lambda_star_etc_rule(p)) // lambda_star_etc
- )
- {
- D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
- _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_slash_no_default:
-// | lambda_param_no_default+ '/' ','
-// | lambda_param_no_default+ '/' &':'
-static asdl_arg_seq*
-lambda_slash_no_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_arg_seq* _res = NULL;
- int _mark = p->mark;
- { // lambda_param_no_default+ '/' ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
- Token * _literal;
- Token * _literal_1;
- asdl_arg_seq* a;
- if (
- (a = (asdl_arg_seq*)_loop1_96_rule(p)) // lambda_param_no_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
- }
- { // lambda_param_no_default+ '/' &':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
- Token * _literal;
- asdl_arg_seq* a;
- if (
- (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_slash_with_default:
-// | lambda_param_no_default* lambda_param_with_default+ '/' ','
-// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
-static SlashWithDefault*
-lambda_slash_with_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- SlashWithDefault* _res = NULL;
- int _mark = p->mark;
- { // lambda_param_no_default* lambda_param_with_default+ '/' ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * a;
- asdl_seq * b;
- if (
- (a = _loop0_98_rule(p)) // lambda_param_no_default*
- &&
- (b = _loop1_99_rule(p)) // lambda_param_with_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
- _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
- }
- { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
- Token * _literal;
- asdl_seq * a;
- asdl_seq * b;
- if (
- (a = _loop0_100_rule(p)) // lambda_param_no_default*
- &&
- (b = _loop1_101_rule(p)) // lambda_param_with_default+
- &&
- (_literal = _PyPegen_expect_token(p, 17)) // token='/'
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
- _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_star_etc:
-// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
-// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
-// | lambda_kwds
-// | invalid_lambda_star_etc
-static StarEtc*
-lambda_star_etc_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- StarEtc* _res = NULL;
- int _mark = p->mark;
- { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
- Token * _literal;
- arg_ty a;
- asdl_seq * b;
- void *c;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
- &&
- (b = _loop0_102_rule(p)) // lambda_param_maybe_default*
- &&
- (c = lambda_kwds_rule(p), 1) // lambda_kwds?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
- _res = _PyPegen_star_etc ( p , a , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
- }
- { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
- Token * _literal;
- Token * _literal_1;
- asdl_seq * b;
- void *c;
- if (
- (_literal = _PyPegen_expect_token(p, 16)) // token='*'
- &&
- (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (b = _loop1_103_rule(p)) // lambda_param_maybe_default+
- &&
- (c = lambda_kwds_rule(p), 1) // lambda_kwds?
- )
- {
- D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
- _res = _PyPegen_star_etc ( p , NULL , b , c );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
- }
- { // lambda_kwds
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
- arg_ty a;
- if (
- (a = lambda_kwds_rule(p)) // lambda_kwds
- )
- {
- D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
- _res = _PyPegen_star_etc ( p , NULL , NULL , a );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
- }
- if (p->call_invalid_rules) { // invalid_lambda_star_etc
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
- void *invalid_lambda_star_etc_var;
- if (
- (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
- )
- {
- D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
- _res = invalid_lambda_star_etc_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_kwds: '**' lambda_param_no_default
-static arg_ty
-lambda_kwds_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arg_ty _res = NULL;
- int _mark = p->mark;
- { // '**' lambda_param_no_default
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
- Token * _literal;
- arg_ty a;
- if (
- (_literal = _PyPegen_expect_token(p, 35)) // token='**'
- &&
- (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
- )
- {
- D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_param_no_default: lambda_param ',' | lambda_param &':'
-static arg_ty
-lambda_param_no_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arg_ty _res = NULL;
- int _mark = p->mark;
- { // lambda_param ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
- Token * _literal;
- arg_ty a;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
- }
- { // lambda_param &':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
- arg_ty a;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
- _res = a;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
-static NameDefaultPair*
-lambda_param_with_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- NameDefaultPair* _res = NULL;
- int _mark = p->mark;
- { // lambda_param default ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
- Token * _literal;
- arg_ty a;
- expr_ty c;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- (c = default_rule(p)) // default
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
- _res = _PyPegen_name_default_pair ( p , a , c , NULL );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
- }
- { // lambda_param default &':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
- arg_ty a;
- expr_ty c;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- (c = default_rule(p)) // default
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
- _res = _PyPegen_name_default_pair ( p , a , c , NULL );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
-static NameDefaultPair*
-lambda_param_maybe_default_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- NameDefaultPair* _res = NULL;
- int _mark = p->mark;
- { // lambda_param default? ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
- Token * _literal;
- arg_ty a;
- void *c;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- (c = default_rule(p), 1) // default?
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
- _res = _PyPegen_name_default_pair ( p , a , c , NULL );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
- }
- { // lambda_param default? &':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
- arg_ty a;
- void *c;
- if (
- (a = lambda_param_rule(p)) // lambda_param
- &&
- (c = default_rule(p), 1) // default?
- &&
- _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
- _res = _PyPegen_name_default_pair ( p , a , c , NULL );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// lambda_param: NAME
-static arg_ty
-lambda_param_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- arg_ty _res = NULL;
- int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
- expr_ty a;
- if (
- (a = _PyPegen_name_token(p)) // NAME
- )
- {
- D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
// disjunction: conjunction (('or' conjunction))+ | conjunction
static expr_ty
disjunction_rule(Parser *p)
@@ -11608,7 +10470,7 @@ disjunction_rule(Parser *p)
if (
(a = conjunction_rule(p)) // conjunction
&&
- (b = _loop1_104_rule(p)) // (('or' conjunction))+
+ (b = _loop1_81_rule(p)) // (('or' conjunction))+
)
{
D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+"));
@@ -11694,7 +10556,7 @@ conjunction_rule(Parser *p)
if (
(a = inversion_rule(p)) // inversion
&&
- (b = _loop1_105_rule(p)) // (('and' inversion))+
+ (b = _loop1_82_rule(p)) // (('and' inversion))+
)
{
D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+"));
@@ -11778,7 +10640,7 @@ inversion_rule(Parser *p)
Token * _keyword;
expr_ty a;
if (
- (_keyword = _PyPegen_expect_token(p, 529)) // token='not'
+ (_keyword = _PyPegen_expect_token(p, 528)) // token='not'
&&
(a = inversion_rule(p)) // inversion
)
@@ -11862,7 +10724,7 @@ comparison_rule(Parser *p)
if (
(a = bitwise_or_rule(p)) // bitwise_or
&&
- (b = _loop1_106_rule(p)) // compare_op_bitwise_or_pair+
+ (b = _loop1_83_rule(p)) // compare_op_bitwise_or_pair+
)
{
D(fprintf(stderr, "%*c+ comparison[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "bitwise_or compare_op_bitwise_or_pair+"));
@@ -12190,10 +11052,10 @@ noteq_bitwise_or_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> noteq_bitwise_or[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('!=') bitwise_or"));
- void *_tmp_107_var;
+ void *_tmp_84_var;
expr_ty a;
if (
- (_tmp_107_var = _tmp_107_rule(p)) // '!='
+ (_tmp_84_var = _tmp_84_rule(p)) // '!='
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
@@ -12414,9 +11276,9 @@ notin_bitwise_or_rule(Parser *p)
Token * _keyword_1;
expr_ty a;
if (
- (_keyword = _PyPegen_expect_token(p, 529)) // token='not'
+ (_keyword = _PyPegen_expect_token(p, 528)) // token='not'
&&
- (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword_1 = _PyPegen_expect_token(p, 520)) // token='in'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
@@ -12460,7 +11322,7 @@ in_bitwise_or_rule(Parser *p)
Token * _keyword;
expr_ty a;
if (
- (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword = _PyPegen_expect_token(p, 520)) // token='in'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
@@ -12505,9 +11367,9 @@ isnot_bitwise_or_rule(Parser *p)
Token * _keyword_1;
expr_ty a;
if (
- (_keyword = _PyPegen_expect_token(p, 530)) // token='is'
+ (_keyword = _PyPegen_expect_token(p, 529)) // token='is'
&&
- (_keyword_1 = _PyPegen_expect_token(p, 529)) // token='not'
+ (_keyword_1 = _PyPegen_expect_token(p, 528)) // token='not'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
@@ -12551,7 +11413,7 @@ is_bitwise_or_rule(Parser *p)
Token * _keyword;
expr_ty a;
if (
- (_keyword = _PyPegen_expect_token(p, 530)) // token='is'
+ (_keyword = _PyPegen_expect_token(p, 529)) // token='is'
&&
(a = bitwise_or_rule(p)) // bitwise_or
)
@@ -14150,7 +13012,7 @@ slices_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
- (a = (asdl_expr_seq*)_gather_108_rule(p)) // ','.slice+
+ (a = (asdl_expr_seq*)_gather_85_rule(p)) // ','.slice+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -14220,7 +13082,7 @@ slice_rule(Parser *p)
&&
(b = expression_rule(p), 1) // expression?
&&
- (c = _tmp_110_rule(p), 1) // [':' expression?]
+ (c = _tmp_87_rule(p), 1) // [':' expression?]
)
{
D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]"));
@@ -14332,7 +13194,7 @@ atom_rule(Parser *p)
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 524)) // token='True'
+ (_keyword = _PyPegen_expect_token(p, 526)) // token='True'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
@@ -14365,7 +13227,7 @@ atom_rule(Parser *p)
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 525)) // token='False'
+ (_keyword = _PyPegen_expect_token(p, 527)) // token='False'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
@@ -14398,7 +13260,7 @@ atom_rule(Parser *p)
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 523)) // token='None'
+ (_keyword = _PyPegen_expect_token(p, 525)) // token='None'
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
@@ -14469,15 +13331,15 @@ atom_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
- void *_tmp_111_var;
+ void *_tmp_88_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='('
&&
- (_tmp_111_var = _tmp_111_rule(p)) // tuple | group | genexp
+ (_tmp_88_var = _tmp_88_rule(p)) // tuple | group | genexp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'(' (tuple | group | genexp)"));
- _res = _tmp_111_var;
+ _res = _tmp_88_var;
goto done;
}
p->mark = _mark;
@@ -14490,15 +13352,15 @@ atom_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
- void *_tmp_112_var;
+ void *_tmp_89_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='['
&&
- (_tmp_112_var = _tmp_112_rule(p)) // list | listcomp
+ (_tmp_89_var = _tmp_89_rule(p)) // list | listcomp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)"));
- _res = _tmp_112_var;
+ _res = _tmp_89_var;
goto done;
}
p->mark = _mark;
@@ -14511,15 +13373,15 @@ atom_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> atom[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
- void *_tmp_113_var;
+ void *_tmp_90_var;
if (
_PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{'
&&
- (_tmp_113_var = _tmp_113_rule(p)) // dict | set | dictcomp | setcomp
+ (_tmp_90_var = _tmp_90_rule(p)) // dict | set | dictcomp | setcomp
)
{
D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'{' (dict | set | dictcomp | setcomp)"));
- _res = _tmp_113_var;
+ _res = _tmp_90_var;
goto done;
}
p->mark = _mark;
@@ -14565,9 +13427,9 @@ atom_rule(Parser *p)
return _res;
}
-// strings: STRING+
+// group: '(' (yield_expr | named_expression) ')' | invalid_group
static expr_ty
-strings_rule(Parser *p)
+group_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -14575,24 +13437,26 @@ strings_rule(Parser *p)
return NULL;
}
expr_ty _res = NULL;
- if (_PyPegen_is_memoized(p, strings_type, &_res)) {
- D(p->level--);
- return _res;
- }
int _mark = p->mark;
- { // STRING+
+ { // '(' (yield_expr | named_expression) ')'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
- asdl_seq * a;
+ D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+ Token * _literal;
+ Token * _literal_1;
+ void *a;
if (
- (a = _loop1_114_rule(p)) // STRING+
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ &&
+ (a = _tmp_91_rule(p)) // yield_expr | named_expression
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
- _res = _PyPegen_concatenate_strings ( p , a );
+ D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+ _res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14601,19 +13465,37 @@ strings_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
+ D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+ }
+ if (p->call_invalid_rules) { // invalid_group
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
+ void *invalid_group_var;
+ if (
+ (invalid_group_var = invalid_group_rule(p)) // invalid_group
+ )
+ {
+ D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
+ _res = invalid_group_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
}
_res = NULL;
done:
- _PyPegen_insert_memo(p, _mark, strings_type, _res);
D(p->level--);
return _res;
}
-// list: '[' star_named_expressions? ']'
+// lambdef: 'lambda' lambda_params? ':' expression
static expr_ty
-list_rule(Parser *p)
+lambdef_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -14631,24 +13513,27 @@ list_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
- { // '[' star_named_expressions? ']'
+ { // 'lambda' lambda_params? ':' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
+ D(fprintf(stderr, "%*c> lambdef[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
+ Token * _keyword;
Token * _literal;
- Token * _literal_1;
void *a;
+ expr_ty b;
if (
- (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ (_keyword = _PyPegen_expect_token(p, 530)) // token='lambda'
&&
- (a = star_named_expressions_rule(p), 1) // star_named_expressions?
+ (a = lambda_params_rule(p), 1) // lambda_params?
&&
- (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
+ (_literal = _PyPegen_expect_token(p, 11)) // token=':'
+ &&
+ (b = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
+ D(fprintf(stderr, "%*c+ lambdef[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'lambda' lambda_params? ':' expression"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -14658,7 +13543,7 @@ list_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 = _PyAST_List ( a , Load , EXTRA );
+ _res = _PyAST_Lambda ( ( a ) ? a : CHECK ( arguments_ty , _PyPegen_empty_arguments ( p ) ) , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14667,8 +13552,8 @@ list_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
+ D(fprintf(stderr, "%*c%s lambdef[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'lambda' lambda_params? ':' expression"));
}
_res = NULL;
done:
@@ -14676,57 +13561,129 @@ list_rule(Parser *p)
return _res;
}
-// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
-static expr_ty
-listcomp_rule(Parser *p)
+// lambda_params: invalid_lambda_parameters | lambda_parameters
+static arguments_ty
+lambda_params_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ arguments_ty _res = NULL;
int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
+ if (p->call_invalid_rules) { // invalid_lambda_parameters
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
+ void *invalid_lambda_parameters_var;
+ if (
+ (invalid_lambda_parameters_var = invalid_lambda_parameters_rule(p)) // invalid_lambda_parameters
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_parameters"));
+ _res = invalid_lambda_parameters_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_parameters"));
+ }
+ { // lambda_parameters
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_params[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
+ arguments_ty lambda_parameters_var;
+ if (
+ (lambda_parameters_var = lambda_parameters_rule(p)) // lambda_parameters
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_params[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_parameters"));
+ _res = lambda_parameters_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_params[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_parameters"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// lambda_parameters:
+// | lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
+// | lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
+// | lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
+// | lambda_param_with_default+ lambda_star_etc?
+// | lambda_star_etc
+static arguments_ty
+lambda_parameters_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
D(p->level--);
return NULL;
}
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // '[' named_expression for_if_clauses ']'
+ arguments_ty _res = NULL;
+ int _mark = p->mark;
+ { // lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
- Token * _literal;
- Token * _literal_1;
- expr_ty a;
- asdl_comprehension_seq* b;
+ D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+ asdl_arg_seq* a;
+ asdl_arg_seq* b;
+ asdl_seq * c;
+ void *d;
if (
- (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default
&&
- (a = named_expression_rule(p)) // named_expression
+ (b = (asdl_arg_seq*)_loop0_92_rule(p)) // lambda_param_no_default*
&&
- (b = for_if_clauses_rule(p)) // for_if_clauses
+ (c = _loop0_93_rule(p)) // lambda_param_with_default*
&&
- (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
+ (d = lambda_star_etc_rule(p), 1) // lambda_star_etc?
)
{
- D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
+ D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+ _res = _PyPegen_make_arguments ( p , a , NULL , b , c , d );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
D(p->level--);
return NULL;
}
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_ListComp ( a , b , EXTRA );
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_no_default lambda_param_no_default* lambda_param_with_default* lambda_star_etc?"));
+ }
+ { // lambda_slash_with_default lambda_param_with_default* lambda_star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
+ SlashWithDefault* a;
+ asdl_seq * b;
+ void *c;
+ if (
+ (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default
+ &&
+ (b = _loop0_94_rule(p)) // lambda_param_with_default*
+ &&
+ (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , a , NULL , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14735,27 +13692,89 @@ listcomp_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
+ D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_slash_with_default lambda_param_with_default* lambda_star_etc?"));
}
- if (p->call_invalid_rules) { // invalid_comprehension
+ { // lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- void *invalid_comprehension_var;
+ D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+ asdl_arg_seq* a;
+ asdl_seq * b;
+ void *c;
if (
- (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
+ (a = (asdl_arg_seq*)_loop1_95_rule(p)) // lambda_param_no_default+
+ &&
+ (b = _loop0_96_rule(p)) // lambda_param_with_default*
+ &&
+ (c = lambda_star_etc_rule(p), 1) // lambda_star_etc?
)
{
- D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- _res = invalid_comprehension_var;
+ D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , a , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ lambda_param_with_default* lambda_star_etc?"));
+ }
+ { // lambda_param_with_default+ lambda_star_etc?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+ asdl_seq * a;
+ void *b;
+ if (
+ (a = _loop1_97_rule(p)) // lambda_param_with_default+
+ &&
+ (b = lambda_star_etc_rule(p), 1) // lambda_star_etc?
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default+ lambda_star_etc?"));
+ }
+ { // lambda_star_etc
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
+ StarEtc* a;
+ if (
+ (a = lambda_star_etc_rule(p)) // lambda_star_etc
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_parameters[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_star_etc"));
+ _res = _PyPegen_make_arguments ( p , NULL , NULL , NULL , NULL , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_parameters[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_star_etc"));
}
_res = NULL;
done:
@@ -14763,54 +13782,151 @@ listcomp_rule(Parser *p)
return _res;
}
-// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
-static expr_ty
-tuple_rule(Parser *p)
+// lambda_slash_no_default:
+// | lambda_param_no_default+ '/' ','
+// | lambda_param_no_default+ '/' &':'
+static asdl_arg_seq*
+lambda_slash_no_default_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ asdl_arg_seq* _res = NULL;
int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
+ { // lambda_param_no_default+ '/' ','
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+ Token * _literal;
+ Token * _literal_1;
+ asdl_arg_seq* a;
+ if (
+ (a = (asdl_arg_seq*)_loop1_98_rule(p)) // lambda_param_no_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' ','"));
+ }
+ { // lambda_param_no_default+ '/' &':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_slash_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+ Token * _literal;
+ asdl_arg_seq* a;
+ if (
+ (a = (asdl_arg_seq*)_loop1_99_rule(p)) // lambda_param_no_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_slash_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_slash_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default+ '/' &':'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// lambda_slash_with_default:
+// | lambda_param_no_default* lambda_param_with_default+ '/' ','
+// | lambda_param_no_default* lambda_param_with_default+ '/' &':'
+static SlashWithDefault*
+lambda_slash_with_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
D(p->level--);
return NULL;
}
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // '(' [star_named_expression ',' star_named_expressions?] ')'
+ SlashWithDefault* _res = NULL;
+ int _mark = p->mark;
+ { // lambda_param_no_default* lambda_param_with_default+ '/' ','
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
+ D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
Token * _literal;
Token * _literal_1;
- void *a;
+ asdl_seq * a;
+ asdl_seq * b;
if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ (a = _loop0_100_rule(p)) // lambda_param_no_default*
&&
- (a = _tmp_115_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
+ (b = _loop1_101_rule(p)) // lambda_param_with_default+
&&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
)
{
- D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
+ D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
+ _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
D(p->level--);
return NULL;
}
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Tuple ( a , Load , EXTRA );
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' ','"));
+ }
+ { // lambda_param_no_default* lambda_param_with_default+ '/' &':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_slash_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
+ Token * _literal;
+ asdl_seq * a;
+ asdl_seq * b;
+ if (
+ (a = _loop0_102_rule(p)) // lambda_param_no_default*
+ &&
+ (b = _loop1_103_rule(p)) // lambda_param_with_default+
+ &&
+ (_literal = _PyPegen_expect_token(p, 17)) // token='/'
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_slash_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
+ _res = _PyPegen_slash_with_default ( p , ( asdl_arg_seq * ) a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14819,8 +13935,8 @@ tuple_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
+ D(fprintf(stderr, "%*c%s lambda_slash_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default* lambda_param_with_default+ '/' &':'"));
}
_res = NULL;
done:
@@ -14828,36 +13944,76 @@ tuple_rule(Parser *p)
return _res;
}
-// group: '(' (yield_expr | named_expression) ')' | invalid_group
-static expr_ty
-group_rule(Parser *p)
+// lambda_star_etc:
+// | '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
+// | '*' ',' lambda_param_maybe_default+ lambda_kwds?
+// | lambda_kwds
+// | invalid_lambda_star_etc
+static StarEtc*
+lambda_star_etc_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ StarEtc* _res = NULL;
int _mark = p->mark;
- { // '(' (yield_expr | named_expression) ')'
+ { // '*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+ D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+ Token * _literal;
+ arg_ty a;
+ asdl_seq * b;
+ void *c;
+ if (
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
+ &&
+ (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ &&
+ (b = _loop0_104_rule(p)) // lambda_param_maybe_default*
+ &&
+ (c = lambda_kwds_rule(p), 1) // lambda_kwds?
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+ _res = _PyPegen_star_etc ( p , a , b , c );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' lambda_param_no_default lambda_param_maybe_default* lambda_kwds?"));
+ }
+ { // '*' ',' lambda_param_maybe_default+ lambda_kwds?
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
Token * _literal;
Token * _literal_1;
- void *a;
+ asdl_seq * b;
+ void *c;
if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
- (a = _tmp_116_rule(p)) // yield_expr | named_expression
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (b = _loop1_105_rule(p)) // lambda_param_maybe_default+
+ &&
+ (c = lambda_kwds_rule(p), 1) // lambda_kwds?
)
{
- D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
- _res = a;
+ D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
+ _res = _PyPegen_star_etc ( p , NULL , b , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14866,27 +14022,51 @@ group_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (yield_expr | named_expression) ')'"));
+ D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' ',' lambda_param_maybe_default+ lambda_kwds?"));
}
- if (p->call_invalid_rules) { // invalid_group
+ { // lambda_kwds
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> group[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_group"));
- void *invalid_group_var;
+ D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
+ arg_ty a;
if (
- (invalid_group_var = invalid_group_rule(p)) // invalid_group
+ (a = lambda_kwds_rule(p)) // lambda_kwds
)
{
- D(fprintf(stderr, "%*c+ group[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_group"));
- _res = invalid_group_var;
+ D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_kwds"));
+ _res = _PyPegen_star_etc ( p , NULL , NULL , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s group[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_group"));
+ D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_kwds"));
+ }
+ if (p->call_invalid_rules) { // invalid_lambda_star_etc
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
+ void *invalid_lambda_star_etc_var;
+ if (
+ (invalid_lambda_star_etc_var = invalid_lambda_star_etc_rule(p)) // invalid_lambda_star_etc
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_lambda_star_etc"));
+ _res = invalid_lambda_star_etc_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_star_etc[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_lambda_star_etc"));
}
_res = NULL;
done:
@@ -14894,59 +14074,179 @@ group_rule(Parser *p)
return _res;
}
-// genexp:
-// | '(' (assigment_expression | expression !':=') for_if_clauses ')'
-// | invalid_comprehension
-static expr_ty
-genexp_rule(Parser *p)
+// lambda_kwds: '**' lambda_param_no_default
+static arg_ty
+lambda_kwds_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ arg_ty _res = NULL;
int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
+ { // '**' lambda_param_no_default
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_kwds[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
+ Token * _literal;
+ arg_ty a;
+ if (
+ (_literal = _PyPegen_expect_token(p, 35)) // token='**'
+ &&
+ (a = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_kwds[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' lambda_param_no_default"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_kwds[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' lambda_param_no_default"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// lambda_param_no_default: lambda_param ',' | lambda_param &':'
+static arg_ty
+lambda_param_no_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
D(p->level--);
return NULL;
}
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // '(' (assigment_expression | expression !':=') for_if_clauses ')'
+ arg_ty _res = NULL;
+ int _mark = p->mark;
+ { // lambda_param ','
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
+ D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
Token * _literal;
- Token * _literal_1;
- void *a;
- asdl_comprehension_seq* b;
+ arg_ty a;
if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ (a = lambda_param_rule(p)) // lambda_param
&&
- (a = _tmp_117_rule(p)) // assigment_expression | expression !':='
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param ','"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param ','"));
+ }
+ { // lambda_param &':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_param_no_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
+ arg_ty a;
+ if (
+ (a = lambda_param_rule(p)) // lambda_param
&&
- (b = for_if_clauses_rule(p)) // for_if_clauses
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_param_no_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param &':'"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_param_no_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param &':'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// lambda_param_with_default: lambda_param default ',' | lambda_param default &':'
+static NameDefaultPair*
+lambda_param_with_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ NameDefaultPair* _res = NULL;
+ int _mark = p->mark;
+ { // lambda_param default ','
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
+ Token * _literal;
+ arg_ty a;
+ expr_ty c;
+ if (
+ (a = lambda_param_rule(p)) // lambda_param
&&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (c = default_rule(p)) // default
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
- D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
+ D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default ','"));
+ _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
D(p->level--);
return NULL;
}
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_GeneratorExp ( a , b , EXTRA );
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default ','"));
+ }
+ { // lambda_param default &':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_param_with_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
+ arg_ty a;
+ expr_ty c;
+ if (
+ (a = lambda_param_rule(p)) // lambda_param
+ &&
+ (c = default_rule(p)) // default
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_param_with_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default &':'"));
+ _res = _PyPegen_name_default_pair ( p , a , c , NULL );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -14955,27 +14255,84 @@ genexp_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
+ D(fprintf(stderr, "%*c%s lambda_param_with_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default &':'"));
}
- if (p->call_invalid_rules) { // invalid_comprehension
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// lambda_param_maybe_default: lambda_param default? ',' | lambda_param default? &':'
+static NameDefaultPair*
+lambda_param_maybe_default_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ NameDefaultPair* _res = NULL;
+ int _mark = p->mark;
+ { // lambda_param default? ','
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- void *invalid_comprehension_var;
+ D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
+ Token * _literal;
+ arg_ty a;
+ void *c;
if (
- (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
+ (a = lambda_param_rule(p)) // lambda_param
+ &&
+ (c = default_rule(p), 1) // default?
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
- D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- _res = invalid_comprehension_var;
+ D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? ','"));
+ _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? ','"));
+ }
+ { // lambda_param default? &':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> lambda_param_maybe_default[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
+ arg_ty a;
+ void *c;
+ if (
+ (a = lambda_param_rule(p)) // lambda_param
+ &&
+ (c = default_rule(p), 1) // default?
+ &&
+ _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 11) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ lambda_param_maybe_default[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param default? &':'"));
+ _res = _PyPegen_name_default_pair ( p , a , c , NULL );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s lambda_param_maybe_default[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param default? &':'"));
}
_res = NULL;
done:
@@ -14983,16 +14340,16 @@ genexp_rule(Parser *p)
return _res;
}
-// set: '{' star_named_expressions '}'
-static expr_ty
-set_rule(Parser *p)
+// lambda_param: NAME
+static arg_ty
+lambda_param_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ arg_ty _res = NULL;
int _mark = p->mark;
if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
p->error_indicator = 1;
@@ -15003,24 +14360,18 @@ set_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
- { // '{' star_named_expressions '}'
+ { // NAME
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
- Token * _literal;
- Token * _literal_1;
- asdl_expr_seq* a;
+ D(fprintf(stderr, "%*c> lambda_param[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME"));
+ expr_ty a;
if (
- (_literal = _PyPegen_expect_token(p, 25)) // token='{'
- &&
- (a = star_named_expressions_rule(p)) // star_named_expressions
- &&
- (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
+ (a = _PyPegen_name_token(p)) // NAME
)
{
- D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
+ D(fprintf(stderr, "%*c+ lambda_param[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15030,7 +14381,7 @@ set_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 = _PyAST_Set ( a , EXTRA );
+ _res = _PyAST_arg ( a -> v . Name . id , NULL , NULL , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15039,8 +14390,8 @@ set_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
+ D(fprintf(stderr, "%*c%s lambda_param[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME"));
}
_res = NULL;
done:
@@ -15048,9 +14399,55 @@ set_rule(Parser *p)
return _res;
}
-// setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension
+// strings: STRING+
static expr_ty
-setcomp_rule(Parser *p)
+strings_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ if (_PyPegen_is_memoized(p, strings_type, &_res)) {
+ D(p->level--);
+ return _res;
+ }
+ int _mark = p->mark;
+ { // STRING+
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> strings[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING+"));
+ asdl_seq * a;
+ if (
+ (a = _loop1_106_rule(p)) // STRING+
+ )
+ {
+ D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+"));
+ _res = _PyPegen_concatenate_strings ( p , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s strings[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING+"));
+ }
+ _res = NULL;
+ done:
+ _PyPegen_insert_memo(p, _mark, strings_type, _res);
+ D(p->level--);
+ return _res;
+}
+
+// list: '[' star_named_expressions? ']'
+static expr_ty
+list_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -15068,27 +14465,24 @@ setcomp_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
- { // '{' named_expression for_if_clauses '}'
+ { // '[' star_named_expressions? ']'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+ D(fprintf(stderr, "%*c> list[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
Token * _literal;
Token * _literal_1;
- expr_ty a;
- asdl_comprehension_seq* b;
+ void *a;
if (
- (_literal = _PyPegen_expect_token(p, 25)) // token='{'
- &&
- (a = named_expression_rule(p)) // named_expression
+ (_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
- (b = for_if_clauses_rule(p)) // for_if_clauses
+ (a = star_named_expressions_rule(p), 1) // star_named_expressions?
&&
- (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
+ (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
- D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+ D(fprintf(stderr, "%*c+ list[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' star_named_expressions? ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15098,7 +14492,7 @@ setcomp_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 = _PyAST_SetComp ( a , b , EXTRA );
+ _res = _PyAST_List ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15107,27 +14501,8 @@ setcomp_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
- }
- if (p->call_invalid_rules) { // invalid_comprehension
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- void *invalid_comprehension_var;
- if (
- (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
- )
- {
- D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
- _res = invalid_comprehension_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ D(fprintf(stderr, "%*c%s list[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' star_named_expressions? ']'"));
}
_res = NULL;
done:
@@ -15135,9 +14510,9 @@ setcomp_rule(Parser *p)
return _res;
}
-// dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
+// tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
static expr_ty
-dict_rule(Parser *p)
+tuple_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -15155,24 +14530,24 @@ dict_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
- { // '{' double_starred_kvpairs? '}'
+ { // '(' [star_named_expression ',' star_named_expressions?] ')'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+ D(fprintf(stderr, "%*c> tuple[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
Token * _literal;
Token * _literal_1;
void *a;
if (
- (_literal = _PyPegen_expect_token(p, 25)) // token='{'
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
- (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
+ (a = _tmp_107_rule(p), 1) // [star_named_expression ',' star_named_expressions?]
&&
- (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+ D(fprintf(stderr, "%*c+ tuple[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15182,7 +14557,7 @@ dict_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 = _PyAST_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA );
+ _res = _PyAST_Tuple ( a , Load , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15191,33 +14566,73 @@ dict_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
+ D(fprintf(stderr, "%*c%s tuple[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' [star_named_expression ',' star_named_expressions?] ')'"));
}
- { // '{' invalid_double_starred_kvpairs '}'
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// set: '{' star_named_expressions '}'
+static expr_ty
+set_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // '{' star_named_expressions '}'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+ D(fprintf(stderr, "%*c> set[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
Token * _literal;
Token * _literal_1;
- void *invalid_double_starred_kvpairs_var;
+ asdl_expr_seq* a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
- (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs
+ (a = star_named_expressions_rule(p)) // star_named_expressions
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
- D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
- _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1);
+ D(fprintf(stderr, "%*c+ set[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' star_named_expressions '}'"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Set ( a , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+ D(fprintf(stderr, "%*c%s set[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' star_named_expressions '}'"));
}
_res = NULL;
done:
@@ -15225,9 +14640,9 @@ dict_rule(Parser *p)
return _res;
}
-// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
+// dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
static expr_ty
-dictcomp_rule(Parser *p)
+dict_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -15245,27 +14660,24 @@ dictcomp_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
- { // '{' kvpair for_if_clauses '}'
+ { // '{' double_starred_kvpairs? '}'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
Token * _literal;
Token * _literal_1;
- KeyValuePair* a;
- asdl_comprehension_seq* b;
+ void *a;
if (
(_literal = _PyPegen_expect_token(p, 25)) // token='{'
&&
- (a = kvpair_rule(p)) // kvpair
- &&
- (b = for_if_clauses_rule(p)) // for_if_clauses
+ (a = double_starred_kvpairs_rule(p), 1) // double_starred_kvpairs?
&&
(_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
- D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15275,7 +14687,7 @@ dictcomp_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 = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
+ _res = _PyAST_Dict ( CHECK ( asdl_expr_seq * , _PyPegen_get_keys ( p , a ) ) , CHECK ( asdl_expr_seq * , _PyPegen_get_values ( p , a ) ) , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15284,27 +14696,33 @@ dictcomp_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' double_starred_kvpairs? '}'"));
}
- if (p->call_invalid_rules) { // invalid_dict_comprehension
+ { // '{' invalid_double_starred_kvpairs '}'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
- void *invalid_dict_comprehension_var;
+ D(fprintf(stderr, "%*c> dict[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+ Token * _literal;
+ Token * _literal_1;
+ void *invalid_double_starred_kvpairs_var;
if (
- (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
+ (_literal = _PyPegen_expect_token(p, 25)) // token='{'
+ &&
+ (invalid_double_starred_kvpairs_var = invalid_double_starred_kvpairs_rule(p)) // invalid_double_starred_kvpairs
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
)
{
- D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
- _res = invalid_dict_comprehension_var;
+ D(fprintf(stderr, "%*c+ dict[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
+ _res = _PyPegen_dummy_name(p, _literal, invalid_double_starred_kvpairs_var, _literal_1);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
+ D(fprintf(stderr, "%*c%s dict[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' invalid_double_starred_kvpairs '}'"));
}
_res = NULL;
done:
@@ -15333,7 +14751,7 @@ double_starred_kvpairs_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_seq * a;
if (
- (a = _gather_118_rule(p)) // ','.double_starred_kvpair+
+ (a = _gather_108_rule(p)) // ','.double_starred_kvpair+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -15486,7 +14904,7 @@ for_if_clauses_rule(Parser *p)
D(fprintf(stderr, "%*c> for_if_clauses[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
asdl_comprehension_seq* a;
if (
- (a = (asdl_comprehension_seq*)_loop1_120_rule(p)) // for_if_clause+
+ (a = (asdl_comprehension_seq*)_loop1_110_rule(p)) // for_if_clause+
)
{
D(fprintf(stderr, "%*c+ for_if_clauses[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "for_if_clause+"));
@@ -15538,17 +14956,17 @@ for_if_clause_rule(Parser *p)
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
&&
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
&&
(a = star_targets_rule(p)) // star_targets
&&
- (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword_1 = _PyPegen_expect_token(p, 520)) // token='in'
&&
(_cut_var = 1)
&&
(b = disjunction_rule(p)) // disjunction
&&
- (c = (asdl_expr_seq*)_loop0_121_rule(p)) // (('if' disjunction))*
+ (c = (asdl_expr_seq*)_loop0_111_rule(p)) // (('if' disjunction))*
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC 'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
@@ -15581,17 +14999,17 @@ for_if_clause_rule(Parser *p)
expr_ty b;
asdl_expr_seq* c;
if (
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
&&
(a = star_targets_rule(p)) // star_targets
&&
- (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword_1 = _PyPegen_expect_token(p, 520)) // token='in'
&&
(_cut_var = 1)
&&
(b = disjunction_rule(p)) // disjunction
&&
- (c = (asdl_expr_seq*)_loop0_122_rule(p)) // (('if' disjunction))*
+ (c = (asdl_expr_seq*)_loop0_112_rule(p)) // (('if' disjunction))*
)
{
D(fprintf(stderr, "%*c+ for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for' star_targets 'in' ~ disjunction (('if' disjunction))*"));
@@ -15636,9 +15054,9 @@ for_if_clause_rule(Parser *p)
return _res;
}
-// yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
+// listcomp: '[' named_expression for_if_clauses ']' | invalid_comprehension
static expr_ty
-yield_expr_rule(Parser *p)
+listcomp_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -15656,24 +15074,27 @@ yield_expr_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
- { // 'yield' 'from' expression
+ { // '[' named_expression for_if_clauses ']'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
- Token * _keyword;
- Token * _keyword_1;
+ D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
+ Token * _literal;
+ Token * _literal_1;
expr_ty a;
+ asdl_comprehension_seq* b;
if (
- (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
+ (_literal = _PyPegen_expect_token(p, 9)) // token='['
&&
- (_keyword_1 = _PyPegen_expect_token(p, 514)) // token='from'
+ (a = named_expression_rule(p)) // named_expression
&&
- (a = expression_rule(p)) // expression
+ (b = for_if_clauses_rule(p)) // for_if_clauses
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
)
{
- D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' 'from' expression"));
+ D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15683,7 +15104,7 @@ yield_expr_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 = _PyAST_YieldFrom ( a , EXTRA );
+ _res = _PyAST_ListComp ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15692,24 +15113,164 @@ yield_expr_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' 'from' expression"));
+ D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'[' named_expression for_if_clauses ']'"));
}
- { // 'yield' star_expressions?
+ if (p->call_invalid_rules) { // invalid_comprehension
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> yield_expr[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
- Token * _keyword;
+ D(fprintf(stderr, "%*c> listcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ void *invalid_comprehension_var;
+ if (
+ (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
+ )
+ {
+ D(fprintf(stderr, "%*c+ listcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ _res = invalid_comprehension_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s listcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// setcomp: '{' named_expression for_if_clauses '}' | invalid_comprehension
+static expr_ty
+setcomp_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // '{' named_expression for_if_clauses '}'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+ Token * _literal;
+ Token * _literal_1;
+ expr_ty a;
+ asdl_comprehension_seq* b;
+ if (
+ (_literal = _PyPegen_expect_token(p, 25)) // token='{'
+ &&
+ (a = named_expression_rule(p)) // named_expression
+ &&
+ (b = for_if_clauses_rule(p)) // for_if_clauses
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
+ )
+ {
+ D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_SetComp ( a , b , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' named_expression for_if_clauses '}'"));
+ }
+ if (p->call_invalid_rules) { // invalid_comprehension
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> setcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ void *invalid_comprehension_var;
+ if (
+ (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
+ )
+ {
+ D(fprintf(stderr, "%*c+ setcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ _res = invalid_comprehension_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s setcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// genexp:
+// | '(' (assigment_expression | expression !':=') for_if_clauses ')'
+// | invalid_comprehension
+static expr_ty
+genexp_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // '(' (assigment_expression | expression !':=') for_if_clauses ')'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
+ Token * _literal;
+ Token * _literal_1;
void *a;
+ asdl_comprehension_seq* b;
if (
- (_keyword = _PyPegen_expect_token(p, 504)) // token='yield'
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
- (a = star_expressions_rule(p), 1) // star_expressions?
+ (a = _tmp_113_rule(p)) // assigment_expression | expression !':='
+ &&
+ (b = for_if_clauses_rule(p)) // for_if_clauses
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ yield_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'yield' star_expressions?"));
+ D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
if (_token == NULL) {
D(p->level--);
@@ -15719,7 +15280,7 @@ yield_expr_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 = _PyAST_Yield ( a , EXTRA );
+ _res = _PyAST_GeneratorExp ( a , b , EXTRA );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -15728,8 +15289,114 @@ yield_expr_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s yield_expr[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'yield' star_expressions?"));
+ D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' (assigment_expression | expression !':=') for_if_clauses ')'"));
+ }
+ if (p->call_invalid_rules) { // invalid_comprehension
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ void *invalid_comprehension_var;
+ if (
+ (invalid_comprehension_var = invalid_comprehension_rule(p)) // invalid_comprehension
+ )
+ {
+ D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_comprehension"));
+ _res = invalid_comprehension_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_comprehension"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// dictcomp: '{' kvpair for_if_clauses '}' | invalid_dict_comprehension
+static expr_ty
+dictcomp_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // '{' kvpair for_if_clauses '}'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ Token * _literal;
+ Token * _literal_1;
+ KeyValuePair* a;
+ asdl_comprehension_seq* b;
+ if (
+ (_literal = _PyPegen_expect_token(p, 25)) // token='{'
+ &&
+ (a = kvpair_rule(p)) // kvpair
+ &&
+ (b = for_if_clauses_rule(p)) // for_if_clauses
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 26)) // token='}'
+ )
+ {
+ D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_DictComp ( a -> key , a -> value , b , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{' kvpair for_if_clauses '}'"));
+ }
+ if (p->call_invalid_rules) { // invalid_dict_comprehension
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> dictcomp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
+ void *invalid_dict_comprehension_var;
+ if (
+ (invalid_dict_comprehension_var = invalid_dict_comprehension_rule(p)) // invalid_dict_comprehension
+ )
+ {
+ D(fprintf(stderr, "%*c+ dictcomp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_dict_comprehension"));
+ _res = invalid_dict_comprehension_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s dictcomp[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_dict_comprehension"));
}
_res = NULL;
done:
@@ -15839,9 +15506,9 @@ args_rule(Parser *p)
asdl_expr_seq* a;
void *b;
if (
- (a = (asdl_expr_seq*)_gather_123_rule(p)) // ','.(starred_expression | (assigment_expression | expression !':=') !'=')+
+ (a = (asdl_expr_seq*)_gather_114_rule(p)) // ','.(starred_expression | (assigment_expression | expression !':=') !'=')+
&&
- (b = _tmp_125_rule(p), 1) // [',' kwargs]
+ (b = _tmp_116_rule(p), 1) // [',' kwargs]
)
{
D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assigment_expression | expression !':=') !'=')+ [',' kwargs]"));
@@ -15929,11 +15596,11 @@ kwargs_rule(Parser *p)
asdl_seq * a;
asdl_seq * b;
if (
- (a = _gather_126_rule(p)) // ','.kwarg_or_starred+
+ (a = _gather_117_rule(p)) // ','.kwarg_or_starred+
&&
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (b = _gather_128_rule(p)) // ','.kwarg_or_double_starred+
+ (b = _gather_119_rule(p)) // ','.kwarg_or_double_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+"));
@@ -15955,13 +15622,13 @@ kwargs_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
- asdl_seq * _gather_130_var;
+ asdl_seq * _gather_121_var;
if (
- (_gather_130_var = _gather_130_rule(p)) // ','.kwarg_or_starred+
+ (_gather_121_var = _gather_121_rule(p)) // ','.kwarg_or_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_starred+"));
- _res = _gather_130_var;
+ _res = _gather_121_var;
goto done;
}
p->mark = _mark;
@@ -15974,13 +15641,13 @@ kwargs_rule(Parser *p)
return NULL;
}
D(fprintf(stderr, "%*c> kwargs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
- asdl_seq * _gather_132_var;
+ asdl_seq * _gather_123_var;
if (
- (_gather_132_var = _gather_132_rule(p)) // ','.kwarg_or_double_starred+
+ (_gather_123_var = _gather_123_rule(p)) // ','.kwarg_or_double_starred+
)
{
D(fprintf(stderr, "%*c+ kwargs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.kwarg_or_double_starred+"));
- _res = _gather_132_var;
+ _res = _gather_123_var;
goto done;
}
p->mark = _mark;
@@ -16342,7 +16009,7 @@ star_targets_rule(Parser *p)
if (
(a = star_target_rule(p)) // star_target
&&
- (b = _loop0_134_rule(p)) // ((',' star_target))*
+ (b = _loop0_125_rule(p)) // ((',' star_target))*
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -16396,7 +16063,7 @@ star_targets_list_seq_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
- (a = (asdl_expr_seq*)_gather_135_rule(p)) // ','.star_target+
+ (a = (asdl_expr_seq*)_gather_126_rule(p)) // ','.star_target+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -16444,7 +16111,7 @@ star_targets_tuple_seq_rule(Parser *p)
if (
(a = star_target_rule(p)) // star_target
&&
- (b = _loop1_137_rule(p)) // ((',' star_target))+
+ (b = _loop1_128_rule(p)) // ((',' star_target))+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -16530,7 +16197,7 @@ star_target_rule(Parser *p)
if (
(_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
- (a = _tmp_138_rule(p)) // !'*' star_target
+ (a = _tmp_129_rule(p)) // !'*' star_target
)
{
D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)"));
@@ -17084,6 +16751,338 @@ single_subscript_attribute_target_rule(Parser *p)
return _res;
}
+// Left-recursive
+// t_primary:
+// | t_primary '.' NAME &t_lookahead
+// | t_primary '[' slices ']' &t_lookahead
+// | t_primary genexp &t_lookahead
+// | t_primary '(' arguments? ')' &t_lookahead
+// | atom &t_lookahead
+static expr_ty t_primary_raw(Parser *);
+static expr_ty
+t_primary_rule(Parser *p)
+{
+ D(p->level++);
+ expr_ty _res = NULL;
+ if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
+ D(p->level--);
+ return _res;
+ }
+ int _mark = p->mark;
+ int _resmark = p->mark;
+ while (1) {
+ int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
+ if (tmpvar_9) {
+ D(p->level--);
+ return _res;
+ }
+ p->mark = _mark;
+ p->in_raw_rule++;
+ void *_raw = t_primary_raw(p);
+ p->in_raw_rule--;
+ if (p->error_indicator)
+ return NULL;
+ if (_raw == NULL || p->mark <= _resmark)
+ break;
+ _resmark = p->mark;
+ _res = _raw;
+ }
+ p->mark = _resmark;
+ D(p->level--);
+ return _res;
+}
+static expr_ty
+t_primary_raw(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ expr_ty _res = NULL;
+ int _mark = p->mark;
+ if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ int _start_lineno = p->tokens[_mark]->lineno;
+ 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
+ { // t_primary '.' NAME &t_lookahead
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+ Token * _literal;
+ expr_ty a;
+ expr_ty b;
+ if (
+ (a = t_primary_rule(p)) // t_primary
+ &&
+ (_literal = _PyPegen_expect_token(p, 23)) // token='.'
+ &&
+ (b = _PyPegen_name_token(p)) // NAME
+ &&
+ _PyPegen_lookahead(1, t_lookahead_rule, p)
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+ }
+ { // t_primary '[' slices ']' &t_lookahead
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+ Token * _literal;
+ Token * _literal_1;
+ expr_ty a;
+ expr_ty b;
+ if (
+ (a = t_primary_rule(p)) // t_primary
+ &&
+ (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ &&
+ (b = slices_rule(p)) // slices
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
+ &&
+ _PyPegen_lookahead(1, t_lookahead_rule, p)
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Subscript ( a , b , Load , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+ }
+ { // t_primary genexp &t_lookahead
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
+ expr_ty a;
+ expr_ty b;
+ if (
+ (a = t_primary_rule(p)) // t_primary
+ &&
+ (b = genexp_rule(p)) // genexp
+ &&
+ _PyPegen_lookahead(1, t_lookahead_rule, p)
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
+ }
+ { // t_primary '(' arguments? ')' &t_lookahead
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+ Token * _literal;
+ Token * _literal_1;
+ expr_ty a;
+ void *b;
+ if (
+ (a = t_primary_rule(p)) // t_primary
+ &&
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ &&
+ (b = arguments_rule(p), 1) // arguments?
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ &&
+ _PyPegen_lookahead(1, t_lookahead_rule, p)
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+ Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
+ if (_token == NULL) {
+ D(p->level--);
+ return NULL;
+ }
+ int _end_lineno = _token->end_lineno;
+ 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 = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+ }
+ { // atom &t_lookahead
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+ expr_ty a;
+ if (
+ (a = atom_rule(p)) // atom
+ &&
+ _PyPegen_lookahead(1, t_lookahead_rule, p)
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+ _res = a;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// t_lookahead: '(' | '[' | '.'
+static void *
+t_lookahead_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // '('
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ }
+ { // '['
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+ }
+ { // '.'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 23)) // token='.'
+ )
+ {
+ D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
// del_targets: ','.del_target+ ','?
static asdl_expr_seq*
del_targets_rule(Parser *p)
@@ -17105,7 +17104,7 @@ del_targets_rule(Parser *p)
UNUSED(_opt_var); // Silence compiler warnings
asdl_expr_seq* a;
if (
- (a = (asdl_expr_seq*)_gather_139_rule(p)) // ','.del_target+
+ (a = (asdl_expr_seq*)_gather_130_rule(p)) // ','.del_target+
&&
(_opt_var = _PyPegen_expect_token(p, 12), 1) // ','?
)
@@ -17425,95 +17424,55 @@ del_t_atom_rule(Parser *p)
return _res;
}
-// Left-recursive
-// t_primary:
-// | t_primary '.' NAME &t_lookahead
-// | t_primary '[' slices ']' &t_lookahead
-// | t_primary genexp &t_lookahead
-// | t_primary '(' arguments? ')' &t_lookahead
-// | atom &t_lookahead
-static expr_ty t_primary_raw(Parser *);
-static expr_ty
-t_primary_rule(Parser *p)
-{
- D(p->level++);
- expr_ty _res = NULL;
- if (_PyPegen_is_memoized(p, t_primary_type, &_res)) {
- D(p->level--);
- return _res;
- }
- int _mark = p->mark;
- int _resmark = p->mark;
- while (1) {
- int tmpvar_9 = _PyPegen_update_memo(p, _mark, t_primary_type, _res);
- if (tmpvar_9) {
- D(p->level--);
- return _res;
- }
- p->mark = _mark;
- p->in_raw_rule++;
- void *_raw = t_primary_raw(p);
- p->in_raw_rule--;
- if (p->error_indicator)
- return NULL;
- if (_raw == NULL || p->mark <= _resmark)
- break;
- _resmark = p->mark;
- _res = _raw;
- }
- p->mark = _resmark;
- D(p->level--);
- return _res;
-}
-static expr_ty
-t_primary_raw(Parser *p)
+// type_expressions:
+// | ','.expression+ ',' '*' expression ',' '**' expression
+// | ','.expression+ ',' '*' expression
+// | ','.expression+ ',' '**' expression
+// | '*' expression ',' '**' expression
+// | '*' expression
+// | '**' expression
+// | ','.expression+
+static asdl_expr_seq*
+type_expressions_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- expr_ty _res = NULL;
+ asdl_expr_seq* _res = NULL;
int _mark = p->mark;
- if (p->mark == p->fill && _PyPegen_fill_token(p) < 0) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
- int _start_lineno = p->tokens[_mark]->lineno;
- 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
- { // t_primary '.' NAME &t_lookahead
+ { // ','.expression+ ',' '*' expression ',' '**' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
Token * _literal;
- expr_ty a;
+ Token * _literal_1;
+ Token * _literal_2;
+ Token * _literal_3;
+ asdl_seq * a;
expr_ty b;
+ expr_ty c;
if (
- (a = t_primary_rule(p)) // t_primary
+ (a = _gather_132_rule(p)) // ','.expression+
&&
- (_literal = _PyPegen_expect_token(p, 23)) // token='.'
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (b = _PyPegen_name_token(p)) // NAME
+ (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
&&
- _PyPegen_lookahead(1, t_lookahead_rule, p)
+ (b = expression_rule(p)) // expression
+ &&
+ (_literal_2 = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (_literal_3 = _PyPegen_expect_token(p, 35)) // token='**'
+ &&
+ (c = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Attribute ( a , b -> v . Name . id , Load , EXTRA );
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_seq_append_to_end ( p , a , b ) ) , c );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -17522,42 +17481,31 @@ t_primary_raw(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '.' NAME &t_lookahead"));
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression ',' '**' expression"));
}
- { // t_primary '[' slices ']' &t_lookahead
+ { // ','.expression+ ',' '*' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
Token * _literal;
Token * _literal_1;
- expr_ty a;
+ asdl_seq * a;
expr_ty b;
if (
- (a = t_primary_rule(p)) // t_primary
- &&
- (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ (a = _gather_134_rule(p)) // ','.expression+
&&
- (b = slices_rule(p)) // slices
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (_literal_1 = _PyPegen_expect_token(p, 10)) // token=']'
+ (_literal_1 = _PyPegen_expect_token(p, 16)) // token='*'
&&
- _PyPegen_lookahead(1, t_lookahead_rule, p)
+ (b = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Subscript ( a , b , Load , EXTRA );
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '*' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -17566,36 +17514,31 @@ t_primary_raw(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '[' slices ']' &t_lookahead"));
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '*' expression"));
}
- { // t_primary genexp &t_lookahead
+ { // ','.expression+ ',' '**' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
- expr_ty a;
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
+ Token * _literal;
+ Token * _literal_1;
+ asdl_seq * a;
expr_ty b;
if (
- (a = t_primary_rule(p)) // t_primary
+ (a = _gather_136_rule(p)) // ','.expression+
&&
- (b = genexp_rule(p)) // genexp
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- _PyPegen_lookahead(1, t_lookahead_rule, p)
+ (_literal_1 = _PyPegen_expect_token(p, 35)) // token='**'
+ &&
+ (b = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary genexp &t_lookahead"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
- D(p->level--);
- return NULL;
- }
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Call ( a , CHECK ( asdl_expr_seq * , ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , b ) ) , NULL , EXTRA );
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+ ',' '**' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , a , b );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -17604,42 +17547,61 @@ t_primary_raw(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary genexp &t_lookahead"));
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+ ',' '**' expression"));
}
- { // t_primary '(' arguments? ')' &t_lookahead
+ { // '*' expression ',' '**' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
Token * _literal;
Token * _literal_1;
+ Token * _literal_2;
expr_ty a;
- void *b;
+ expr_ty b;
if (
- (a = t_primary_rule(p)) // t_primary
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
&&
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ (a = expression_rule(p)) // expression
&&
- (b = arguments_rule(p), 1) // arguments?
+ (_literal_1 = _PyPegen_expect_token(p, 12)) // token=','
&&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (_literal_2 = _PyPegen_expect_token(p, 35)) // token='**'
&&
- _PyPegen_lookahead(1, t_lookahead_rule, p)
+ (b = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
- Token *_token = _PyPegen_get_last_nonnwhitespace_token(p);
- if (_token == NULL) {
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression ',' '**' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_seq_append_to_end ( p , CHECK ( asdl_seq * , _PyPegen_singleton_seq ( p , a ) ) , b );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
D(p->level--);
return NULL;
}
- int _end_lineno = _token->end_lineno;
- 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 = _PyAST_Call ( a , ( b ) ? ( ( expr_ty ) b ) -> v . Call . args : NULL , ( b ) ? ( ( expr_ty ) b ) -> v . Call . keywords : NULL , EXTRA );
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression ',' '**' expression"));
+ }
+ { // '*' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+ Token * _literal;
+ expr_ty a;
+ if (
+ (_literal = _PyPegen_expect_token(p, 16)) // token='*'
+ &&
+ (a = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -17648,23 +17610,48 @@ t_primary_raw(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "t_primary '(' arguments? ')' &t_lookahead"));
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'*' expression"));
}
- { // atom &t_lookahead
+ { // '**' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_primary[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+ Token * _literal;
expr_ty a;
if (
- (a = atom_rule(p)) // atom
+ (_literal = _PyPegen_expect_token(p, 35)) // token='**'
&&
- _PyPegen_lookahead(1, t_lookahead_rule, p)
+ (a = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ t_primary[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "atom &t_lookahead"));
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**' expression"));
+ _res = ( asdl_expr_seq * ) _PyPegen_singleton_seq ( p , a );
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**' expression"));
+ }
+ { // ','.expression+
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> type_expressions[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.expression+"));
+ asdl_expr_seq* a;
+ if (
+ (a = (asdl_expr_seq*)_gather_138_rule(p)) // ','.expression+
+ )
+ {
+ D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -17674,8 +17661,8 @@ t_primary_raw(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_primary[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "atom &t_lookahead"));
+ D(fprintf(stderr, "%*c%s type_expressions[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','.expression+"));
}
_res = NULL;
done:
@@ -17683,73 +17670,86 @@ t_primary_raw(Parser *p)
return _res;
}
-// t_lookahead: '(' | '[' | '.'
-static void *
-t_lookahead_rule(Parser *p)
+// func_type_comment:
+// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
+// | invalid_double_type_comments
+// | TYPE_COMMENT
+static Token*
+func_type_comment_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ Token* _res = NULL;
int _mark = p->mark;
- { // '('
+ { // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
- Token * _literal;
+ D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
+ Token * newline_var;
+ Token * t;
if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
+ &&
+ (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
+ &&
+ _PyPegen_lookahead(1, _tmp_140_rule, p)
)
{
- D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
- _res = _literal;
+ D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
+ _res = t;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)"));
}
- { // '['
+ if (p->call_invalid_rules) { // invalid_double_type_comments
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['"));
- Token * _literal;
+ D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
+ void *invalid_double_type_comments_var;
if (
- (_literal = _PyPegen_expect_token(p, 9)) // token='['
+ (invalid_double_type_comments_var = invalid_double_type_comments_rule(p)) // invalid_double_type_comments
)
{
- D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['"));
- _res = _literal;
+ D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_double_type_comments"));
+ _res = invalid_double_type_comments_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['"));
+ D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_double_type_comments"));
}
- { // '.'
+ { // TYPE_COMMENT
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> t_lookahead[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
- Token * _literal;
+ D(fprintf(stderr, "%*c> func_type_comment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
+ Token * type_comment_var;
if (
- (_literal = _PyPegen_expect_token(p, 23)) // token='.'
+ (type_comment_var = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT'
)
{
- D(fprintf(stderr, "%*c+ t_lookahead[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
- _res = _literal;
+ D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "TYPE_COMMENT"));
+ _res = type_comment_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s t_lookahead[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ D(fprintf(stderr, "%*c%s func_type_comment[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "TYPE_COMMENT"));
}
_res = NULL;
done:
@@ -18087,7 +18087,7 @@ expression_without_invalid_rule(Parser *p)
&&
(b = disjunction_rule(p)) // disjunction
&&
- (_keyword_1 = _PyPegen_expect_token(p, 516)) // token='else'
+ (_keyword_1 = _PyPegen_expect_token(p, 518)) // token='else'
&&
(c = expression_rule(p)) // expression
)
@@ -19349,7 +19349,7 @@ invalid_with_item_rule(Parser *p)
if (
(expression_var = expression_rule(p)) // expression
&&
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(a = expression_rule(p)) // expression
&&
@@ -19399,7 +19399,7 @@ invalid_for_target_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
&&
(a = star_expressions_rule(p)) // star_expressions
)
@@ -19574,7 +19574,7 @@ invalid_with_stmt_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_gather_161_var = _gather_161_rule(p)) // ','.(expression ['as' star_target])+
&&
@@ -19607,7 +19607,7 @@ invalid_with_stmt_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
@@ -19662,7 +19662,7 @@ invalid_with_stmt_indent_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (a = _PyPegen_expect_token(p, 519)) // token='with'
+ (a = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_gather_165_var = _gather_165_rule(p)) // ','.(expression ['as' star_target])+
&&
@@ -19705,7 +19705,7 @@ invalid_with_stmt_indent_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (a = _PyPegen_expect_token(p, 519)) // token='with'
+ (a = _PyPegen_expect_token(p, 521)) // token='with'
&&
(_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
@@ -19850,7 +19850,7 @@ invalid_except_stmt_rule(Parser *p)
expr_ty a;
expr_ty expressions_var;
if (
- (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
+ (_keyword = _PyPegen_expect_token(p, 523)) // token='except'
&&
(a = expression_rule(p)) // expression
&&
@@ -19888,7 +19888,7 @@ invalid_except_stmt_rule(Parser *p)
expr_ty expression_var;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 521)) // token='except'
+ (a = _PyPegen_expect_token(p, 523)) // token='except'
&&
(expression_var = expression_rule(p)) // expression
&&
@@ -19919,7 +19919,7 @@ invalid_except_stmt_rule(Parser *p)
Token * a;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 521)) // token='except'
+ (a = _PyPegen_expect_token(p, 523)) // token='except'
&&
(newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
)
@@ -19964,7 +19964,7 @@ invalid_finally_stmt_rule(Parser *p)
Token * a;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 522)) // token='finally'
+ (a = _PyPegen_expect_token(p, 524)) // token='finally'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -20018,7 +20018,7 @@ invalid_except_stmt_indent_rule(Parser *p)
expr_ty expression_var;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 521)) // token='except'
+ (a = _PyPegen_expect_token(p, 523)) // token='except'
&&
(expression_var = expression_rule(p)) // expression
&&
@@ -20054,7 +20054,7 @@ invalid_except_stmt_indent_rule(Parser *p)
Token * a;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 521)) // token='except'
+ (a = _PyPegen_expect_token(p, 523)) // token='except'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -20279,7 +20279,7 @@ invalid_as_pattern_rule(Parser *p)
if (
(or_pattern_var = or_pattern_rule(p)) // or_pattern
&&
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"'
)
@@ -20309,7 +20309,7 @@ invalid_as_pattern_rule(Parser *p)
if (
(or_pattern_var = or_pattern_rule(p)) // or_pattern
&&
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
_PyPegen_lookahead_with_name(0, _PyPegen_name_token, p)
&&
@@ -20541,7 +20541,7 @@ invalid_elif_stmt_rule(Parser *p)
expr_ty named_expression_var;
Token * newline_var;
if (
- (_keyword = _PyPegen_expect_token(p, 515)) // token='elif'
+ (_keyword = _PyPegen_expect_token(p, 517)) // token='elif'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
@@ -20572,7 +20572,7 @@ invalid_elif_stmt_rule(Parser *p)
expr_ty named_expression_var;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 515)) // token='elif'
+ (a = _PyPegen_expect_token(p, 517)) // token='elif'
&&
(named_expression_var = named_expression_rule(p)) // named_expression
&&
@@ -20623,7 +20623,7 @@ invalid_else_stmt_rule(Parser *p)
Token * a;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 516)) // token='else'
+ (a = _PyPegen_expect_token(p, 518)) // token='else'
&&
(_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
@@ -20763,11 +20763,11 @@ invalid_for_stmt_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (a = _PyPegen_expect_token(p, 517)) // token='for'
+ (a = _PyPegen_expect_token(p, 519)) // token='for'
&&
(star_targets_var = star_targets_rule(p)) // star_targets
&&
- (_keyword = _PyPegen_expect_token(p, 518)) // token='in'
+ (_keyword = _PyPegen_expect_token(p, 520)) // token='in'
&&
(star_expressions_var = star_expressions_rule(p)) // star_expressions
&&
@@ -20830,7 +20830,7 @@ invalid_def_raw_rule(Parser *p)
if (
(_opt_var = _PyPegen_expect_token(p, ASYNC), 1) // ASYNC?
&&
- (a = _PyPegen_expect_token(p, 526)) // token='def'
+ (a = _PyPegen_expect_token(p, 516)) // token='def'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
@@ -20892,7 +20892,7 @@ invalid_class_def_raw_rule(Parser *p)
expr_ty name_var;
Token * newline_var;
if (
- (a = _PyPegen_expect_token(p, 527)) // token='class'
+ (a = _PyPegen_expect_token(p, 515)) // token='class'
&&
(name_var = _PyPegen_name_token(p)) // NAME
&&
@@ -21266,465 +21266,9 @@ _loop0_2_rule(Parser *p)
return _seq;
}
-// _loop0_4: ',' expression
-static asdl_seq *
-_loop0_4_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void *_res = NULL;
- int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ',' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _loop0_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
- Token * _literal;
- expr_ty elem;
- while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = expression_rule(p)) // expression
- )
- {
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_4[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_4_type, _seq);
- D(p->level--);
- return _seq;
-}
-
-// _gather_3: expression _loop0_4
-static asdl_seq *
-_gather_3_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_seq * _res = NULL;
- int _mark = p->mark;
- { // expression _loop0_4
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _gather_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
- expr_ty elem;
- asdl_seq * seq;
- if (
- (elem = expression_rule(p)) // expression
- &&
- (seq = _loop0_4_rule(p)) // _loop0_4
- )
- {
- D(fprintf(stderr, "%*c+ _gather_3[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_4"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_3[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_4"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// _loop0_6: ',' expression
-static asdl_seq *
-_loop0_6_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void *_res = NULL;
- int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ',' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _loop0_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
- Token * _literal;
- expr_ty elem;
- while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = expression_rule(p)) // expression
- )
- {
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_6[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_6_type, _seq);
- D(p->level--);
- return _seq;
-}
-
-// _gather_5: expression _loop0_6
-static asdl_seq *
-_gather_5_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_seq * _res = NULL;
- int _mark = p->mark;
- { // expression _loop0_6
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _gather_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
- expr_ty elem;
- asdl_seq * seq;
- if (
- (elem = expression_rule(p)) // expression
- &&
- (seq = _loop0_6_rule(p)) // _loop0_6
- )
- {
- D(fprintf(stderr, "%*c+ _gather_5[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_6"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_5[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_6"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// _loop0_8: ',' expression
-static asdl_seq *
-_loop0_8_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void *_res = NULL;
- int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ',' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _loop0_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
- Token * _literal;
- expr_ty elem;
- while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = expression_rule(p)) // expression
- )
- {
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_8[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_8_type, _seq);
- D(p->level--);
- return _seq;
-}
-
-// _gather_7: expression _loop0_8
-static asdl_seq *
-_gather_7_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_seq * _res = NULL;
- int _mark = p->mark;
- { // expression _loop0_8
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _gather_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
- expr_ty elem;
- asdl_seq * seq;
- if (
- (elem = expression_rule(p)) // expression
- &&
- (seq = _loop0_8_rule(p)) // _loop0_8
- )
- {
- D(fprintf(stderr, "%*c+ _gather_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_8"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_7[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_8"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// _loop0_10: ',' expression
-static asdl_seq *
-_loop0_10_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void *_res = NULL;
- int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ',' expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _loop0_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
- Token * _literal;
- expr_ty elem;
- while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = expression_rule(p)) // expression
- )
- {
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_10[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_10_type, _seq);
- D(p->level--);
- return _seq;
-}
-
-// _gather_9: expression _loop0_10
+// _loop1_3: statement
static asdl_seq *
-_gather_9_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- asdl_seq * _res = NULL;
- int _mark = p->mark;
- { // expression _loop0_10
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _gather_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
- expr_ty elem;
- asdl_seq * seq;
- if (
- (elem = expression_rule(p)) // expression
- &&
- (seq = _loop0_10_rule(p)) // _loop0_10
- )
- {
- D(fprintf(stderr, "%*c+ _gather_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_10"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_9[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_10"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// _loop1_11: statement
-static asdl_seq *
-_loop1_11_rule(Parser *p)
+_loop1_3_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -21748,7 +21292,7 @@ _loop1_11_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
+ D(fprintf(stderr, "%*c> _loop1_3[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "statement"));
asdl_stmt_seq* statement_var;
while (
(statement_var = statement_rule(p)) // statement
@@ -21770,7 +21314,7 @@ _loop1_11_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_11[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop1_3[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "statement"));
}
if (_n == 0 || p->error_indicator) {
@@ -21788,14 +21332,14 @@ _loop1_11_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_11_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_3_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_13: ';' simple_stmt
+// _loop0_5: ';' simple_stmt
static asdl_seq *
-_loop0_13_rule(Parser *p)
+_loop0_5_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -21819,7 +21363,7 @@ _loop0_13_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt"));
+ D(fprintf(stderr, "%*c> _loop0_5[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';' simple_stmt"));
Token * _literal;
stmt_ty elem;
while (
@@ -21850,7 +21394,7 @@ _loop0_13_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_13[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_5[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';' simple_stmt"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -21863,14 +21407,14 @@ _loop0_13_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_13_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_5_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_12: simple_stmt _loop0_13
+// _gather_4: simple_stmt _loop0_5
static asdl_seq *
-_gather_12_rule(Parser *p)
+_gather_4_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -21879,27 +21423,27 @@ _gather_12_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // simple_stmt _loop0_13
+ { // simple_stmt _loop0_5
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13"));
+ D(fprintf(stderr, "%*c> _gather_4[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_5"));
stmt_ty elem;
asdl_seq * seq;
if (
(elem = simple_stmt_rule(p)) // simple_stmt
&&
- (seq = _loop0_13_rule(p)) // _loop0_13
+ (seq = _loop0_5_rule(p)) // _loop0_5
)
{
- D(fprintf(stderr, "%*c+ _gather_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_13"));
+ D(fprintf(stderr, "%*c+ _gather_4[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "simple_stmt _loop0_5"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_12[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_13"));
+ D(fprintf(stderr, "%*c%s _gather_4[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "simple_stmt _loop0_5"));
}
_res = NULL;
done:
@@ -21907,9 +21451,9 @@ _gather_12_rule(Parser *p)
return _res;
}
-// _tmp_14: 'import' | 'from'
+// _tmp_6: 'import' | 'from'
static void *
-_tmp_14_rule(Parser *p)
+_tmp_6_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -21923,18 +21467,18 @@ _tmp_14_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
+ D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'import'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 513)) // token='import'
)
{
- D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
+ D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'import'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'import'"));
}
{ // 'from'
@@ -21942,18 +21486,18 @@ _tmp_14_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
+ D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'"));
Token * _keyword;
if (
(_keyword = _PyPegen_expect_token(p, 514)) // token='from'
)
{
- D(fprintf(stderr, "%*c+ _tmp_14[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
+ D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_14[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_6[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from'"));
}
_res = NULL;
@@ -21962,9 +21506,9 @@ _tmp_14_rule(Parser *p)
return _res;
}
-// _tmp_15: 'def' | '@' | ASYNC
+// _tmp_7: 'def' | '@' | ASYNC
static void *
-_tmp_15_rule(Parser *p)
+_tmp_7_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -21978,18 +21522,18 @@ _tmp_15_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
+ D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 526)) // token='def'
+ (_keyword = _PyPegen_expect_token(p, 516)) // token='def'
)
{
- D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
+ D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'def'"));
}
{ // '@'
@@ -21997,18 +21541,18 @@ _tmp_15_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
+ D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
)
{
- D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
+ D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
_res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
}
{ // ASYNC
@@ -22016,18 +21560,18 @@ _tmp_15_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
Token * async_var;
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
)
{
- D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
_res = async_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_7[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
}
_res = NULL;
@@ -22036,9 +21580,9 @@ _tmp_15_rule(Parser *p)
return _res;
}
-// _tmp_16: 'class' | '@'
+// _tmp_8: 'class' | '@'
static void *
-_tmp_16_rule(Parser *p)
+_tmp_8_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22052,18 +21596,18 @@ _tmp_16_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
+ D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 527)) // token='class'
+ (_keyword = _PyPegen_expect_token(p, 515)) // token='class'
)
{
- D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
+ D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'class'"));
}
{ // '@'
@@ -22071,18 +21615,18 @@ _tmp_16_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
+ D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@'"));
Token * _literal;
if (
(_literal = _PyPegen_expect_token(p, 49)) // token='@'
)
{
- D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
+ D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@'"));
_res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_8[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@'"));
}
_res = NULL;
@@ -22091,9 +21635,9 @@ _tmp_16_rule(Parser *p)
return _res;
}
-// _tmp_17: 'with' | ASYNC
+// _tmp_9: 'with' | ASYNC
static void *
-_tmp_17_rule(Parser *p)
+_tmp_9_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22107,18 +21651,18 @@ _tmp_17_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
+ D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 519)) // token='with'
+ (_keyword = _PyPegen_expect_token(p, 521)) // token='with'
)
{
- D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
+ D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'with'"));
}
{ // ASYNC
@@ -22126,18 +21670,18 @@ _tmp_17_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
Token * async_var;
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
)
{
- D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
_res = async_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_9[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
}
_res = NULL;
@@ -22146,9 +21690,9 @@ _tmp_17_rule(Parser *p)
return _res;
}
-// _tmp_18: 'for' | ASYNC
+// _tmp_10: 'for' | ASYNC
static void *
-_tmp_18_rule(Parser *p)
+_tmp_10_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22162,18 +21706,18 @@ _tmp_18_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
+ D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 517)) // token='for'
+ (_keyword = _PyPegen_expect_token(p, 519)) // token='for'
)
{
- D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
+ D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'"));
_res = _keyword;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'for'"));
}
{ // ASYNC
@@ -22181,18 +21725,18 @@ _tmp_18_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC"));
Token * async_var;
if (
(async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC'
)
{
- D(fprintf(stderr, "%*c+ _tmp_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
+ D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC"));
_res = async_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_18[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_10[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "ASYNC"));
}
_res = NULL;
@@ -22201,9 +21745,9 @@ _tmp_18_rule(Parser *p)
return _res;
}
-// _tmp_19: '=' annotated_rhs
+// _tmp_11: '=' annotated_rhs
static void *
-_tmp_19_rule(Parser *p)
+_tmp_11_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22217,7 +21761,7 @@ _tmp_19_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+ D(fprintf(stderr, "%*c> _tmp_11[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
Token * _literal;
expr_ty d;
if (
@@ -22226,7 +21770,7 @@ _tmp_19_rule(Parser *p)
(d = annotated_rhs_rule(p)) // annotated_rhs
)
{
- D(fprintf(stderr, "%*c+ _tmp_19[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+ D(fprintf(stderr, "%*c+ _tmp_11[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
_res = d;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -22236,7 +21780,7 @@ _tmp_19_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_19[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_11[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
}
_res = NULL;
@@ -22245,9 +21789,9 @@ _tmp_19_rule(Parser *p)
return _res;
}
-// _tmp_20: '(' single_target ')' | single_subscript_attribute_target
+// _tmp_12: '(' single_target ')' | single_subscript_attribute_target
static void *
-_tmp_20_rule(Parser *p)
+_tmp_12_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22261,7 +21805,7 @@ _tmp_20_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+ D(fprintf(stderr, "%*c> _tmp_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
Token * _literal;
Token * _literal_1;
expr_ty b;
@@ -22273,7 +21817,7 @@ _tmp_20_rule(Parser *p)
(_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
+ D(fprintf(stderr, "%*c+ _tmp_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' single_target ')'"));
_res = b;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -22283,7 +21827,7 @@ _tmp_20_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_12[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' single_target ')'"));
}
{ // single_subscript_attribute_target
@@ -22291,18 +21835,18 @@ _tmp_20_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+ D(fprintf(stderr, "%*c> _tmp_12[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
expr_ty single_subscript_attribute_target_var;
if (
(single_subscript_attribute_target_var = single_subscript_attribute_target_rule(p)) // single_subscript_attribute_target
)
{
- D(fprintf(stderr, "%*c+ _tmp_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
+ D(fprintf(stderr, "%*c+ _tmp_12[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "single_subscript_attribute_target"));
_res = single_subscript_attribute_target_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_20[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_12[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "single_subscript_attribute_target"));
}
_res = NULL;
@@ -22311,9 +21855,9 @@ _tmp_20_rule(Parser *p)
return _res;
}
-// _tmp_21: '=' annotated_rhs
+// _tmp_13: '=' annotated_rhs
static void *
-_tmp_21_rule(Parser *p)
+_tmp_13_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22327,7 +21871,7 @@ _tmp_21_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+ D(fprintf(stderr, "%*c> _tmp_13[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
Token * _literal;
expr_ty d;
if (
@@ -22336,7 +21880,7 @@ _tmp_21_rule(Parser *p)
(d = annotated_rhs_rule(p)) // annotated_rhs
)
{
- D(fprintf(stderr, "%*c+ _tmp_21[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
+ D(fprintf(stderr, "%*c+ _tmp_13[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'=' annotated_rhs"));
_res = d;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -22346,7 +21890,7 @@ _tmp_21_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_21[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_13[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'=' annotated_rhs"));
}
_res = NULL;
@@ -22355,9 +21899,9 @@ _tmp_21_rule(Parser *p)
return _res;
}
-// _loop1_22: (star_targets '=')
+// _loop1_14: (star_targets '=')
static asdl_seq *
-_loop1_22_rule(Parser *p)
+_loop1_14_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22381,7 +21925,7 @@ _loop1_22_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
+ D(fprintf(stderr, "%*c> _loop1_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')"));
void *_tmp_179_var;
while (
(_tmp_179_var = _tmp_179_rule(p)) // star_targets '='
@@ -22403,7 +21947,7 @@ _loop1_22_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_22[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop1_14[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')"));
}
if (_n == 0 || p->error_indicator) {
@@ -22421,14 +21965,14 @@ _loop1_22_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_22_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_14_type, _seq);
D(p->level--);
return _seq;
}
-// _tmp_23: yield_expr | star_expressions
+// _tmp_15: yield_expr | star_expressions
static void *
-_tmp_23_rule(Parser *p)
+_tmp_15_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22442,18 +21986,18 @@ _tmp_23_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
expr_ty yield_expr_var;
if (
(yield_expr_var = yield_expr_rule(p)) // yield_expr
)
{
- D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
_res = yield_expr_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
{ // star_expressions
@@ -22461,18 +22005,18 @@ _tmp_23_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ D(fprintf(stderr, "%*c> _tmp_15[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
expr_ty star_expressions_var;
if (
(star_expressions_var = star_expressions_rule(p)) // star_expressions
)
{
- D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ D(fprintf(stderr, "%*c+ _tmp_15[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
_res = star_expressions_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_15[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
}
_res = NULL;
@@ -22481,9 +22025,9 @@ _tmp_23_rule(Parser *p)
return _res;
}
-// _tmp_24: yield_expr | star_expressions
+// _tmp_16: yield_expr | star_expressions
static void *
-_tmp_24_rule(Parser *p)
+_tmp_16_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22497,18 +22041,18 @@ _tmp_24_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
expr_ty yield_expr_var;
if (
(yield_expr_var = yield_expr_rule(p)) // yield_expr
)
{
- D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
_res = yield_expr_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
{ // star_expressions
@@ -22516,18 +22060,18 @@ _tmp_24_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ D(fprintf(stderr, "%*c> _tmp_16[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions"));
expr_ty star_expressions_var;
if (
(star_expressions_var = star_expressions_rule(p)) // star_expressions
)
{
- D(fprintf(stderr, "%*c+ _tmp_24[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
+ D(fprintf(stderr, "%*c+ _tmp_16[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions"));
_res = star_expressions_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_24[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_16[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions"));
}
_res = NULL;
@@ -22536,9 +22080,53 @@ _tmp_24_rule(Parser *p)
return _res;
}
-// _loop0_26: ',' NAME
+// _tmp_17: 'from' expression
+static void *
+_tmp_17_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // 'from' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_17[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
+ Token * _keyword;
+ expr_ty z;
+ if (
+ (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
+ &&
+ (z = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_17[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_17[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _loop0_19: ',' NAME
static asdl_seq *
-_loop0_26_rule(Parser *p)
+_loop0_19_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22562,7 +22150,7 @@ _loop0_26_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
+ D(fprintf(stderr, "%*c> _loop0_19[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
Token * _literal;
expr_ty elem;
while (
@@ -22593,7 +22181,7 @@ _loop0_26_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_26[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_19[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -22606,14 +22194,14 @@ _loop0_26_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_26_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_19_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_25: NAME _loop0_26
+// _gather_18: NAME _loop0_19
static asdl_seq *
-_gather_25_rule(Parser *p)
+_gather_18_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22622,27 +22210,27 @@ _gather_25_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // NAME _loop0_26
+ { // NAME _loop0_19
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
+ D(fprintf(stderr, "%*c> _gather_18[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_19"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = _PyPegen_name_token(p)) // NAME
&&
- (seq = _loop0_26_rule(p)) // _loop0_26
+ (seq = _loop0_19_rule(p)) // _loop0_19
)
{
- D(fprintf(stderr, "%*c+ _gather_25[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_26"));
+ D(fprintf(stderr, "%*c+ _gather_18[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_19"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_25[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_26"));
+ D(fprintf(stderr, "%*c%s _gather_18[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_19"));
}
_res = NULL;
done:
@@ -22650,9 +22238,9 @@ _gather_25_rule(Parser *p)
return _res;
}
-// _loop0_28: ',' NAME
+// _loop0_21: ',' NAME
static asdl_seq *
-_loop0_28_rule(Parser *p)
+_loop0_21_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22676,7 +22264,7 @@ _loop0_28_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
+ D(fprintf(stderr, "%*c> _loop0_21[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' NAME"));
Token * _literal;
expr_ty elem;
while (
@@ -22707,7 +22295,7 @@ _loop0_28_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_28[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_21[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' NAME"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -22720,14 +22308,14 @@ _loop0_28_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_28_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_21_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_27: NAME _loop0_28
+// _gather_20: NAME _loop0_21
static asdl_seq *
-_gather_27_rule(Parser *p)
+_gather_20_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22736,27 +22324,27 @@ _gather_27_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // NAME _loop0_28
+ { // NAME _loop0_21
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
+ D(fprintf(stderr, "%*c> _gather_20[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME _loop0_21"));
expr_ty elem;
asdl_seq * seq;
if (
(elem = _PyPegen_name_token(p)) // NAME
&&
- (seq = _loop0_28_rule(p)) // _loop0_28
+ (seq = _loop0_21_rule(p)) // _loop0_21
)
{
- D(fprintf(stderr, "%*c+ _gather_27[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_28"));
+ D(fprintf(stderr, "%*c+ _gather_20[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME _loop0_21"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_27[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_28"));
+ D(fprintf(stderr, "%*c%s _gather_20[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME _loop0_21"));
}
_res = NULL;
done:
@@ -22764,9 +22352,9 @@ _gather_27_rule(Parser *p)
return _res;
}
-// _tmp_29: ',' expression
+// _tmp_22: ';' | NEWLINE
static void *
-_tmp_29_rule(Parser *p)
+_tmp_22_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22775,32 +22363,43 @@ _tmp_29_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // ',' expression
+ { // ';'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+ D(fprintf(stderr, "%*c> _tmp_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
Token * _literal;
- expr_ty z;
if (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (z = expression_rule(p)) // expression
+ (_literal = _PyPegen_expect_token(p, 13)) // token=';'
)
{
- D(fprintf(stderr, "%*c+ _tmp_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
- _res = z;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ _tmp_22[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_29[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+ D(fprintf(stderr, "%*c%s _tmp_22[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
+ }
+ { // NEWLINE
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_22[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+ Token * newline_var;
+ if (
+ (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_22[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
+ _res = newline_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_22[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
}
_res = NULL;
done:
@@ -22808,9 +22407,9 @@ _tmp_29_rule(Parser *p)
return _res;
}
-// _tmp_30: ';' | NEWLINE
+// _tmp_23: ',' expression
static void *
-_tmp_30_rule(Parser *p)
+_tmp_23_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22819,43 +22418,32 @@ _tmp_30_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // ';'
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "';'"));
+ D(fprintf(stderr, "%*c> _tmp_23[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
+ expr_ty z;
if (
- (_literal = _PyPegen_expect_token(p, 13)) // token=';'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "';'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "';'"));
- }
- { // NEWLINE
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
- Token * newline_var;
- if (
- (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (z = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ _tmp_30[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE"));
- _res = newline_var;
+ D(fprintf(stderr, "%*c+ _tmp_23[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_30[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE"));
+ D(fprintf(stderr, "%*c%s _tmp_23[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
_res = NULL;
done:
@@ -22863,9 +22451,9 @@ _tmp_30_rule(Parser *p)
return _res;
}
-// _loop0_31: ('.' | '...')
+// _loop0_24: ('.' | '...')
static asdl_seq *
-_loop0_31_rule(Parser *p)
+_loop0_24_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22889,7 +22477,7 @@ _loop0_31_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
+ D(fprintf(stderr, "%*c> _loop0_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
void *_tmp_180_var;
while (
(_tmp_180_var = _tmp_180_rule(p)) // '.' | '...'
@@ -22911,7 +22499,7 @@ _loop0_31_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_31[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_24[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -22924,14 +22512,14 @@ _loop0_31_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_31_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_24_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_32: ('.' | '...')
+// _loop1_25: ('.' | '...')
static asdl_seq *
-_loop1_32_rule(Parser *p)
+_loop1_25_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -22955,7 +22543,7 @@ _loop1_32_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
+ D(fprintf(stderr, "%*c> _loop1_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')"));
void *_tmp_181_var;
while (
(_tmp_181_var = _tmp_181_rule(p)) // '.' | '...'
@@ -22977,7 +22565,7 @@ _loop1_32_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop1_25[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('.' | '...')"));
}
if (_n == 0 || p->error_indicator) {
@@ -22995,14 +22583,14 @@ _loop1_32_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_25_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_34: ',' import_from_as_name
+// _loop0_27: ',' import_from_as_name
static asdl_seq *
-_loop0_34_rule(Parser *p)
+_loop0_27_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23026,7 +22614,7 @@ _loop0_34_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
+ D(fprintf(stderr, "%*c> _loop0_27[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' import_from_as_name"));
Token * _literal;
alias_ty elem;
while (
@@ -23057,7 +22645,7 @@ _loop0_34_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_34[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_27[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' import_from_as_name"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -23070,14 +22658,14 @@ _loop0_34_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_34_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_27_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_33: import_from_as_name _loop0_34
+// _gather_26: import_from_as_name _loop0_27
static asdl_seq *
-_gather_33_rule(Parser *p)
+_gather_26_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23086,27 +22674,27 @@ _gather_33_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // import_from_as_name _loop0_34
+ { // import_from_as_name _loop0_27
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
+ D(fprintf(stderr, "%*c> _gather_26[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_27"));
alias_ty elem;
asdl_seq * seq;
if (
(elem = import_from_as_name_rule(p)) // import_from_as_name
&&
- (seq = _loop0_34_rule(p)) // _loop0_34
+ (seq = _loop0_27_rule(p)) // _loop0_27
)
{
- D(fprintf(stderr, "%*c+ _gather_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_34"));
+ D(fprintf(stderr, "%*c+ _gather_26[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "import_from_as_name _loop0_27"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_33[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_34"));
+ D(fprintf(stderr, "%*c%s _gather_26[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "import_from_as_name _loop0_27"));
}
_res = NULL;
done:
@@ -23114,9 +22702,9 @@ _gather_33_rule(Parser *p)
return _res;
}
-// _tmp_35: 'as' NAME
+// _tmp_28: 'as' NAME
static void *
-_tmp_35_rule(Parser *p)
+_tmp_28_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23130,16 +22718,16 @@ _tmp_35_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ D(fprintf(stderr, "%*c> _tmp_28[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Token * _keyword;
expr_ty z;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(z = _PyPegen_name_token(p)) // NAME
)
{
- D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ D(fprintf(stderr, "%*c+ _tmp_28[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -23149,7 +22737,7 @@ _tmp_35_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_28[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
}
_res = NULL;
@@ -23158,9 +22746,9 @@ _tmp_35_rule(Parser *p)
return _res;
}
-// _loop0_37: ',' dotted_as_name
+// _loop0_30: ',' dotted_as_name
static asdl_seq *
-_loop0_37_rule(Parser *p)
+_loop0_30_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23184,7 +22772,7 @@ _loop0_37_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
+ D(fprintf(stderr, "%*c> _loop0_30[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' dotted_as_name"));
Token * _literal;
alias_ty elem;
while (
@@ -23215,7 +22803,7 @@ _loop0_37_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop0_30[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' dotted_as_name"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
@@ -23228,14 +22816,14 @@ _loop0_37_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_30_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_36: dotted_as_name _loop0_37
+// _gather_29: dotted_as_name _loop0_30
static asdl_seq *
-_gather_36_rule(Parser *p)
+_gather_29_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23244,27 +22832,27 @@ _gather_36_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // dotted_as_name _loop0_37
+ { // dotted_as_name _loop0_30
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
+ D(fprintf(stderr, "%*c> _gather_29[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_30"));
alias_ty elem;
asdl_seq * seq;
if (
(elem = dotted_as_name_rule(p)) // dotted_as_name
&&
- (seq = _loop0_37_rule(p)) // _loop0_37
+ (seq = _loop0_30_rule(p)) // _loop0_30
)
{
- D(fprintf(stderr, "%*c+ _gather_36[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_37"));
+ D(fprintf(stderr, "%*c+ _gather_29[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dotted_as_name _loop0_30"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_36[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_37"));
+ D(fprintf(stderr, "%*c%s _gather_29[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dotted_as_name _loop0_30"));
}
_res = NULL;
done:
@@ -23272,9 +22860,9 @@ _gather_36_rule(Parser *p)
return _res;
}
-// _tmp_38: 'as' NAME
+// _tmp_31: 'as' NAME
static void *
-_tmp_38_rule(Parser *p)
+_tmp_31_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23288,16 +22876,16 @@ _tmp_38_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ D(fprintf(stderr, "%*c> _tmp_31[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
Token * _keyword;
expr_ty z;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(z = _PyPegen_name_token(p)) // NAME
)
{
- D(fprintf(stderr, "%*c+ _tmp_38[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ D(fprintf(stderr, "%*c+ _tmp_31[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
_res = z;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -23307,7 +22895,7 @@ _tmp_38_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_38[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _tmp_31[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
}
_res = NULL;
@@ -23316,9 +22904,9 @@ _tmp_38_rule(Parser *p)
return _res;
}
-// _loop0_40: ',' with_item
+// _loop1_32: ('@' named_expression NEWLINE)
static asdl_seq *
-_loop0_40_rule(Parser *p)
+_loop1_32_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23337,27 +22925,18 @@ _loop0_40_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' with_item
+ { // ('@' named_expression NEWLINE)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
- Token * _literal;
- withitem_ty elem;
+ D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
+ void *_tmp_182_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = with_item_rule(p)) // with_item
+ (_tmp_182_var = _tmp_182_rule(p)) // '@' named_expression NEWLINE
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = _tmp_182_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -23373,8 +22952,13 @@ _loop0_40_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+ D(fprintf(stderr, "%*c%s _loop1_32[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -23386,43 +22970,95 @@ _loop0_40_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_32_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_39: with_item _loop0_40
-static asdl_seq *
-_gather_39_rule(Parser *p)
+// _tmp_33: '(' arguments? ')'
+static void *
+_tmp_33_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- { // with_item _loop0_40
+ { // '(' arguments? ')'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
- withitem_ty elem;
- asdl_seq * seq;
+ D(fprintf(stderr, "%*c> _tmp_33[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+ Token * _literal;
+ Token * _literal_1;
+ void *z;
if (
- (elem = with_item_rule(p)) // with_item
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
&&
- (seq = _loop0_40_rule(p)) // _loop0_40
+ (z = arguments_rule(p), 1) // arguments?
+ &&
+ (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ _gather_39[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_40"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ D(fprintf(stderr, "%*c+ _tmp_33[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_33[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _tmp_34: '->' expression
+static void *
+_tmp_34_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // '->' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_34[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ Token * _literal;
+ expr_ty z;
+ if (
+ (_literal = _PyPegen_expect_token(p, 51)) // token='->'
+ &&
+ (z = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_34[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_39[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_40"));
+ D(fprintf(stderr, "%*c%s _tmp_34[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
}
_res = NULL;
done:
@@ -23430,9 +23066,53 @@ _gather_39_rule(Parser *p)
return _res;
}
-// _loop0_42: ',' with_item
+// _tmp_35: '->' expression
+static void *
+_tmp_35_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // '->' expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_35[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ Token * _literal;
+ expr_ty z;
+ if (
+ (_literal = _PyPegen_expect_token(p, 51)) // token='->'
+ &&
+ (z = expression_rule(p)) // expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_35[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_35[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _loop0_36: param_no_default
static asdl_seq *
-_loop0_42_rule(Parser *p)
+_loop0_36_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23451,27 +23131,18 @@ _loop0_42_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' with_item
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
- Token * _literal;
- withitem_ty elem;
+ D(fprintf(stderr, "%*c> _loop0_36[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = with_item_rule(p)) // with_item
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -23487,8 +23158,8 @@ _loop0_42_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_42[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+ D(fprintf(stderr, "%*c%s _loop0_36[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -23500,53 +23171,80 @@ _loop0_42_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_42_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_36_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_41: with_item _loop0_42
+// _loop0_37: param_with_default
static asdl_seq *
-_gather_41_rule(Parser *p)
+_loop0_37_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // with_item _loop0_42
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
- withitem_ty elem;
- asdl_seq * seq;
- if (
- (elem = with_item_rule(p)) // with_item
- &&
- (seq = _loop0_42_rule(p)) // _loop0_42
+ D(fprintf(stderr, "%*c> _loop0_37[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- D(fprintf(stderr, "%*c+ _gather_41[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_42"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
+ _res = param_with_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_41[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_42"));
+ D(fprintf(stderr, "%*c%s _loop0_37[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_37_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _loop0_44: ',' with_item
+// _loop0_38: param_with_default
static asdl_seq *
-_loop0_44_rule(Parser *p)
+_loop0_38_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23565,27 +23263,18 @@ _loop0_44_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' with_item
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
- Token * _literal;
- withitem_ty elem;
+ D(fprintf(stderr, "%*c> _loop0_38[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = with_item_rule(p)) // with_item
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -23601,8 +23290,8 @@ _loop0_44_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+ D(fprintf(stderr, "%*c%s _loop0_38[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -23614,53 +23303,85 @@ _loop0_44_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_38_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_43: with_item _loop0_44
+// _loop1_39: param_no_default
static asdl_seq *
-_gather_43_rule(Parser *p)
+_loop1_39_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // with_item _loop0_44
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
- withitem_ty elem;
- asdl_seq * seq;
- if (
- (elem = with_item_rule(p)) // with_item
- &&
- (seq = _loop0_44_rule(p)) // _loop0_44
+ D(fprintf(stderr, "%*c> _loop1_39[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- D(fprintf(stderr, "%*c+ _gather_43[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_44"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
+ _res = param_no_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_43[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_44"));
+ D(fprintf(stderr, "%*c%s _loop1_39[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
- _res = NULL;
- done:
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_39_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _loop0_46: ',' with_item
+// _loop0_40: param_with_default
static asdl_seq *
-_loop0_46_rule(Parser *p)
+_loop0_40_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23679,27 +23400,18 @@ _loop0_46_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' with_item
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
- Token * _literal;
- withitem_ty elem;
+ D(fprintf(stderr, "%*c> _loop0_40[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = with_item_rule(p)) // with_item
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -23715,8 +23427,8 @@ _loop0_46_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
+ D(fprintf(stderr, "%*c%s _loop0_40[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -23728,127 +23440,156 @@ _loop0_46_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_40_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_45: with_item _loop0_46
+// _loop1_41: param_with_default
static asdl_seq *
-_gather_45_rule(Parser *p)
+_loop1_41_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // with_item _loop0_46
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
- withitem_ty elem;
- asdl_seq * seq;
- if (
- (elem = with_item_rule(p)) // with_item
- &&
- (seq = _loop0_46_rule(p)) // _loop0_46
+ D(fprintf(stderr, "%*c> _loop1_41[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- D(fprintf(stderr, "%*c+ _gather_45[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_46"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
+ _res = param_with_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_45[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_46"));
+ D(fprintf(stderr, "%*c%s _loop1_41[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
- _res = NULL;
- done:
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_41_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_47: ',' | ')' | ':'
-static void *
-_tmp_47_rule(Parser *p)
+// _loop1_42: param_no_default
+static asdl_seq *
+_loop1_42_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // ','
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // ')'
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 8)) // token=')'
+ D(fprintf(stderr, "%*c> _loop1_42[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
- _res = _literal;
- goto done;
+ _res = param_no_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+ D(fprintf(stderr, "%*c%s _loop1_42[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
- { // ':'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 11)) // token=':'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_47[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_47[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_42_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _loop1_48: except_block
+// _loop1_43: param_no_default
static asdl_seq *
-_loop1_48_rule(Parser *p)
+_loop1_43_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23867,18 +23608,18 @@ _loop1_48_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // except_block
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
- excepthandler_ty except_block_var;
+ D(fprintf(stderr, "%*c> _loop1_43[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
while (
- (except_block_var = except_block_rule(p)) // except_block
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- _res = except_block_var;
+ _res = param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -23894,8 +23635,8 @@ _loop1_48_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_48[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
+ D(fprintf(stderr, "%*c%s _loop1_43[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -23912,58 +23653,80 @@ _loop1_48_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_48_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_43_type, _seq);
D(p->level--);
return _seq;
}
-// _tmp_49: 'as' NAME
-static void *
-_tmp_49_rule(Parser *p)
+// _loop0_44: param_no_default
+static asdl_seq *
+_loop0_44_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // 'as' NAME
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
- Token * _keyword;
- expr_ty z;
- if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
- &&
- (z = _PyPegen_name_token(p)) // NAME
+ D(fprintf(stderr, "%*c> _loop0_44[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
+ while (
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- D(fprintf(stderr, "%*c+ _tmp_49[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
- _res = z;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
+ _res = param_no_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
}
- goto done;
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_49[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
+ D(fprintf(stderr, "%*c%s _loop0_44[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_44_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _loop1_50: case_block
+// _loop1_45: param_with_default
static asdl_seq *
-_loop1_50_rule(Parser *p)
+_loop1_45_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -23982,18 +23745,18 @@ _loop1_50_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // case_block
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block"));
- match_case_ty case_block_var;
+ D(fprintf(stderr, "%*c> _loop1_45[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
while (
- (case_block_var = case_block_rule(p)) // case_block
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- _res = case_block_var;
+ _res = param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -24009,8 +23772,8 @@ _loop1_50_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_50[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block"));
+ D(fprintf(stderr, "%*c%s _loop1_45[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -24027,14 +23790,14 @@ _loop1_50_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_50_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_45_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_52: '|' closed_pattern
+// _loop0_46: param_no_default
static asdl_seq *
-_loop0_52_rule(Parser *p)
+_loop0_46_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24053,27 +23816,18 @@ _loop0_52_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // '|' closed_pattern
+ { // param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern"));
- Token * _literal;
- pattern_ty elem;
+ D(fprintf(stderr, "%*c> _loop0_46[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
+ arg_ty param_no_default_var;
while (
- (_literal = _PyPegen_expect_token(p, 18)) // token='|'
- &&
- (elem = closed_pattern_rule(p)) // closed_pattern
+ (param_no_default_var = param_no_default_rule(p)) // param_no_default
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -24089,8 +23843,8 @@ _loop0_52_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_52[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern"));
+ D(fprintf(stderr, "%*c%s _loop0_46[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -24102,227 +23856,326 @@ _loop0_52_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_52_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_46_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_51: closed_pattern _loop0_52
+// _loop1_47: param_with_default
static asdl_seq *
-_gather_51_rule(Parser *p)
+_loop1_47_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // closed_pattern _loop0_52
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52"));
- pattern_ty elem;
- asdl_seq * seq;
- if (
- (elem = closed_pattern_rule(p)) // closed_pattern
- &&
- (seq = _loop0_52_rule(p)) // _loop0_52
+ D(fprintf(stderr, "%*c> _loop1_47[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
+ NameDefaultPair* param_with_default_var;
+ while (
+ (param_with_default_var = param_with_default_rule(p)) // param_with_default
)
{
- D(fprintf(stderr, "%*c+ _gather_51[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_52"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
- goto done;
+ _res = param_with_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_51[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_52"));
+ D(fprintf(stderr, "%*c%s _loop1_47[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
}
- _res = NULL;
- done:
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_47_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_53: '+' | '-'
-static void *
-_tmp_53_rule(Parser *p)
+// _loop0_48: param_maybe_default
+static asdl_seq *
+_loop0_48_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // '+'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 14)) // token='+'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // '-'
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_maybe_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 15)) // token='-'
+ D(fprintf(stderr, "%*c> _loop0_48[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
+ NameDefaultPair* param_maybe_default_var;
+ while (
+ (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
)
{
- D(fprintf(stderr, "%*c+ _tmp_53[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
- _res = _literal;
- goto done;
+ _res = param_maybe_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_53[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
+ D(fprintf(stderr, "%*c%s _loop0_48[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_48_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_54: '+' | '-'
-static void *
-_tmp_54_rule(Parser *p)
+// _loop1_49: param_maybe_default
+static asdl_seq *
+_loop1_49_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // '+'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 14)) // token='+'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // '-'
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // param_maybe_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 15)) // token='-'
+ D(fprintf(stderr, "%*c> _loop1_49[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
+ NameDefaultPair* param_maybe_default_var;
+ while (
+ (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
)
{
- D(fprintf(stderr, "%*c+ _tmp_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
- _res = _literal;
- goto done;
+ _res = param_maybe_default_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_54[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
+ D(fprintf(stderr, "%*c%s _loop1_49[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
}
- _res = NULL;
- done:
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_49_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_55: '.' | '(' | '='
-static void *
-_tmp_55_rule(Parser *p)
+// _loop0_51: ',' with_item
+static asdl_seq *
+_loop0_51_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // '.'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 23)) // token='.'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // '('
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // ',' with_item
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+ D(fprintf(stderr, "%*c> _loop0_51[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ withitem_ty elem;
+ while (
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = with_item_rule(p)) // with_item
)
{
- D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
- _res = _literal;
- goto done;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ D(fprintf(stderr, "%*c%s _loop0_51[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
}
- { // '='
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_51_type, _seq);
+ D(p->level--);
+ return _seq;
+}
+
+// _gather_50: with_item _loop0_51
+static asdl_seq *
+_gather_50_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq * _res = NULL;
+ int _mark = p->mark;
+ { // with_item _loop0_51
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
- Token * _literal;
+ D(fprintf(stderr, "%*c> _gather_50[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_51"));
+ withitem_ty elem;
+ asdl_seq * seq;
if (
- (_literal = _PyPegen_expect_token(p, 22)) // token='='
+ (elem = with_item_rule(p)) // with_item
+ &&
+ (seq = _loop0_51_rule(p)) // _loop0_51
)
{
- D(fprintf(stderr, "%*c+ _tmp_55[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
- _res = _literal;
+ D(fprintf(stderr, "%*c+ _gather_50[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_51"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_55[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+ D(fprintf(stderr, "%*c%s _gather_50[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_51"));
}
_res = NULL;
done:
@@ -24330,73 +24183,113 @@ _tmp_55_rule(Parser *p)
return _res;
}
-// _tmp_56: '.' | '(' | '='
-static void *
-_tmp_56_rule(Parser *p)
+// _loop0_53: ',' with_item
+static asdl_seq *
+_loop0_53_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // '.'
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
- Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 23)) // token='.'
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
- _res = _literal;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // '('
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // ',' with_item
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+ D(fprintf(stderr, "%*c> _loop0_53[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Token * _literal;
- if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ withitem_ty elem;
+ while (
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = with_item_rule(p)) // with_item
)
{
- D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
- _res = _literal;
- goto done;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ D(fprintf(stderr, "%*c%s _loop0_53[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
}
- { // '='
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_53_type, _seq);
+ D(p->level--);
+ return _seq;
+}
+
+// _gather_52: with_item _loop0_53
+static asdl_seq *
+_gather_52_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq * _res = NULL;
+ int _mark = p->mark;
+ { // with_item _loop0_53
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
- Token * _literal;
+ D(fprintf(stderr, "%*c> _gather_52[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_53"));
+ withitem_ty elem;
+ asdl_seq * seq;
if (
- (_literal = _PyPegen_expect_token(p, 22)) // token='='
+ (elem = with_item_rule(p)) // with_item
+ &&
+ (seq = _loop0_53_rule(p)) // _loop0_53
)
{
- D(fprintf(stderr, "%*c+ _tmp_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
- _res = _literal;
+ D(fprintf(stderr, "%*c+ _gather_52[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_53"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_56[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
+ D(fprintf(stderr, "%*c%s _gather_52[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_53"));
}
_res = NULL;
done:
@@ -24404,9 +24297,9 @@ _tmp_56_rule(Parser *p)
return _res;
}
-// _loop0_58: ',' maybe_star_pattern
+// _loop0_55: ',' with_item
static asdl_seq *
-_loop0_58_rule(Parser *p)
+_loop0_55_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24425,18 +24318,18 @@ _loop0_58_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' maybe_star_pattern
+ { // ',' with_item
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern"));
+ D(fprintf(stderr, "%*c> _loop0_55[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Token * _literal;
- pattern_ty elem;
+ withitem_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
+ (elem = with_item_rule(p)) // with_item
)
{
_res = elem;
@@ -24461,8 +24354,8 @@ _loop0_58_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_58[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern"));
+ D(fprintf(stderr, "%*c%s _loop0_55[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -24474,14 +24367,14 @@ _loop0_58_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_58_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_55_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_57: maybe_star_pattern _loop0_58
+// _gather_54: with_item _loop0_55
static asdl_seq *
-_gather_57_rule(Parser *p)
+_gather_54_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24490,27 +24383,27 @@ _gather_57_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // maybe_star_pattern _loop0_58
+ { // with_item _loop0_55
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58"));
- pattern_ty elem;
+ D(fprintf(stderr, "%*c> _gather_54[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_55"));
+ withitem_ty elem;
asdl_seq * seq;
if (
- (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
+ (elem = with_item_rule(p)) // with_item
&&
- (seq = _loop0_58_rule(p)) // _loop0_58
+ (seq = _loop0_55_rule(p)) // _loop0_55
)
{
- D(fprintf(stderr, "%*c+ _gather_57[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_58"));
+ D(fprintf(stderr, "%*c+ _gather_54[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_55"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_57[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_58"));
+ D(fprintf(stderr, "%*c%s _gather_54[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_55"));
}
_res = NULL;
done:
@@ -24518,9 +24411,9 @@ _gather_57_rule(Parser *p)
return _res;
}
-// _loop0_60: ',' key_value_pattern
+// _loop0_57: ',' with_item
static asdl_seq *
-_loop0_60_rule(Parser *p)
+_loop0_57_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24539,18 +24432,18 @@ _loop0_60_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' key_value_pattern
+ { // ',' with_item
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern"));
+ D(fprintf(stderr, "%*c> _loop0_57[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' with_item"));
Token * _literal;
- KeyPatternPair* elem;
+ withitem_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = key_value_pattern_rule(p)) // key_value_pattern
+ (elem = with_item_rule(p)) // with_item
)
{
_res = elem;
@@ -24575,8 +24468,8 @@ _loop0_60_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_60[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern"));
+ D(fprintf(stderr, "%*c%s _loop0_57[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' with_item"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -24588,14 +24481,14 @@ _loop0_60_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_60_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_57_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_59: key_value_pattern _loop0_60
+// _gather_56: with_item _loop0_57
static asdl_seq *
-_gather_59_rule(Parser *p)
+_gather_56_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24604,27 +24497,27 @@ _gather_59_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // key_value_pattern _loop0_60
+ { // with_item _loop0_57
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60"));
- KeyPatternPair* elem;
+ D(fprintf(stderr, "%*c> _gather_56[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "with_item _loop0_57"));
+ withitem_ty elem;
asdl_seq * seq;
if (
- (elem = key_value_pattern_rule(p)) // key_value_pattern
+ (elem = with_item_rule(p)) // with_item
&&
- (seq = _loop0_60_rule(p)) // _loop0_60
+ (seq = _loop0_57_rule(p)) // _loop0_57
)
{
- D(fprintf(stderr, "%*c+ _gather_59[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_60"));
+ D(fprintf(stderr, "%*c+ _gather_56[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "with_item _loop0_57"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_59[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_60"));
+ D(fprintf(stderr, "%*c%s _gather_56[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "with_item _loop0_57"));
}
_res = NULL;
done:
@@ -24632,9 +24525,9 @@ _gather_59_rule(Parser *p)
return _res;
}
-// _tmp_61: literal_expr | attr
+// _tmp_58: ',' | ')' | ':'
static void *
-_tmp_61_rule(Parser *p)
+_tmp_58_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24643,43 +24536,62 @@ _tmp_61_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // literal_expr
+ { // ','
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr"));
- expr_ty literal_expr_var;
+ D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','"));
+ Token * _literal;
if (
- (literal_expr_var = literal_expr_rule(p)) // literal_expr
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
)
{
- D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr"));
- _res = literal_expr_var;
+ D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr"));
+ D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','"));
}
- { // attr
+ { // ')'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
- expr_ty attr_var;
+ D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'"));
+ Token * _literal;
if (
- (attr_var = attr_rule(p)) // attr
+ (_literal = _PyPegen_expect_token(p, 8)) // token=')'
)
{
- D(fprintf(stderr, "%*c+ _tmp_61[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
- _res = attr_var;
+ D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_61[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
+ D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'"));
+ }
+ { // ':'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_58[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 11)) // token=':'
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_58[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_58[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'"));
}
_res = NULL;
done:
@@ -24687,9 +24599,9 @@ _tmp_61_rule(Parser *p)
return _res;
}
-// _loop0_63: ',' pattern
+// _loop1_59: except_block
static asdl_seq *
-_loop0_63_rule(Parser *p)
+_loop1_59_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24708,27 +24620,18 @@ _loop0_63_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' pattern
+ { // except_block
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern"));
- Token * _literal;
- pattern_ty elem;
+ D(fprintf(stderr, "%*c> _loop1_59[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block"));
+ excepthandler_ty except_block_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = pattern_rule(p)) // pattern
+ (except_block_var = except_block_rule(p)) // except_block
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = except_block_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -24744,8 +24647,13 @@ _loop0_63_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern"));
+ D(fprintf(stderr, "%*c%s _loop1_59[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -24757,43 +24665,48 @@ _loop0_63_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_59_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_62: pattern _loop0_63
-static asdl_seq *
-_gather_62_rule(Parser *p)
+// _tmp_60: 'as' NAME
+static void *
+_tmp_60_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- { // pattern _loop0_63
+ { // 'as' NAME
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63"));
- pattern_ty elem;
- asdl_seq * seq;
+ D(fprintf(stderr, "%*c> _tmp_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ Token * _keyword;
+ expr_ty z;
if (
- (elem = pattern_rule(p)) // pattern
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
- (seq = _loop0_63_rule(p)) // _loop0_63
+ (z = _PyPegen_name_token(p)) // NAME
)
{
- D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_63"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ D(fprintf(stderr, "%*c+ _tmp_60[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME"));
+ _res = z;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_63"));
+ D(fprintf(stderr, "%*c%s _tmp_60[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME"));
}
_res = NULL;
done:
@@ -24801,9 +24714,9 @@ _gather_62_rule(Parser *p)
return _res;
}
-// _loop0_65: ',' keyword_pattern
+// _loop1_61: case_block
static asdl_seq *
-_loop0_65_rule(Parser *p)
+_loop1_61_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24822,18 +24735,89 @@ _loop0_65_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' keyword_pattern
+ { // case_block
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _loop1_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "case_block"));
+ match_case_ty case_block_var;
+ while (
+ (case_block_var = case_block_rule(p)) // case_block
+ )
+ {
+ _res = case_block_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _loop1_61[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "case_block"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_61_type, _seq);
+ D(p->level--);
+ return _seq;
+}
+
+// _loop0_63: '|' closed_pattern
+static asdl_seq *
+_loop0_63_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void *_res = NULL;
+ int _mark = p->mark;
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // '|' closed_pattern
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern"));
+ D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern"));
Token * _literal;
- KeyPatternPair* elem;
+ pattern_ty elem;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ (_literal = _PyPegen_expect_token(p, 18)) // token='|'
&&
- (elem = keyword_pattern_rule(p)) // keyword_pattern
+ (elem = closed_pattern_rule(p)) // closed_pattern
)
{
_res = elem;
@@ -24858,8 +24842,8 @@ _loop0_65_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_65[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern"));
+ D(fprintf(stderr, "%*c%s _loop0_63[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'|' closed_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -24871,14 +24855,14 @@ _loop0_65_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_65_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_63_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_64: keyword_pattern _loop0_65
+// _gather_62: closed_pattern _loop0_63
static asdl_seq *
-_gather_64_rule(Parser *p)
+_gather_62_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24887,27 +24871,27 @@ _gather_64_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // keyword_pattern _loop0_65
+ { // closed_pattern _loop0_63
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65"));
- KeyPatternPair* elem;
+ D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_63"));
+ pattern_ty elem;
asdl_seq * seq;
if (
- (elem = keyword_pattern_rule(p)) // keyword_pattern
+ (elem = closed_pattern_rule(p)) // closed_pattern
&&
- (seq = _loop0_65_rule(p)) // _loop0_65
+ (seq = _loop0_63_rule(p)) // _loop0_63
)
{
- D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_65"));
+ D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_63"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_65"));
+ D(fprintf(stderr, "%*c%s _gather_62[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_63"));
}
_res = NULL;
done:
@@ -24915,9 +24899,9 @@ _gather_64_rule(Parser *p)
return _res;
}
-// _tmp_66: 'from' expression
+// _tmp_64: '+' | '-'
static void *
-_tmp_66_rule(Parser *p)
+_tmp_64_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24926,32 +24910,43 @@ _tmp_66_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // 'from' expression
+ { // '+'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from' expression"));
- Token * _keyword;
- expr_ty z;
+ D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
+ Token * _literal;
if (
- (_keyword = _PyPegen_expect_token(p, 514)) // token='from'
- &&
- (z = expression_rule(p)) // expression
+ (_literal = _PyPegen_expect_token(p, 14)) // token='+'
)
{
- D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from' expression"));
- _res = z;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'from' expression"));
+ D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+ }
+ { // '-'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 15)) // token='-'
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_64[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
}
_res = NULL;
done:
@@ -24959,9 +24954,9 @@ _tmp_66_rule(Parser *p)
return _res;
}
-// _tmp_67: '->' expression
+// _tmp_65: '+' | '-'
static void *
-_tmp_67_rule(Parser *p)
+_tmp_65_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -24970,32 +24965,43 @@ _tmp_67_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // '->' expression
+ { // '+'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'"));
Token * _literal;
- expr_ty z;
if (
- (_literal = _PyPegen_expect_token(p, 51)) // token='->'
- &&
- (z = expression_rule(p)) // expression
+ (_literal = _PyPegen_expect_token(p, 14)) // token='+'
)
{
- D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
- _res = z;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+ D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'"));
+ }
+ { // '-'
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 15)) // token='-'
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'-'"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_65[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'"));
}
_res = NULL;
done:
@@ -25003,9 +25009,9 @@ _tmp_67_rule(Parser *p)
return _res;
}
-// _tmp_68: '->' expression
+// _tmp_66: '.' | '(' | '='
static void *
-_tmp_68_rule(Parser *p)
+_tmp_66_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25014,32 +25020,62 @@ _tmp_68_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // '->' expression
+ { // '.'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression"));
+ D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
Token * _literal;
- expr_ty z;
if (
- (_literal = _PyPegen_expect_token(p, 51)) // token='->'
- &&
- (z = expression_rule(p)) // expression
+ (_literal = _PyPegen_expect_token(p, 23)) // token='.'
)
{
- D(fprintf(stderr, "%*c+ _tmp_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression"));
- _res = z;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression"));
+ D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ }
+ { // '('
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ }
+ { // '='
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 22)) // token='='
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
}
_res = NULL;
done:
@@ -25047,9 +25083,9 @@ _tmp_68_rule(Parser *p)
return _res;
}
-// _tmp_69: NEWLINE INDENT
+// _tmp_67: '.' | '(' | '='
static void *
-_tmp_69_rule(Parser *p)
+_tmp_67_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25058,27 +25094,62 @@ _tmp_69_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // NEWLINE INDENT
+ { // '.'
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
- Token * indent_var;
- Token * newline_var;
+ D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'"));
+ Token * _literal;
if (
- (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
- &&
- (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
+ (_literal = _PyPegen_expect_token(p, 23)) // token='.'
)
{
- D(fprintf(stderr, "%*c+ _tmp_69[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
- _res = _PyPegen_dummy_name(p, newline_var, indent_var);
+ D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'"));
+ _res = _literal;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
+ D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'"));
+ }
+ { // '('
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 7)) // token='('
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('"));
+ }
+ { // '='
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='"));
+ Token * _literal;
+ if (
+ (_literal = _PyPegen_expect_token(p, 22)) // token='='
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='"));
+ _res = _literal;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='"));
}
_res = NULL;
done:
@@ -25086,9 +25157,9 @@ _tmp_69_rule(Parser *p)
return _res;
}
-// _loop0_70: param_no_default
+// _loop0_69: ',' maybe_star_pattern
static asdl_seq *
-_loop0_70_rule(Parser *p)
+_loop0_69_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25107,18 +25178,27 @@ _loop0_70_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_no_default
+ { // ',' maybe_star_pattern
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern"));
+ Token * _literal;
+ pattern_ty elem;
while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
)
{
- _res = param_no_default_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25134,8 +25214,8 @@ _loop0_70_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_70[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+ D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' maybe_star_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25147,80 +25227,53 @@ _loop0_70_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_70_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_69_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_71: param_with_default
+// _gather_68: maybe_star_pattern _loop0_69
static asdl_seq *
-_loop0_71_rule(Parser *p)
+_gather_68_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // param_with_default
+ { // maybe_star_pattern _loop0_69
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
- while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_69"));
+ pattern_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern
+ &&
+ (seq = _loop0_69_rule(p)) // _loop0_69
)
{
- _res = param_with_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_69"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+ D(fprintf(stderr, "%*c%s _gather_68[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_69"));
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_72: param_with_default
+// _loop0_71: ',' key_value_pattern
static asdl_seq *
-_loop0_72_rule(Parser *p)
+_loop0_71_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25239,18 +25292,27 @@ _loop0_72_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_with_default
+ { // ',' key_value_pattern
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern"));
+ Token * _literal;
+ KeyPatternPair* elem;
while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = key_value_pattern_rule(p)) // key_value_pattern
)
{
- _res = param_with_default_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25266,8 +25328,8 @@ _loop0_72_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_72[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+ D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' key_value_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25279,83 +25341,106 @@ _loop0_72_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_72_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_73: param_no_default
+// _gather_70: key_value_pattern _loop0_71
static asdl_seq *
-_loop1_73_rule(Parser *p)
+_gather_70_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // param_no_default
+ { // key_value_pattern _loop0_71
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
- while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71"));
+ KeyPatternPair* elem;
+ asdl_seq * seq;
+ if (
+ (elem = key_value_pattern_rule(p)) // key_value_pattern
+ &&
+ (seq = _loop0_71_rule(p)) // _loop0_71
)
{
- _res = param_no_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_73[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+ D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_71"));
}
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _tmp_72: literal_expr | attr
+static void *
+_tmp_72_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // literal_expr
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr"));
+ expr_ty literal_expr_var;
+ if (
+ (literal_expr_var = literal_expr_rule(p)) // literal_expr
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "literal_expr"));
+ _res = literal_expr_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_73_type, _seq);
+ { // attr
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr"));
+ expr_ty attr_var;
+ if (
+ (attr_var = attr_rule(p)) // attr
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr"));
+ _res = attr_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_72[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr"));
+ }
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_74: param_with_default
+// _loop0_74: ',' pattern
static asdl_seq *
_loop0_74_rule(Parser *p)
{
@@ -25376,18 +25461,27 @@ _loop0_74_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_with_default
+ { // ',' pattern
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern"));
+ Token * _literal;
+ pattern_ty elem;
while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = pattern_rule(p)) // pattern
)
{
- _res = param_with_default_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25404,7 +25498,7 @@ _loop0_74_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25421,80 +25515,48 @@ _loop0_74_rule(Parser *p)
return _seq;
}
-// _loop1_75: param_with_default
+// _gather_73: pattern _loop0_74
static asdl_seq *
-_loop1_75_rule(Parser *p)
+_gather_73_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // param_with_default
+ { // pattern _loop0_74
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
- while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ D(fprintf(stderr, "%*c> _gather_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_74"));
+ pattern_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = pattern_rule(p)) // pattern
+ &&
+ (seq = _loop0_74_rule(p)) // _loop0_74
)
{
- _res = param_with_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_74"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_75[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_74"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_75_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop1_76: param_no_default
+// _loop0_76: ',' keyword_pattern
static asdl_seq *
-_loop1_76_rule(Parser *p)
+_loop0_76_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25513,18 +25575,27 @@ _loop1_76_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_no_default
+ { // ',' keyword_pattern
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern"));
+ Token * _literal;
+ KeyPatternPair* elem;
while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = keyword_pattern_rule(p)) // keyword_pattern
)
{
- _res = param_no_default_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25540,13 +25611,8 @@ _loop1_76_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_76[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' keyword_pattern"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25558,85 +25624,53 @@ _loop1_76_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_76_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_77: param_no_default
+// _gather_75: keyword_pattern _loop0_76
static asdl_seq *
-_loop1_77_rule(Parser *p)
+_gather_75_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // param_no_default
+ { // keyword_pattern _loop0_76
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
- while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ D(fprintf(stderr, "%*c> _gather_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_76"));
+ KeyPatternPair* elem;
+ asdl_seq * seq;
+ if (
+ (elem = keyword_pattern_rule(p)) // keyword_pattern
+ &&
+ (seq = _loop0_76_rule(p)) // _loop0_76
)
{
- _res = param_no_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_76"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _gather_75[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_76"));
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_78: param_no_default
+// _loop1_77: (',' expression)
static asdl_seq *
-_loop0_78_rule(Parser *p)
+_loop1_77_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25655,18 +25689,18 @@ _loop0_78_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_no_default
+ { // (',' expression)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
+ void *_tmp_183_var;
while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ (_tmp_183_var = _tmp_183_rule(p)) // ',' expression
)
{
- _res = param_no_default_var;
+ _res = _tmp_183_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25682,8 +25716,13 @@ _loop0_78_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_78[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+ D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25695,14 +25734,14 @@ _loop0_78_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_77_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_79: param_with_default
+// _loop1_78: (',' star_expression)
static asdl_seq *
-_loop1_79_rule(Parser *p)
+_loop1_78_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25721,18 +25760,18 @@ _loop1_79_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_with_default
+ { // (',' star_expression)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
+ void *_tmp_184_var;
while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ (_tmp_184_var = _tmp_184_rule(p)) // ',' star_expression
)
{
- _res = param_with_default_var;
+ _res = _tmp_184_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25748,8 +25787,8 @@ _loop1_79_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
+ D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -25766,12 +25805,12 @@ _loop1_79_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_78_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_80: param_no_default
+// _loop0_80: ',' star_named_expression
static asdl_seq *
_loop0_80_rule(Parser *p)
{
@@ -25792,18 +25831,27 @@ _loop0_80_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_no_default
+ { // ',' star_named_expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default"));
- arg_ty param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
+ Token * _literal;
+ expr_ty elem;
while (
- (param_no_default_var = param_no_default_rule(p)) // param_no_default
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = star_named_expression_rule(p)) // star_named_expression
)
{
- _res = param_no_default_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25820,7 +25868,7 @@ _loop0_80_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_no_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25837,80 +25885,48 @@ _loop0_80_rule(Parser *p)
return _seq;
}
-// _loop1_81: param_with_default
+// _gather_79: star_named_expression _loop0_80
static asdl_seq *
-_loop1_81_rule(Parser *p)
+_gather_79_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // param_with_default
+ { // star_named_expression _loop0_80
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default"));
- NameDefaultPair* param_with_default_var;
- while (
- (param_with_default_var = param_with_default_rule(p)) // param_with_default
+ D(fprintf(stderr, "%*c> _gather_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_80"));
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = star_named_expression_rule(p)) // star_named_expression
+ &&
+ (seq = _loop0_80_rule(p)) // _loop0_80
)
{
- _res = param_with_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_80"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _gather_79[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_80"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_82: param_maybe_default
+// _loop1_81: ('or' conjunction)
static asdl_seq *
-_loop0_82_rule(Parser *p)
+_loop1_81_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25929,18 +25945,18 @@ _loop0_82_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_maybe_default
+ { // ('or' conjunction)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
- NameDefaultPair* param_maybe_default_var;
+ D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
+ void *_tmp_185_var;
while (
- (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
+ (_tmp_185_var = _tmp_185_rule(p)) // 'or' conjunction
)
{
- _res = param_maybe_default_var;
+ _res = _tmp_185_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -25956,8 +25972,13 @@ _loop0_82_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_82[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
+ D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -25969,14 +25990,14 @@ _loop0_82_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_81_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_83: param_maybe_default
+// _loop1_82: ('and' inversion)
static asdl_seq *
-_loop1_83_rule(Parser *p)
+_loop1_82_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -25995,18 +26016,18 @@ _loop1_83_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // param_maybe_default
+ { // ('and' inversion)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_maybe_default"));
- NameDefaultPair* param_maybe_default_var;
+ D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
+ void *_tmp_186_var;
while (
- (param_maybe_default_var = param_maybe_default_rule(p)) // param_maybe_default
+ (_tmp_186_var = _tmp_186_rule(p)) // 'and' inversion
)
{
- _res = param_maybe_default_var;
+ _res = _tmp_186_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26022,8 +26043,8 @@ _loop1_83_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_maybe_default"));
+ D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -26040,14 +26061,14 @@ _loop1_83_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_82_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_84: ('@' named_expression NEWLINE)
+// _loop1_83: compare_op_bitwise_or_pair
static asdl_seq *
-_loop1_84_rule(Parser *p)
+_loop1_83_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26066,18 +26087,18 @@ _loop1_84_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ('@' named_expression NEWLINE)
+ { // compare_op_bitwise_or_pair
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)"));
- void *_tmp_182_var;
+ D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
+ CmpopExprPair* compare_op_bitwise_or_pair_var;
while (
- (_tmp_182_var = _tmp_182_rule(p)) // '@' named_expression NEWLINE
+ (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
)
{
- _res = _tmp_182_var;
+ _res = compare_op_bitwise_or_pair_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26093,8 +26114,8 @@ _loop1_84_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('@' named_expression NEWLINE)"));
+ D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -26111,14 +26132,14 @@ _loop1_84_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq);
D(p->level--);
return _seq;
}
-// _tmp_85: '(' arguments? ')'
+// _tmp_84: '!='
static void *
-_tmp_85_rule(Parser *p)
+_tmp_84_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26127,25 +26148,19 @@ _tmp_85_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // '(' arguments? ')'
+ { // '!='
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
- Token * _literal;
- Token * _literal_1;
- void *z;
+ D(fprintf(stderr, "%*c> _tmp_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
+ Token * tok;
if (
- (_literal = _PyPegen_expect_token(p, 7)) // token='('
- &&
- (z = arguments_rule(p), 1) // arguments?
- &&
- (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')'
+ (tok = _PyPegen_expect_token(p, 28)) // token='!='
)
{
- D(fprintf(stderr, "%*c+ _tmp_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'"));
- _res = z;
+ D(fprintf(stderr, "%*c+ _tmp_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
+ _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -26154,8 +26169,8 @@ _tmp_85_rule(Parser *p)
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_85[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'"));
+ D(fprintf(stderr, "%*c%s _tmp_84[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
}
_res = NULL;
done:
@@ -26163,9 +26178,9 @@ _tmp_85_rule(Parser *p)
return _res;
}
-// _loop1_86: (',' star_expression)
+// _loop0_86: ',' slice
static asdl_seq *
-_loop1_86_rule(Parser *p)
+_loop0_86_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26184,18 +26199,27 @@ _loop1_86_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // (',' star_expression)
+ { // ',' slice
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)"));
- void *_tmp_183_var;
+ D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
+ Token * _literal;
+ expr_ty elem;
while (
- (_tmp_183_var = _tmp_183_rule(p)) // ',' star_expression
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = slice_rule(p)) // slice
)
{
- _res = _tmp_183_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26211,13 +26235,8 @@ _loop1_86_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_86[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -26229,118 +26248,161 @@ _loop1_86_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_86_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_86_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_88: ',' star_named_expression
+// _gather_85: slice _loop0_86
static asdl_seq *
-_loop0_88_rule(Parser *p)
+_gather_85_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
+ { // slice _loop0_86
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _gather_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_86"));
+ expr_ty elem;
+ asdl_seq * seq;
+ if (
+ (elem = slice_rule(p)) // slice
+ &&
+ (seq = _loop0_86_rule(p)) // _loop0_86
+ )
+ {
+ D(fprintf(stderr, "%*c+ _gather_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_86"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _gather_85[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_86"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _tmp_87: ':' expression?
+static void *
+_tmp_87_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
D(p->level--);
return NULL;
}
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ',' star_named_expression
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // ':' expression?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression"));
+ D(fprintf(stderr, "%*c> _tmp_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
Token * _literal;
- expr_ty elem;
- while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ void *d;
+ if (
+ (_literal = _PyPegen_expect_token(p, 11)) // token=':'
&&
- (elem = star_named_expression_rule(p)) // star_named_expression
+ (d = expression_rule(p), 1) // expression?
)
{
- _res = elem;
+ D(fprintf(stderr, "%*c+ _tmp_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
+ _res = d;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
- PyMem_Free(_children);
D(p->level--);
return NULL;
}
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_88[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_named_expression"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _tmp_87[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _gather_87: star_named_expression _loop0_88
-static asdl_seq *
-_gather_87_rule(Parser *p)
+// _tmp_88: tuple | group | genexp
+static void *
+_tmp_88_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- { // star_named_expression _loop0_88
+ { // tuple
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88"));
- expr_ty elem;
- asdl_seq * seq;
+ D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
+ expr_ty tuple_var;
if (
- (elem = star_named_expression_rule(p)) // star_named_expression
- &&
- (seq = _loop0_88_rule(p)) // _loop0_88
+ (tuple_var = tuple_rule(p)) // tuple
)
{
- D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_88"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ D(fprintf(stderr, "%*c+ _tmp_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
+ _res = tuple_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_88"));
+ D(fprintf(stderr, "%*c%s _tmp_88[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
+ }
+ { // group
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
+ expr_ty group_var;
+ if (
+ (group_var = group_rule(p)) // group
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
+ _res = group_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_88[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
+ }
+ { // genexp
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
+ expr_ty genexp_var;
+ if (
+ (genexp_var = genexp_rule(p)) // genexp
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
+ _res = genexp_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_88[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
}
_res = NULL;
done:
@@ -26348,210 +26410,210 @@ _gather_87_rule(Parser *p)
return _res;
}
-// _loop1_89: (',' expression)
-static asdl_seq *
-_loop1_89_rule(Parser *p)
+// _tmp_89: list | listcomp
+static void *
+_tmp_89_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // (',' expression)
+ { // list
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)"));
- void *_tmp_184_var;
- while (
- (_tmp_184_var = _tmp_184_rule(p)) // ',' expression
+ D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
+ expr_ty list_var;
+ if (
+ (list_var = list_rule(p)) // list
)
{
- _res = _tmp_184_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
+ _res = list_var;
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_89[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ { // listcomp
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
+ expr_ty listcomp_var;
+ if (
+ (listcomp_var = listcomp_rule(p)) // listcomp
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
+ _res = listcomp_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_89_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_90: lambda_param_no_default
-static asdl_seq *
-_loop0_90_rule(Parser *p)
+// _tmp_90: dict | set | dictcomp | setcomp
+static void *
+_tmp_90_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ { // dict
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
+ expr_ty dict_var;
+ if (
+ (dict_var = dict_rule(p)) // dict
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
+ _res = dict_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
}
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // lambda_param_no_default
+ { // set
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
- arg_ty lambda_param_no_default_var;
- while (
- (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
+ expr_ty set_var;
+ if (
+ (set_var = set_rule(p)) // set
)
{
- _res = lambda_param_no_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _tmp_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
+ _res = set_var;
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_90[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+ D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ { // dictcomp
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
+ expr_ty dictcomp_var;
+ if (
+ (dictcomp_var = dictcomp_rule(p)) // dictcomp
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
+ _res = dictcomp_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_90_type, _seq);
+ { // setcomp
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
+ expr_ty setcomp_var;
+ if (
+ (setcomp_var = setcomp_rule(p)) // setcomp
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
+ _res = setcomp_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
+ }
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_91: lambda_param_with_default
-static asdl_seq *
-_loop0_91_rule(Parser *p)
+// _tmp_91: yield_expr | named_expression
+static void *
+_tmp_91_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // lambda_param_with_default
+ { // yield_expr
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
- NameDefaultPair* lambda_param_with_default_var;
- while (
- (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
+ D(fprintf(stderr, "%*c> _tmp_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ expr_ty yield_expr_var;
+ if (
+ (yield_expr_var = yield_expr_rule(p)) // yield_expr
)
{
- _res = lambda_param_with_default_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _tmp_91[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
+ _res = yield_expr_var;
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_91[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+ D(fprintf(stderr, "%*c%s _tmp_91[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
}
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ { // named_expression
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
+ expr_ty named_expression_var;
+ if (
+ (named_expression_var = named_expression_rule(p)) // named_expression
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_91[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
+ _res = named_expression_var;
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_91[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_91_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_92: lambda_param_with_default
+// _loop0_92: lambda_param_no_default
static asdl_seq *
_loop0_92_rule(Parser *p)
{
@@ -26572,18 +26634,18 @@ _loop0_92_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_with_default
+ { // lambda_param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
- NameDefaultPair* lambda_param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+ arg_ty lambda_param_no_default_var;
while (
- (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
+ (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
- _res = lambda_param_with_default_var;
+ _res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26600,7 +26662,7 @@ _loop0_92_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -26617,9 +26679,9 @@ _loop0_92_rule(Parser *p)
return _seq;
}
-// _loop1_93: lambda_param_no_default
+// _loop0_93: lambda_param_with_default
static asdl_seq *
-_loop1_93_rule(Parser *p)
+_loop0_93_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26638,18 +26700,18 @@ _loop1_93_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_no_default
+ { // lambda_param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
- arg_ty lambda_param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+ NameDefaultPair* lambda_param_with_default_var;
while (
- (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
- _res = lambda_param_no_default_var;
+ _res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26665,13 +26727,8 @@ _loop1_93_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_93[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -26683,7 +26740,7 @@ _loop1_93_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_93_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_93_type, _seq);
D(p->level--);
return _seq;
}
@@ -26754,7 +26811,7 @@ _loop0_94_rule(Parser *p)
return _seq;
}
-// _loop1_95: lambda_param_with_default
+// _loop1_95: lambda_param_no_default
static asdl_seq *
_loop1_95_rule(Parser *p)
{
@@ -26775,18 +26832,18 @@ _loop1_95_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_with_default
+ { // lambda_param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
- NameDefaultPair* lambda_param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+ arg_ty lambda_param_no_default_var;
while (
- (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
+ (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
- _res = lambda_param_with_default_var;
+ _res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26803,7 +26860,7 @@ _loop1_95_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -26825,9 +26882,9 @@ _loop1_95_rule(Parser *p)
return _seq;
}
-// _loop1_96: lambda_param_no_default
+// _loop0_96: lambda_param_with_default
static asdl_seq *
-_loop1_96_rule(Parser *p)
+_loop0_96_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26846,18 +26903,18 @@ _loop1_96_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_no_default
+ { // lambda_param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
- arg_ty lambda_param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+ NameDefaultPair* lambda_param_with_default_var;
while (
- (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
- _res = lambda_param_no_default_var;
+ _res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26873,13 +26930,8 @@ _loop1_96_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_96[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -26891,12 +26943,12 @@ _loop1_96_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_96_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_97: lambda_param_no_default
+// _loop1_97: lambda_param_with_default
static asdl_seq *
_loop1_97_rule(Parser *p)
{
@@ -26917,18 +26969,18 @@ _loop1_97_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_no_default
+ { // lambda_param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
- arg_ty lambda_param_no_default_var;
+ D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+ NameDefaultPair* lambda_param_with_default_var;
while (
- (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
+ (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
- _res = lambda_param_no_default_var;
+ _res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -26945,7 +26997,7 @@ _loop1_97_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -26967,9 +27019,9 @@ _loop1_97_rule(Parser *p)
return _seq;
}
-// _loop0_98: lambda_param_no_default
+// _loop1_98: lambda_param_no_default
static asdl_seq *
-_loop0_98_rule(Parser *p)
+_loop1_98_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -26993,7 +27045,7 @@ _loop0_98_rule(Parser *p)
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+ D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
arg_ty lambda_param_no_default_var;
while (
(lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
@@ -27015,9 +27067,14 @@ _loop0_98_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_98[%d-%d]: %s failed!\n", p->level, ' ',
+ D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
PyMem_Free(_children);
@@ -27028,12 +27085,12 @@ _loop0_98_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_98_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_99: lambda_param_with_default
+// _loop1_99: lambda_param_no_default
static asdl_seq *
_loop1_99_rule(Parser *p)
{
@@ -27054,18 +27111,18 @@ _loop1_99_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_with_default
+ { // lambda_param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
- NameDefaultPair* lambda_param_with_default_var;
+ D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+ arg_ty lambda_param_no_default_var;
while (
- (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
+ (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
- _res = lambda_param_with_default_var;
+ _res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27082,7 +27139,7 @@ _loop1_99_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -27241,7 +27298,7 @@ _loop1_101_rule(Parser *p)
return _seq;
}
-// _loop0_102: lambda_param_maybe_default
+// _loop0_102: lambda_param_no_default
static asdl_seq *
_loop0_102_rule(Parser *p)
{
@@ -27262,18 +27319,18 @@ _loop0_102_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_maybe_default
+ { // lambda_param_no_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
- NameDefaultPair* lambda_param_maybe_default_var;
+ D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default"));
+ arg_ty lambda_param_no_default_var;
while (
- (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
+ (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default
)
{
- _res = lambda_param_maybe_default_var;
+ _res = lambda_param_no_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27290,7 +27347,7 @@ _loop0_102_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -27307,7 +27364,7 @@ _loop0_102_rule(Parser *p)
return _seq;
}
-// _loop1_103: lambda_param_maybe_default
+// _loop1_103: lambda_param_with_default
static asdl_seq *
_loop1_103_rule(Parser *p)
{
@@ -27328,18 +27385,18 @@ _loop1_103_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // lambda_param_maybe_default
+ { // lambda_param_with_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
- NameDefaultPair* lambda_param_maybe_default_var;
+ D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default"));
+ NameDefaultPair* lambda_param_with_default_var;
while (
- (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
+ (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default
)
{
- _res = lambda_param_maybe_default_var;
+ _res = lambda_param_with_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27356,7 +27413,7 @@ _loop1_103_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -27378,9 +27435,9 @@ _loop1_103_rule(Parser *p)
return _seq;
}
-// _loop1_104: ('or' conjunction)
+// _loop0_104: lambda_param_maybe_default
static asdl_seq *
-_loop1_104_rule(Parser *p)
+_loop0_104_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -27399,18 +27456,18 @@ _loop1_104_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ('or' conjunction)
+ { // lambda_param_maybe_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)"));
- void *_tmp_185_var;
+ D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
+ NameDefaultPair* lambda_param_maybe_default_var;
while (
- (_tmp_185_var = _tmp_185_rule(p)) // 'or' conjunction
+ (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
)
{
- _res = _tmp_185_var;
+ _res = lambda_param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27426,13 +27483,8 @@ _loop1_104_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_104[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -27444,12 +27496,12 @@ _loop1_104_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_104_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq);
D(p->level--);
return _seq;
}
-// _loop1_105: ('and' inversion)
+// _loop1_105: lambda_param_maybe_default
static asdl_seq *
_loop1_105_rule(Parser *p)
{
@@ -27470,18 +27522,18 @@ _loop1_105_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ('and' inversion)
+ { // lambda_param_maybe_default
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)"));
- void *_tmp_186_var;
+ D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default"));
+ NameDefaultPair* lambda_param_maybe_default_var;
while (
- (_tmp_186_var = _tmp_186_rule(p)) // 'and' inversion
+ (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default
)
{
- _res = _tmp_186_var;
+ _res = lambda_param_maybe_default_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27498,7 +27550,7 @@ _loop1_105_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -27520,7 +27572,7 @@ _loop1_105_rule(Parser *p)
return _seq;
}
-// _loop1_106: compare_op_bitwise_or_pair
+// _loop1_106: STRING
static asdl_seq *
_loop1_106_rule(Parser *p)
{
@@ -27541,18 +27593,18 @@ _loop1_106_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // compare_op_bitwise_or_pair
+ { // STRING
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair"));
- CmpopExprPair* compare_op_bitwise_or_pair_var;
+ D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
+ expr_ty string_var;
while (
- (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair
+ (string_var = _PyPegen_string_token(p)) // STRING
)
{
- _res = compare_op_bitwise_or_pair_var;
+ _res = string_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -27569,7 +27621,7 @@ _loop1_106_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "compare_op_bitwise_or_pair"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
}
if (_n == 0 || p->error_indicator) {
PyMem_Free(_children);
@@ -27591,7 +27643,7 @@ _loop1_106_rule(Parser *p)
return _seq;
}
-// _tmp_107: '!='
+// _tmp_107: star_named_expression ',' star_named_expressions?
static void *
_tmp_107_rule(Parser *p)
{
@@ -27602,19 +27654,25 @@ _tmp_107_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // '!='
+ { // star_named_expression ',' star_named_expressions?
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='"));
- Token * tok;
+ D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+ Token * _literal;
+ expr_ty y;
+ void *z;
if (
- (tok = _PyPegen_expect_token(p, 28)) // token='!='
+ (y = star_named_expression_rule(p)) // star_named_expression
+ &&
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (z = star_named_expressions_rule(p), 1) // star_named_expressions?
)
{
- D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='"));
- _res = _PyPegen_check_barry_as_flufl ( p , tok ) ? NULL : tok;
+ D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+ _res = _PyPegen_seq_insert_in_front ( p , y , z );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);
@@ -27624,7 +27682,7 @@ _tmp_107_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
}
_res = NULL;
done:
@@ -27632,7 +27690,7 @@ _tmp_107_rule(Parser *p)
return _res;
}
-// _loop0_109: ',' slice
+// _loop0_109: ',' double_starred_kvpair
static asdl_seq *
_loop0_109_rule(Parser *p)
{
@@ -27653,18 +27711,18 @@ _loop0_109_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' slice
+ { // ',' double_starred_kvpair
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice"));
+ D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
Token * _literal;
- expr_ty elem;
+ KeyValuePair* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = slice_rule(p)) // slice
+ (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
)
{
_res = elem;
@@ -27690,7 +27748,7 @@ _loop0_109_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' slice"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -27707,7 +27765,7 @@ _loop0_109_rule(Parser *p)
return _seq;
}
-// _gather_108: slice _loop0_109
+// _gather_108: double_starred_kvpair _loop0_109
static asdl_seq *
_gather_108_rule(Parser *p)
{
@@ -27718,27 +27776,27 @@ _gather_108_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // slice _loop0_109
+ { // double_starred_kvpair _loop0_109
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_109"));
- expr_ty elem;
+ D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_109"));
+ KeyValuePair* elem;
asdl_seq * seq;
if (
- (elem = slice_rule(p)) // slice
+ (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
&&
(seq = _loop0_109_rule(p)) // _loop0_109
)
{
- D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_109"));
+ D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_109"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_108[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_109"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_109"));
}
_res = NULL;
done:
@@ -27746,180 +27804,210 @@ _gather_108_rule(Parser *p)
return _res;
}
-// _tmp_110: ':' expression?
-static void *
-_tmp_110_rule(Parser *p)
+// _loop1_110: for_if_clause
+static asdl_seq *
+_loop1_110_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // ':' expression?
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // for_if_clause
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?"));
- Token * _literal;
- void *d;
- if (
- (_literal = _PyPegen_expect_token(p, 11)) // token=':'
- &&
- (d = expression_rule(p), 1) // expression?
+ D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
+ comprehension_ty for_if_clause_var;
+ while (
+ (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
)
{
- D(fprintf(stderr, "%*c+ _tmp_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?"));
- _res = d;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
+ _res = for_if_clause_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
}
- goto done;
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_110[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?"));
+ D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
}
- _res = NULL;
- done:
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_110_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_111: tuple | group | genexp
-static void *
-_tmp_111_rule(Parser *p)
+// _loop0_111: ('if' disjunction)
+static asdl_seq *
+_loop0_111_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // tuple
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple"));
- expr_ty tuple_var;
- if (
- (tuple_var = tuple_rule(p)) // tuple
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple"));
- _res = tuple_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // group
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // ('if' disjunction)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group"));
- expr_ty group_var;
- if (
- (group_var = group_rule(p)) // group
+ D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
+ void *_tmp_187_var;
+ while (
+ (_tmp_187_var = _tmp_187_rule(p)) // 'if' disjunction
)
{
- D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "group"));
- _res = group_var;
- goto done;
+ _res = _tmp_187_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group"));
+ D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
}
- { // genexp
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp"));
- expr_ty genexp_var;
- if (
- (genexp_var = genexp_rule(p)) // genexp
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_111[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp"));
- _res = genexp_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_111[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp"));
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- _res = NULL;
- done:
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_112: list | listcomp
-static void *
-_tmp_112_rule(Parser *p)
+// _loop0_112: ('if' disjunction)
+static asdl_seq *
+_loop0_112_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // list
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list"));
- expr_ty list_var;
- if (
- (list_var = list_rule(p)) // list
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list"));
- _res = list_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list"));
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
}
- { // listcomp
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // ('if' disjunction)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp"));
- expr_ty listcomp_var;
- if (
- (listcomp_var = listcomp_rule(p)) // listcomp
+ D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
+ void *_tmp_188_var;
+ while (
+ (_tmp_188_var = _tmp_188_rule(p)) // 'if' disjunction
)
{
- D(fprintf(stderr, "%*c+ _tmp_112[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "listcomp"));
- _res = listcomp_var;
- goto done;
+ _res = _tmp_188_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
+ }
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_112[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp"));
+ D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_112_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _tmp_113: dict | set | dictcomp | setcomp
+// _tmp_113: assigment_expression | expression !':='
static void *
_tmp_113_rule(Parser *p)
{
@@ -27930,81 +28018,45 @@ _tmp_113_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // dict
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict"));
- expr_ty dict_var;
- if (
- (dict_var = dict_rule(p)) // dict
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dict"));
- _res = dict_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict"));
- }
- { // set
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set"));
- expr_ty set_var;
- if (
- (set_var = set_rule(p)) // set
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set"));
- _res = set_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set"));
- }
- { // dictcomp
+ { // assigment_expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp"));
- expr_ty dictcomp_var;
+ D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assigment_expression"));
+ expr_ty assigment_expression_var;
if (
- (dictcomp_var = dictcomp_rule(p)) // dictcomp
+ (assigment_expression_var = assigment_expression_rule(p)) // assigment_expression
)
{
- D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "dictcomp"));
- _res = dictcomp_var;
+ D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assigment_expression"));
+ _res = assigment_expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assigment_expression"));
}
- { // setcomp
+ { // expression !':='
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp"));
- expr_ty setcomp_var;
+ D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+ expr_ty expression_var;
if (
- (setcomp_var = setcomp_rule(p)) // setcomp
+ (expression_var = expression_rule(p)) // expression
+ &&
+ _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
)
{
- D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "setcomp"));
- _res = setcomp_var;
+ D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
+ _res = expression_var;
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
}
_res = NULL;
done:
@@ -28012,9 +28064,9 @@ _tmp_113_rule(Parser *p)
return _res;
}
-// _loop1_114: STRING
+// _loop0_115: ',' (starred_expression | (assigment_expression | expression !':=') !'=')
static asdl_seq *
-_loop1_114_rule(Parser *p)
+_loop0_115_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -28033,18 +28085,27 @@ _loop1_114_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // STRING
+ { // ',' (starred_expression | (assigment_expression | expression !':=') !'=')
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING"));
- expr_ty string_var;
+ D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assigment_expression | expression !':=') !'=')"));
+ Token * _literal;
+ void *elem;
while (
- (string_var = _PyPegen_string_token(p)) // STRING
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = _tmp_189_rule(p)) // starred_expression | (assigment_expression | expression !':=') !'='
)
{
- _res = string_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -28060,13 +28121,8 @@ _loop1_114_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_114[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assigment_expression | expression !':=') !'=')"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28078,51 +28134,44 @@ _loop1_114_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_114_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_115_type, _seq);
D(p->level--);
return _seq;
}
-// _tmp_115: star_named_expression ',' star_named_expressions?
-static void *
-_tmp_115_rule(Parser *p)
+// _gather_114:
+// | (starred_expression | (assigment_expression | expression !':=') !'=') _loop0_115
+static asdl_seq *
+_gather_114_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- { // star_named_expression ',' star_named_expressions?
+ { // (starred_expression | (assigment_expression | expression !':=') !'=') _loop0_115
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
- Token * _literal;
- expr_ty y;
- void *z;
+ D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_115"));
+ void *elem;
+ asdl_seq * seq;
if (
- (y = star_named_expression_rule(p)) // star_named_expression
- &&
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ (elem = _tmp_189_rule(p)) // starred_expression | (assigment_expression | expression !':=') !'='
&&
- (z = star_named_expressions_rule(p), 1) // star_named_expressions?
+ (seq = _loop0_115_rule(p)) // _loop0_115
)
{
- D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
- _res = _PyPegen_seq_insert_in_front ( p , y , z );
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
- }
+ D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_115"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?"));
+ D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_115"));
}
_res = NULL;
done:
@@ -28130,7 +28179,7 @@ _tmp_115_rule(Parser *p)
return _res;
}
-// _tmp_116: yield_expr | named_expression
+// _tmp_116: ',' kwargs
static void *
_tmp_116_rule(Parser *p)
{
@@ -28141,100 +28190,32 @@ _tmp_116_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // yield_expr
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr"));
- expr_ty yield_expr_var;
- if (
- (yield_expr_var = yield_expr_rule(p)) // yield_expr
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr"));
- _res = yield_expr_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr"));
- }
- { // named_expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
- expr_ty named_expression_var;
- if (
- (named_expression_var = named_expression_rule(p)) // named_expression
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
- _res = named_expression_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
- }
- _res = NULL;
- done:
- D(p->level--);
- return _res;
-}
-
-// _tmp_117: assigment_expression | expression !':='
-static void *
-_tmp_117_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void * _res = NULL;
- int _mark = p->mark;
- { // assigment_expression
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assigment_expression"));
- expr_ty assigment_expression_var;
- if (
- (assigment_expression_var = assigment_expression_rule(p)) // assigment_expression
- )
- {
- D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assigment_expression"));
- _res = assigment_expression_var;
- goto done;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assigment_expression"));
- }
- { // expression !':='
+ { // ',' kwargs
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='"));
- expr_ty expression_var;
+ D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
+ Token * _literal;
+ asdl_seq* k;
if (
- (expression_var = expression_rule(p)) // expression
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':='
+ (k = kwargs_rule(p)) // kwargs
)
{
- D(fprintf(stderr, "%*c+ _tmp_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='"));
- _res = expression_var;
+ D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
+ _res = k;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ D(p->level--);
+ return NULL;
+ }
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_117[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='"));
+ D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
}
_res = NULL;
done:
@@ -28242,9 +28223,9 @@ _tmp_117_rule(Parser *p)
return _res;
}
-// _loop0_119: ',' double_starred_kvpair
+// _loop0_118: ',' kwarg_or_starred
static asdl_seq *
-_loop0_119_rule(Parser *p)
+_loop0_118_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -28263,18 +28244,18 @@ _loop0_119_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' double_starred_kvpair
+ { // ',' kwarg_or_starred
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair"));
+ D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
Token * _literal;
- KeyValuePair* elem;
+ KeywordOrStarred* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
+ (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
)
{
_res = elem;
@@ -28299,8 +28280,8 @@ _loop0_119_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_119[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair"));
+ D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28312,14 +28293,14 @@ _loop0_119_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_119_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_118_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_118: double_starred_kvpair _loop0_119
+// _gather_117: kwarg_or_starred _loop0_118
static asdl_seq *
-_gather_118_rule(Parser *p)
+_gather_117_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -28328,27 +28309,27 @@ _gather_118_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // double_starred_kvpair _loop0_119
+ { // kwarg_or_starred _loop0_118
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119"));
- KeyValuePair* elem;
+ D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_118"));
+ KeywordOrStarred* elem;
asdl_seq * seq;
if (
- (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair
+ (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
&&
- (seq = _loop0_119_rule(p)) // _loop0_119
+ (seq = _loop0_118_rule(p)) // _loop0_118
)
{
- D(fprintf(stderr, "%*c+ _gather_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_119"));
+ D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_118"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_118[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_119"));
+ D(fprintf(stderr, "%*c%s _gather_117[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_118"));
}
_res = NULL;
done:
@@ -28356,9 +28337,9 @@ _gather_118_rule(Parser *p)
return _res;
}
-// _loop1_120: for_if_clause
+// _loop0_120: ',' kwarg_or_double_starred
static asdl_seq *
-_loop1_120_rule(Parser *p)
+_loop0_120_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -28377,18 +28358,27 @@ _loop1_120_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // for_if_clause
+ { // ',' kwarg_or_double_starred
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause"));
- comprehension_ty for_if_clause_var;
+ D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
+ Token * _literal;
+ KeywordOrStarred* elem;
while (
- (for_if_clause_var = for_if_clause_rule(p)) // for_if_clause
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
)
{
- _res = for_if_clause_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -28404,13 +28394,8 @@ _loop1_120_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_120[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28422,78 +28407,51 @@ _loop1_120_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_120_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq);
D(p->level--);
return _seq;
}
-// _loop0_121: ('if' disjunction)
+// _gather_119: kwarg_or_double_starred _loop0_120
static asdl_seq *
-_loop0_121_rule(Parser *p)
+_gather_119_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void *_res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // ('if' disjunction)
+ { // kwarg_or_double_starred _loop0_120
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
- void *_tmp_187_var;
- while (
- (_tmp_187_var = _tmp_187_rule(p)) // 'if' disjunction
+ D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_120"));
+ KeywordOrStarred* elem;
+ asdl_seq * seq;
+ if (
+ (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
+ &&
+ (seq = _loop0_120_rule(p)) // _loop0_120
)
{
- _res = _tmp_187_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
+ D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_120"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_121[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_120"));
}
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_121_type, _seq);
+ _res = NULL;
+ done:
D(p->level--);
- return _seq;
+ return _res;
}
-// _loop0_122: ('if' disjunction)
+// _loop0_122: ',' kwarg_or_starred
static asdl_seq *
_loop0_122_rule(Parser *p)
{
@@ -28514,18 +28472,27 @@ _loop0_122_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ('if' disjunction)
+ { // ',' kwarg_or_starred
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)"));
- void *_tmp_188_var;
+ D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
+ Token * _literal;
+ KeywordOrStarred* elem;
while (
- (_tmp_188_var = _tmp_188_rule(p)) // 'if' disjunction
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
)
{
- _res = _tmp_188_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -28542,7 +28509,7 @@ _loop0_122_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('if' disjunction)"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28559,7 +28526,46 @@ _loop0_122_rule(Parser *p)
return _seq;
}
-// _loop0_124: ',' (starred_expression | (assigment_expression | expression !':=') !'=')
+// _gather_121: kwarg_or_starred _loop0_122
+static asdl_seq *
+_gather_121_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ asdl_seq * _res = NULL;
+ int _mark = p->mark;
+ { // kwarg_or_starred _loop0_122
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_122"));
+ KeywordOrStarred* elem;
+ asdl_seq * seq;
+ if (
+ (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
+ &&
+ (seq = _loop0_122_rule(p)) // _loop0_122
+ )
+ {
+ D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_122"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_122"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _loop0_124: ',' kwarg_or_double_starred
static asdl_seq *
_loop0_124_rule(Parser *p)
{
@@ -28580,18 +28586,18 @@ _loop0_124_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' (starred_expression | (assigment_expression | expression !':=') !'=')
+ { // ',' kwarg_or_double_starred
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assigment_expression | expression !':=') !'=')"));
+ D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
Token * _literal;
- void *elem;
+ KeywordOrStarred* elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = _tmp_189_rule(p)) // starred_expression | (assigment_expression | expression !':=') !'='
+ (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
)
{
_res = elem;
@@ -28617,7 +28623,7 @@ _loop0_124_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assigment_expression | expression !':=') !'=')"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28634,8 +28640,7 @@ _loop0_124_rule(Parser *p)
return _seq;
}
-// _gather_123:
-// | (starred_expression | (assigment_expression | expression !':=') !'=') _loop0_124
+// _gather_123: kwarg_or_double_starred _loop0_124
static asdl_seq *
_gather_123_rule(Parser *p)
{
@@ -28646,27 +28651,27 @@ _gather_123_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // (starred_expression | (assigment_expression | expression !':=') !'=') _loop0_124
+ { // kwarg_or_double_starred _loop0_124
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_124"));
- void *elem;
+ D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_124"));
+ KeywordOrStarred* elem;
asdl_seq * seq;
if (
- (elem = _tmp_189_rule(p)) // starred_expression | (assigment_expression | expression !':=') !'='
+ (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
&&
(seq = _loop0_124_rule(p)) // _loop0_124
)
{
- D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_124"));
+ D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_124"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assigment_expression | expression !':=') !'=') _loop0_124"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_124"));
}
_res = NULL;
done:
@@ -28674,51 +28679,73 @@ _gather_123_rule(Parser *p)
return _res;
}
-// _tmp_125: ',' kwargs
-static void *
-_tmp_125_rule(Parser *p)
+// _loop0_125: (',' star_target)
+static asdl_seq *
+_loop0_125_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ void *_res = NULL;
int _mark = p->mark;
- { // ',' kwargs
+ int _start_mark = p->mark;
+ void **_children = PyMem_Malloc(sizeof(void *));
+ if (!_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ Py_ssize_t _children_capacity = 1;
+ Py_ssize_t _n = 0;
+ { // (',' star_target)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
- Token * _literal;
- asdl_seq* k;
- if (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (k = kwargs_rule(p)) // kwargs
+ D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
+ void *_tmp_190_var;
+ while (
+ (_tmp_190_var = _tmp_190_rule(p)) // ',' star_target
)
{
- D(fprintf(stderr, "%*c+ _tmp_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs"));
- _res = k;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- D(p->level--);
- return NULL;
+ _res = _tmp_190_var;
+ if (_n == _children_capacity) {
+ _children_capacity *= 2;
+ void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
+ if (!_new_children) {
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ _children = _new_children;
}
- goto done;
+ _children[_n++] = _res;
+ _mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_125[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs"));
+ D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
}
- _res = NULL;
- done:
+ asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
+ if (!_seq) {
+ PyMem_Free(_children);
+ p->error_indicator = 1;
+ PyErr_NoMemory();
+ D(p->level--);
+ return NULL;
+ }
+ for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
+ PyMem_Free(_children);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_125_type, _seq);
D(p->level--);
- return _res;
+ return _seq;
}
-// _loop0_127: ',' kwarg_or_starred
+// _loop0_127: ',' star_target
static asdl_seq *
_loop0_127_rule(Parser *p)
{
@@ -28739,18 +28766,18 @@ _loop0_127_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' kwarg_or_starred
+ { // ',' star_target
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
+ D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
Token * _literal;
- KeywordOrStarred* elem;
+ expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
+ (elem = star_target_rule(p)) // star_target
)
{
_res = elem;
@@ -28776,7 +28803,7 @@ _loop0_127_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28793,7 +28820,7 @@ _loop0_127_rule(Parser *p)
return _seq;
}
-// _gather_126: kwarg_or_starred _loop0_127
+// _gather_126: star_target _loop0_127
static asdl_seq *
_gather_126_rule(Parser *p)
{
@@ -28804,27 +28831,27 @@ _gather_126_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // kwarg_or_starred _loop0_127
+ { // star_target _loop0_127
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
- KeywordOrStarred* elem;
+ D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_127"));
+ expr_ty elem;
asdl_seq * seq;
if (
- (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
+ (elem = star_target_rule(p)) // star_target
&&
(seq = _loop0_127_rule(p)) // _loop0_127
)
{
- D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_127"));
+ D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_127"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_126[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_127"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_127"));
}
_res = NULL;
done:
@@ -28832,9 +28859,9 @@ _gather_126_rule(Parser *p)
return _res;
}
-// _loop0_129: ',' kwarg_or_double_starred
+// _loop1_128: (',' star_target)
static asdl_seq *
-_loop0_129_rule(Parser *p)
+_loop1_128_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -28853,27 +28880,18 @@ _loop0_129_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' kwarg_or_double_starred
+ { // (',' star_target)
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
- Token * _literal;
- KeywordOrStarred* elem;
+ D(fprintf(stderr, "%*c> _loop1_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
+ void *_tmp_191_var;
while (
- (_literal = _PyPegen_expect_token(p, 12)) // token=','
- &&
- (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
+ (_tmp_191_var = _tmp_191_rule(p)) // ',' star_target
)
{
- _res = elem;
- if (_res == NULL && PyErr_Occurred()) {
- p->error_indicator = 1;
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
- }
+ _res = _tmp_191_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -28889,8 +28907,13 @@ _loop0_129_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_129[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
+ D(fprintf(stderr, "%*c%s _loop1_128[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
+ }
+ if (_n == 0 || p->error_indicator) {
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -28902,43 +28925,42 @@ _loop0_129_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop1_128_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_128: kwarg_or_double_starred _loop0_129
-static asdl_seq *
-_gather_128_rule(Parser *p)
+// _tmp_129: !'*' star_target
+static void *
+_tmp_129_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- asdl_seq * _res = NULL;
+ void * _res = NULL;
int _mark = p->mark;
- { // kwarg_or_double_starred _loop0_129
+ { // !'*' star_target
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
- KeywordOrStarred* elem;
- asdl_seq * seq;
+ D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
+ expr_ty star_target_var;
if (
- (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
+ _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
&&
- (seq = _loop0_129_rule(p)) // _loop0_129
+ (star_target_var = star_target_rule(p)) // star_target
)
{
- D(fprintf(stderr, "%*c+ _gather_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
- _res = _PyPegen_seq_insert_in_front(p, elem, seq);
+ D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
+ _res = star_target_var;
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_128[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_129"));
+ D(fprintf(stderr, "%*c%s _tmp_129[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
}
_res = NULL;
done:
@@ -28946,7 +28968,7 @@ _gather_128_rule(Parser *p)
return _res;
}
-// _loop0_131: ',' kwarg_or_starred
+// _loop0_131: ',' del_target
static asdl_seq *
_loop0_131_rule(Parser *p)
{
@@ -28967,18 +28989,18 @@ _loop0_131_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' kwarg_or_starred
+ { // ',' del_target
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred"));
+ D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
Token * _literal;
- KeywordOrStarred* elem;
+ expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
+ (elem = del_target_rule(p)) // del_target
)
{
_res = elem;
@@ -29004,7 +29026,7 @@ _loop0_131_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_starred"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -29021,7 +29043,7 @@ _loop0_131_rule(Parser *p)
return _seq;
}
-// _gather_130: kwarg_or_starred _loop0_131
+// _gather_130: del_target _loop0_131
static asdl_seq *
_gather_130_rule(Parser *p)
{
@@ -29032,27 +29054,27 @@ _gather_130_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // kwarg_or_starred _loop0_131
+ { // del_target _loop0_131
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
- KeywordOrStarred* elem;
+ D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_131"));
+ expr_ty elem;
asdl_seq * seq;
if (
- (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred
+ (elem = del_target_rule(p)) // del_target
&&
(seq = _loop0_131_rule(p)) // _loop0_131
)
{
- D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_131"));
+ D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_131"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_130[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_131"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_131"));
}
_res = NULL;
done:
@@ -29060,7 +29082,7 @@ _gather_130_rule(Parser *p)
return _res;
}
-// _loop0_133: ',' kwarg_or_double_starred
+// _loop0_133: ',' expression
static asdl_seq *
_loop0_133_rule(Parser *p)
{
@@ -29081,18 +29103,18 @@ _loop0_133_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' kwarg_or_double_starred
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred"));
+ D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
- KeywordOrStarred* elem;
+ expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
+ (elem = expression_rule(p)) // expression
)
{
_res = elem;
@@ -29118,7 +29140,7 @@ _loop0_133_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwarg_or_double_starred"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -29135,7 +29157,7 @@ _loop0_133_rule(Parser *p)
return _seq;
}
-// _gather_132: kwarg_or_double_starred _loop0_133
+// _gather_132: expression _loop0_133
static asdl_seq *
_gather_132_rule(Parser *p)
{
@@ -29146,27 +29168,27 @@ _gather_132_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // kwarg_or_double_starred _loop0_133
+ { // expression _loop0_133
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
- KeywordOrStarred* elem;
+ D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_133"));
+ expr_ty elem;
asdl_seq * seq;
if (
- (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred
+ (elem = expression_rule(p)) // expression
&&
(seq = _loop0_133_rule(p)) // _loop0_133
)
{
- D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
+ D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_133"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_133"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_133"));
}
_res = NULL;
done:
@@ -29174,75 +29196,9 @@ _gather_132_rule(Parser *p)
return _res;
}
-// _loop0_134: (',' star_target)
-static asdl_seq *
-_loop0_134_rule(Parser *p)
-{
- D(p->level++);
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- void *_res = NULL;
- int _mark = p->mark;
- int _start_mark = p->mark;
- void **_children = PyMem_Malloc(sizeof(void *));
- if (!_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- Py_ssize_t _children_capacity = 1;
- Py_ssize_t _n = 0;
- { // (',' star_target)
- if (p->error_indicator) {
- D(p->level--);
- return NULL;
- }
- D(fprintf(stderr, "%*c> _loop0_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
- void *_tmp_190_var;
- while (
- (_tmp_190_var = _tmp_190_rule(p)) // ',' star_target
- )
- {
- _res = _tmp_190_var;
- if (_n == _children_capacity) {
- _children_capacity *= 2;
- void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
- if (!_new_children) {
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- _children = _new_children;
- }
- _children[_n++] = _res;
- _mark = p->mark;
- }
- p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_134[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
- }
- asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
- if (!_seq) {
- PyMem_Free(_children);
- p->error_indicator = 1;
- PyErr_NoMemory();
- D(p->level--);
- return NULL;
- }
- for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
- PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_134_type, _seq);
- D(p->level--);
- return _seq;
-}
-
-// _loop0_136: ',' star_target
+// _loop0_135: ',' expression
static asdl_seq *
-_loop0_136_rule(Parser *p)
+_loop0_135_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -29261,18 +29217,18 @@ _loop0_136_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' star_target
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target"));
+ D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = star_target_rule(p)) // star_target
+ (elem = expression_rule(p)) // expression
)
{
_res = elem;
@@ -29297,8 +29253,8 @@ _loop0_136_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_136[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target"));
+ D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -29310,14 +29266,14 @@ _loop0_136_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_136_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_135: star_target _loop0_136
+// _gather_134: expression _loop0_135
static asdl_seq *
-_gather_135_rule(Parser *p)
+_gather_134_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -29326,27 +29282,27 @@ _gather_135_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // star_target _loop0_136
+ { // expression _loop0_135
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
+ D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_135"));
expr_ty elem;
asdl_seq * seq;
if (
- (elem = star_target_rule(p)) // star_target
+ (elem = expression_rule(p)) // expression
&&
- (seq = _loop0_136_rule(p)) // _loop0_136
+ (seq = _loop0_135_rule(p)) // _loop0_135
)
{
- D(fprintf(stderr, "%*c+ _gather_135[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_136"));
+ D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_135"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_135[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_136"));
+ D(fprintf(stderr, "%*c%s _gather_134[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_135"));
}
_res = NULL;
done:
@@ -29354,9 +29310,9 @@ _gather_135_rule(Parser *p)
return _res;
}
-// _loop1_137: (',' star_target)
+// _loop0_137: ',' expression
static asdl_seq *
-_loop1_137_rule(Parser *p)
+_loop0_137_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -29375,18 +29331,27 @@ _loop1_137_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // (',' star_target)
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop1_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)"));
- void *_tmp_191_var;
+ D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+ Token * _literal;
+ expr_ty elem;
while (
- (_tmp_191_var = _tmp_191_rule(p)) // ',' star_target
+ (_literal = _PyPegen_expect_token(p, 12)) // token=','
+ &&
+ (elem = expression_rule(p)) // expression
)
{
- _res = _tmp_191_var;
+ _res = elem;
+ if (_res == NULL && PyErr_Occurred()) {
+ p->error_indicator = 1;
+ PyMem_Free(_children);
+ D(p->level--);
+ return NULL;
+ }
if (_n == _children_capacity) {
_children_capacity *= 2;
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
@@ -29402,13 +29367,8 @@ _loop1_137_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop1_137[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)"));
- }
- if (_n == 0 || p->error_indicator) {
- PyMem_Free(_children);
- D(p->level--);
- return NULL;
+ D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -29420,42 +29380,43 @@ _loop1_137_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop1_137_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq);
D(p->level--);
return _seq;
}
-// _tmp_138: !'*' star_target
-static void *
-_tmp_138_rule(Parser *p)
+// _gather_136: expression _loop0_137
+static asdl_seq *
+_gather_136_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- void * _res = NULL;
+ asdl_seq * _res = NULL;
int _mark = p->mark;
- { // !'*' star_target
+ { // expression _loop0_137
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
- expr_ty star_target_var;
+ D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_137"));
+ expr_ty elem;
+ asdl_seq * seq;
if (
- _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*'
+ (elem = expression_rule(p)) // expression
&&
- (star_target_var = star_target_rule(p)) // star_target
+ (seq = _loop0_137_rule(p)) // _loop0_137
)
{
- D(fprintf(stderr, "%*c+ _tmp_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target"));
- _res = star_target_var;
+ D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_137"));
+ _res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _tmp_138[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target"));
+ D(fprintf(stderr, "%*c%s _gather_136[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_137"));
}
_res = NULL;
done:
@@ -29463,9 +29424,9 @@ _tmp_138_rule(Parser *p)
return _res;
}
-// _loop0_140: ',' del_target
+// _loop0_139: ',' expression
static asdl_seq *
-_loop0_140_rule(Parser *p)
+_loop0_139_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -29484,18 +29445,18 @@ _loop0_140_rule(Parser *p)
}
Py_ssize_t _children_capacity = 1;
Py_ssize_t _n = 0;
- { // ',' del_target
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _loop0_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target"));
+ D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
expr_ty elem;
while (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (elem = del_target_rule(p)) // del_target
+ (elem = expression_rule(p)) // expression
)
{
_res = elem;
@@ -29520,8 +29481,8 @@ _loop0_140_rule(Parser *p)
_mark = p->mark;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _loop0_140[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target"));
+ D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena);
if (!_seq) {
@@ -29533,14 +29494,14 @@ _loop0_140_rule(Parser *p)
}
for (int i = 0; i < _n; i++) asdl_seq_SET_UNTYPED(_seq, i, _children[i]);
PyMem_Free(_children);
- _PyPegen_insert_memo(p, _start_mark, _loop0_140_type, _seq);
+ _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq);
D(p->level--);
return _seq;
}
-// _gather_139: del_target _loop0_140
+// _gather_138: expression _loop0_139
static asdl_seq *
-_gather_139_rule(Parser *p)
+_gather_138_rule(Parser *p)
{
D(p->level++);
if (p->error_indicator) {
@@ -29549,27 +29510,66 @@ _gather_139_rule(Parser *p)
}
asdl_seq * _res = NULL;
int _mark = p->mark;
- { // del_target _loop0_140
+ { // expression _loop0_139
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _gather_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
+ D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_139"));
expr_ty elem;
asdl_seq * seq;
if (
- (elem = del_target_rule(p)) // del_target
+ (elem = expression_rule(p)) // expression
&&
- (seq = _loop0_140_rule(p)) // _loop0_140
+ (seq = _loop0_139_rule(p)) // _loop0_139
)
{
- D(fprintf(stderr, "%*c+ _gather_139[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_140"));
+ D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_139"));
_res = _PyPegen_seq_insert_in_front(p, elem, seq);
goto done;
}
p->mark = _mark;
- D(fprintf(stderr, "%*c%s _gather_139[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_140"));
+ D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_139"));
+ }
+ _res = NULL;
+ done:
+ D(p->level--);
+ return _res;
+}
+
+// _tmp_140: NEWLINE INDENT
+static void *
+_tmp_140_rule(Parser *p)
+{
+ D(p->level++);
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ void * _res = NULL;
+ int _mark = p->mark;
+ { // NEWLINE INDENT
+ if (p->error_indicator) {
+ D(p->level--);
+ return NULL;
+ }
+ D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
+ Token * indent_var;
+ Token * newline_var;
+ if (
+ (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE'
+ &&
+ (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT'
+ )
+ {
+ D(fprintf(stderr, "%*c+ _tmp_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT"));
+ _res = _PyPegen_dummy_name(p, newline_var, indent_var);
+ goto done;
+ }
+ p->mark = _mark;
+ D(fprintf(stderr, "%*c%s _tmp_140[%d-%d]: %s failed!\n", p->level, ' ',
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT"));
}
_res = NULL;
done:
@@ -29863,7 +29863,7 @@ _tmp_145_rule(Parser *p)
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 524)) // token='True'
+ (_keyword = _PyPegen_expect_token(p, 526)) // token='True'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'"));
@@ -29882,7 +29882,7 @@ _tmp_145_rule(Parser *p)
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 523)) // token='None'
+ (_keyword = _PyPegen_expect_token(p, 525)) // token='None'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'"));
@@ -29901,7 +29901,7 @@ _tmp_145_rule(Parser *p)
D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 525)) // token='False'
+ (_keyword = _PyPegen_expect_token(p, 527)) // token='False'
)
{
D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'"));
@@ -31349,7 +31349,7 @@ _tmp_169_rule(Parser *p)
D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 521)) // token='except'
+ (_keyword = _PyPegen_expect_token(p, 523)) // token='except'
)
{
D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'"));
@@ -31368,7 +31368,7 @@ _tmp_169_rule(Parser *p)
D(fprintf(stderr, "%*c> _tmp_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'"));
Token * _keyword;
if (
- (_keyword = _PyPegen_expect_token(p, 522)) // token='finally'
+ (_keyword = _PyPegen_expect_token(p, 524)) // token='finally'
)
{
D(fprintf(stderr, "%*c+ _tmp_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'"));
@@ -31405,7 +31405,7 @@ _tmp_170_rule(Parser *p)
Token * _keyword;
expr_ty name_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(name_var = _PyPegen_name_token(p)) // NAME
)
@@ -31444,7 +31444,7 @@ _tmp_171_rule(Parser *p)
Token * _keyword;
expr_ty name_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(name_var = _PyPegen_name_token(p)) // NAME
)
@@ -31483,7 +31483,7 @@ _tmp_172_rule(Parser *p)
Token * _keyword;
expr_ty name_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(name_var = _PyPegen_name_token(p)) // NAME
)
@@ -31993,7 +31993,7 @@ _tmp_182_rule(Parser *p)
return _res;
}
-// _tmp_183: ',' star_expression
+// _tmp_183: ',' expression
static void *
_tmp_183_rule(Parser *p)
{
@@ -32004,21 +32004,21 @@ _tmp_183_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // ',' star_expression
+ { // ',' expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
+ D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
Token * _literal;
expr_ty c;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (c = star_expression_rule(p)) // star_expression
+ (c = expression_rule(p)) // expression
)
{
- D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
+ D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -32029,7 +32029,7 @@ _tmp_183_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
}
_res = NULL;
done:
@@ -32037,7 +32037,7 @@ _tmp_183_rule(Parser *p)
return _res;
}
-// _tmp_184: ',' expression
+// _tmp_184: ',' star_expression
static void *
_tmp_184_rule(Parser *p)
{
@@ -32048,21 +32048,21 @@ _tmp_184_rule(Parser *p)
}
void * _res = NULL;
int _mark = p->mark;
- { // ',' expression
+ { // ',' star_expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression"));
+ D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
Token * _literal;
expr_ty c;
if (
(_literal = _PyPegen_expect_token(p, 12)) // token=','
&&
- (c = expression_rule(p)) // expression
+ (c = star_expression_rule(p)) // star_expression
)
{
- D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression"));
+ D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression"));
_res = c;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -32073,7 +32073,7 @@ _tmp_184_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression"));
}
_res = NULL;
done:
@@ -32827,7 +32827,7 @@ _tmp_201_rule(Parser *p)
Token * _keyword;
expr_ty star_target_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(star_target_var = star_target_rule(p)) // star_target
)
@@ -32866,7 +32866,7 @@ _tmp_202_rule(Parser *p)
Token * _keyword;
expr_ty star_target_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(star_target_var = star_target_rule(p)) // star_target
)
@@ -32905,7 +32905,7 @@ _tmp_203_rule(Parser *p)
Token * _keyword;
expr_ty star_target_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(star_target_var = star_target_rule(p)) // star_target
)
@@ -32944,7 +32944,7 @@ _tmp_204_rule(Parser *p)
Token * _keyword;
expr_ty star_target_var;
if (
- (_keyword = _PyPegen_expect_token(p, 520)) // token='as'
+ (_keyword = _PyPegen_expect_token(p, 522)) // token='as'
&&
(star_target_var = star_target_rule(p)) // star_target
)
@@ -32987,5 +32987,3 @@ _PyPegen_parse(Parser *p)
return result;
}
-
-// The end