From b0ca0b74d9f15e99dc6ae5a5c9a12b9086ee3882 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 11 Nov 2021 22:06:14 +0000 Subject: [PATCH 01/37] bpo-45292: [PEP-654] add except* --- Doc/library/dis.rst | 25 + Grammar/python.gram | 19 +- Include/internal/pycore_ast.h | 7 +- Include/internal/pycore_ast_state.h | 1 + Include/internal/pycore_pyerrors.h | 8 + Include/opcode.h | 4 +- Lib/importlib/_bootstrap_external.py | 4 +- Lib/opcode.py | 3 + Lib/test/test_ast.py | 20 +- Lib/test/test_dis.py | 52 +- Lib/test/test_except_star.py | 803 +++++ Lib/test/test_exception_group.py | 3 +- Lib/test/test_exception_variations.py | 278 ++ Lib/test/test_exceptions.py | 2 + Objects/exceptions.c | 147 +- Objects/frameobject.c | 1 + Parser/Python.asdl | 2 +- Parser/parser.c | 4325 ++++++++++++++----------- Python/Python-ast.c | 40 +- Python/ceval.c | 411 ++- Python/compile.c | 148 +- Python/opcode_targets.h | 4 +- 22 files changed, 4369 insertions(+), 1938 deletions(-) create mode 100644 Lib/test/test_except_star.py diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 5fe9f65f46a710..e219b4e92a53d8 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -870,8 +870,10 @@ All of the following opcodes use their arguments. .. versionadded:: 3.1 + .. opcode:: JUMP_IF_NOT_EXC_MATCH (target) + Performs exception matching for ``except``. Tests whether the second value on the stack is an exception matching TOS, and jumps if it is not. Pops one value from the stack. @@ -881,6 +883,29 @@ All of the following opcodes use their arguments. This opcode no longer pops the active exception. +.. opcode:: JUMP_IF_NOT_EG_MATCH (target) + + Performs exception matching for except*. Applies ``split(TOS)`` on + the exception group representing TOS1. Jumps if no match is found. + + Pops one item from the stack. If a match was found, pops the 3 items representing + the exception and replaces them with the triplets for the non-matching part, + and above it the matching part. + + .. versionadded:: 3.11 + + +.. opcode:: PREP_RERAISE_STAR + + Combines the raised and reraised exceptions list from TOS, into an exception + group to propagate from a try-except* block. Uses the original exception + group from TOS1 to reconstruct the structure of reraised exceptions. Pops + two items from the stack and pushes a triplet representing the exception to + reraise or three ``None`` if there isn't one. + + .. versionadded:: 3.11 + + .. opcode:: JUMP_IF_TRUE_OR_POP (target) If TOS is true, sets the bytecode counter to *target* and leaves TOS on the diff --git a/Grammar/python.gram b/Grammar/python.gram index d1901a5a9a2bc7..426721107a5e5e 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -401,8 +401,10 @@ with_item[withitem_ty]: 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) } + | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, 0, EXTRA) } + | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, 0, EXTRA) } + | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, 1, EXTRA) } + # Except statement # ---------------- @@ -413,6 +415,11 @@ except_block[excepthandler_ty]: _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) } | invalid_except_stmt +except_star_block[excepthandler_ty]: + | invalid_except_star_stmt_indent + | 'except' '*' e=expression t=['as' z=NAME { z }] ':' b=block { + _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } + | invalid_except_star_stmt finally_block[asdl_stmt_seq*]: | invalid_finally_stmt | 'finally' &&':' a=block { a } @@ -1192,6 +1199,11 @@ invalid_except_stmt: RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") } | a='except' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } | a='except' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } +invalid_except_star_stmt: + | 'except' '*' a=expression ',' expressions ['as' NAME ] ':' { + RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") } + | a='except' '*' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } + | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR("expected one or more exception types") } invalid_finally_stmt: | a='finally' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'finally' statement on line %d", a->lineno) } @@ -1199,6 +1211,9 @@ invalid_except_stmt_indent: | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'except' statement on line %d", a->lineno) } | a='except' ':' NEWLINE !INDENT { RAISE_SYNTAX_ERROR("expected an indented block after except statement on line %d", a->lineno) } +invalid_except_star_stmt_indent: + | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT { + RAISE_INDENTATION_ERROR("expected an indented block after 'except*' statement on line %d", a->lineno) } invalid_match_stmt: | "match" subject_expr !':' { CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) } | a="match" subject=subject_expr ':' NEWLINE !INDENT { diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h index ebb6a90087bb52..156d2b36c65267 100644 --- a/Include/internal/pycore_ast.h +++ b/Include/internal/pycore_ast.h @@ -293,6 +293,7 @@ struct _stmt { asdl_excepthandler_seq *handlers; asdl_stmt_seq *orelse; asdl_stmt_seq *finalbody; + int star; } Try; struct { @@ -685,9 +686,9 @@ stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, - asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int - lineno, int col_offset, int end_lineno, int end_col_offset, - PyArena *arena); + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int star, + int lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int diff --git a/Include/internal/pycore_ast_state.h b/Include/internal/pycore_ast_state.h index 882cd09c00628d..061e3f0516cd3b 100644 --- a/Include/internal/pycore_ast_state.h +++ b/Include/internal/pycore_ast_state.h @@ -229,6 +229,7 @@ struct ast_state { PyObject *right; PyObject *simple; PyObject *slice; + PyObject *star; PyObject *step; PyObject *stmt_type; PyObject *subject; diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h index 0f4d41c7e0bab8..968cc4975f5745 100644 --- a/Include/internal/pycore_pyerrors.h +++ b/Include/internal/pycore_pyerrors.h @@ -82,6 +82,14 @@ PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate( const char *format, ...); +PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup( + const char *msg, + PyObject *excs); + +PyAPI_FUNC(PyObject *) _PyExc_ExceptionGroupProjection( + PyObject *left, + PyObject *right); + PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate); PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp); diff --git a/Include/opcode.h b/Include/opcode.h index c7354de9a0687c..3d5f9eac11c0c9 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -45,6 +45,7 @@ extern "C" { #define IMPORT_STAR 84 #define SETUP_ANNOTATIONS 85 #define YIELD_VALUE 86 +#define PREP_RERAISE_STAR 88 #define POP_EXCEPT 89 #define HAVE_ARGUMENT 90 #define STORE_NAME 90 @@ -83,6 +84,7 @@ extern "C" { #define LOAD_FAST 124 #define STORE_FAST 125 #define DELETE_FAST 126 +#define JUMP_IF_NOT_EG_MATCH 127 #define GEN_START 129 #define RAISE_VARARGS 130 #define CALL_FUNCTION 131 @@ -167,7 +169,7 @@ static uint32_t _PyOpcode_Jump[8] = { 0U, 0U, 536870912U, - 34586624U, + 2182070272U, 0U, 0U, 0U, diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 303ca728ec8924..c5a624154e9a8b 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -370,6 +370,8 @@ def _write_atomic(path, data, mode=0o666): # active exception) # Python 3.11a3 3464 (bpo-45636: Merge numeric BINARY_*/INPLACE_* into # BINARY_OP) +# Python 3.11a3 3465 (bpo-45292: PEP-654 except*) + # # MAGIC must change whenever the bytecode emitted by the compiler may no @@ -379,7 +381,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3464).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3465).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py index 940e169d5597d7..283160a18d5aec 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -103,6 +103,7 @@ def jabs_op(name, op): def_op('SETUP_ANNOTATIONS', 85) def_op('YIELD_VALUE', 86) +def_op('PREP_RERAISE_STAR', 88) def_op('POP_EXCEPT', 89) HAVE_ARGUMENT = 90 # Opcodes from here have an argument: @@ -150,6 +151,8 @@ def jabs_op(name, op): def_op('DELETE_FAST', 126) # Local variable number haslocal.append(126) +jabs_op('JUMP_IF_NOT_EG_MATCH', 127) + def_op('GEN_START', 129) # Kind of generator/coroutine def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3) def_op('CALL_FUNCTION', 131) # #args diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index e630677f796845..6747b16f715947 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -1292,22 +1292,22 @@ def test_raise(self): def test_try(self): p = ast.Pass() - t = ast.Try([], [], [], [p]) + t = ast.Try([], [], [], [p], 0) self.stmt(t, "empty body on Try") - t = ast.Try([ast.Expr(ast.Name("x", ast.Store()))], [], [], [p]) + t = ast.Try([ast.Expr(ast.Name("x", ast.Store()))], [], [], [p], 0) self.stmt(t, "must have Load context") - t = ast.Try([p], [], [], []) + t = ast.Try([p], [], [], [], 0) self.stmt(t, "Try has neither except handlers nor finalbody") - t = ast.Try([p], [], [p], [p]) + t = ast.Try([p], [], [p], [p], 0) self.stmt(t, "Try has orelse but no except handlers") - t = ast.Try([p], [ast.ExceptHandler(None, "x", [])], [], []) + t = ast.Try([p], [ast.ExceptHandler(None, "x", [])], [], [], 0) self.stmt(t, "empty body on ExceptHandler") e = [ast.ExceptHandler(ast.Name("x", ast.Store()), "y", [p])] - self.stmt(ast.Try([p], e, [], []), "must have Load context") + self.stmt(ast.Try([p], e, [], [], 0), "must have Load context") e = [ast.ExceptHandler(None, "x", [p])] - t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store()))], [p]) + t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store()))], [p], 0) self.stmt(t, "must have Load context") - t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))]) + t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))], 0) self.stmt(t, "must have Load context") def test_assert(self): @@ -2314,8 +2314,8 @@ def main(): ('Module', [('With', (1, 0, 1, 17), [('withitem', ('Name', (1, 5, 1, 6), 'x', ('Load',)), ('Name', (1, 10, 1, 11), 'y', ('Store',)))], [('Pass', (1, 13, 1, 17))], None)], []), ('Module', [('With', (1, 0, 1, 25), [('withitem', ('Name', (1, 5, 1, 6), 'x', ('Load',)), ('Name', (1, 10, 1, 11), 'y', ('Store',))), ('withitem', ('Name', (1, 13, 1, 14), 'z', ('Load',)), ('Name', (1, 18, 1, 19), 'q', ('Store',)))], [('Pass', (1, 21, 1, 25))], None)], []), ('Module', [('Raise', (1, 0, 1, 25), ('Call', (1, 6, 1, 25), ('Name', (1, 6, 1, 15), 'Exception', ('Load',)), [('Constant', (1, 16, 1, 24), 'string', None)], []), None)], []), -('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 7, 3, 16), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [])], []), -('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [], [], [('Pass', (4, 2, 4, 6))])], []), +('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 7, 3, 16), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [], 0)], []), +('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [], [], [('Pass', (4, 2, 4, 6))], 0)], []), ('Module', [('Assert', (1, 0, 1, 8), ('Name', (1, 7, 1, 8), 'v', ('Load',)), None)], []), ('Module', [('Import', (1, 0, 1, 10), [('alias', (1, 7, 1, 10), 'sys', None)])], []), ('Module', [('ImportFrom', (1, 0, 1, 17), 'sys', [('alias', (1, 16, 1, 17), 'v', None)], 0)], []), diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 3b8ebb5dba95b2..6916ef67ee5550 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1115,7 +1115,7 @@ def _prepare_test_cases(): Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=132, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=134, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=136, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=33, argval=206, argrepr='to 206', offset=138, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=32, argval=204, argrepr='to 204', offset=138, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=140, starts_line=22, is_jump_target=True, positions=None), Instruction(opname='POP_EXCEPT_AND_RERAISE', opcode=37, arg=None, argval=None, argrepr='', offset=142, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='LOAD_FAST', opcode=124, arg=0, argval='i', argrepr='i', offset=144, starts_line=25, is_jump_target=True, positions=None), @@ -1130,7 +1130,7 @@ def _prepare_test_cases(): Instruction(opname='DUP_TOP', opcode=4, arg=None, argval=None, argrepr='', offset=162, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='CALL_FUNCTION', opcode=131, arg=3, argval=3, argrepr='', offset=164, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=166, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='JUMP_FORWARD', opcode=110, arg=25, argval=220, argrepr='to 220', offset=168, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='JUMP_FORWARD', opcode=110, arg=11, argval=192, argrepr='to 192', offset=168, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=170, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='WITH_EXCEPT_START', opcode=49, arg=None, argval=None, argrepr='', offset=172, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_JUMP_IF_TRUE', opcode=115, arg=90, argval=180, argrepr='to 180', offset=174, starts_line=None, is_jump_target=False, positions=None), @@ -1142,34 +1142,26 @@ def _prepare_test_cases(): Instruction(opname='POP_EXCEPT', opcode=89, arg=None, argval=None, argrepr='', offset=186, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=188, starts_line=None, is_jump_target=False, positions=None), Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=190, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=192, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=194, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=196, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=198, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=200, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=202, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=204, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=206, starts_line=23, is_jump_target=True, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=208, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=210, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=212, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=214, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=216, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=218, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=220, starts_line=25, is_jump_target=True, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=222, starts_line=28, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=224, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=226, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=228, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=230, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=232, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=234, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=236, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=238, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=240, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=242, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=244, starts_line=None, is_jump_target=False, positions=None), - Instruction(opname='POP_EXCEPT_AND_RERAISE', opcode=37, arg=None, argval=None, argrepr='', offset=246, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=192, starts_line=28, is_jump_target=True, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=194, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=196, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=198, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=200, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=202, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='NOP', opcode=9, arg=None, argval=None, argrepr='', offset=204, starts_line=23, is_jump_target=True, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=206, starts_line=28, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=208, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=210, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=212, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=0, argval=None, argrepr='None', offset=214, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=216, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='PUSH_EXC_INFO', opcode=35, arg=None, argval=None, argrepr='', offset=218, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=220, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval="OK, now we're done", argrepr='"OK, now we\'re done"', offset=222, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='', offset=224, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=226, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='RERAISE', opcode=119, arg=0, argval=0, argrepr='', offset=228, starts_line=None, is_jump_target=False, positions=None), + Instruction(opname='POP_EXCEPT_AND_RERAISE', opcode=37, arg=None, argval=None, argrepr='', offset=230, starts_line=None, is_jump_target=False, positions=None), ] # One last piece of inspect fodder to check the default line number handling diff --git a/Lib/test/test_except_star.py b/Lib/test/test_except_star.py new file mode 100644 index 00000000000000..c6fdd75a25813b --- /dev/null +++ b/Lib/test/test_except_star.py @@ -0,0 +1,803 @@ +import sys +import unittest + +class TestInvalidExceptStar(unittest.TestCase): + def test_mixed_except_and_except_star_is_syntax_error(self): + errors = [ + "try: pass\nexcept ValueError: pass\nexcept* TypeError: pass\n", + "try: pass\nexcept* ValueError: pass\nexcept TypeError: pass\n", + "try: pass\nexcept ValueError as e: pass\nexcept* TypeError: pass\n", + "try: pass\nexcept* ValueError as e: pass\nexcept TypeError: pass\n", + "try: pass\nexcept ValueError: pass\nexcept* TypeError as e: pass\n", + "try: pass\nexcept* ValueError: pass\nexcept TypeError as e: pass\n", + "try: pass\nexcept ValueError: pass\nexcept*: pass\n", + "try: pass\nexcept* ValueError: pass\nexcept: pass\n", + ] + + for err in errors: + with self.assertRaises(SyntaxError): + compile(err, "", "exec") + + def test_except_star_ExceptionGroup_is_runtime_error_single(self): + with self.assertRaises(TypeError): + try: + raise OSError("blah") + except* ExceptionGroup as e: + pass + + def test_except_star_ExceptionGroup_is_runtime_error_tuple(self): + with self.assertRaises(TypeError): + try: + raise ExceptionGroup("eg", [ValueError(42)]) + except* (TypeError, ExceptionGroup): + pass + + +class ExceptStarTest(unittest.TestCase): + def assertExceptionIsLike(self, exc, template): + if exc is None and template is None: + return + + if template is None: + self.fail(f"unexpected exception: {exc}") + + if exc is None: + self.fail(f"expected an exception like {template!r}, got None") + + if not isinstance(exc, ExceptionGroup): + self.assertEqual(exc.__class__, template.__class__) + self.assertEqual(exc.args[0], template.args[0]) + else: + self.assertEqual(exc.message, template.message) + self.assertEqual(len(exc.exceptions), len(template.exceptions)) + for e, t in zip(exc.exceptions, template.exceptions): + self.assertExceptionIsLike(e, t) + + def assertMetadataEqual(self, e1, e2): + if e1 is None or e2 is None: + self.assertTrue(e1 is None and e2 is None) + else: + self.assertEqual(e1.__context__, e2.__context__) + self.assertEqual(e1.__cause__, e2.__cause__) + self.assertEqual(e1.__traceback__, e2.__traceback__) + + def assertMetadataNotEqual(self, e1, e2): + if e1 is None or e2 is None: + self.assertNotEqual(e1, e2) + else: + return not (e1.__context__ == e2.__context__ + and e1.__cause__ == e2.__cause__ + and e1.__traceback__ == e2.__traceback__) + + +class TestExceptStarSplitSemantics(ExceptStarTest): + def doSplitTestNamed(self, exc, T, match_template, rest_template): + exc_info = match = rest = None + try: + try: + raise exc + except* T as e: + exc_info = sys.exc_info() + match = e + except BaseException as e: + rest = e + if match_template: + self.assertEqual(exc_info[1], match) + else: + self.assertIsNone(exc_info) + self.assertExceptionIsLike(match, match_template) + self.assertExceptionIsLike(rest, rest_template) + self.assertEqual(sys.exc_info(), (None, None, None)) + + def doSplitTestUnnamed(self, exc, T, match_template, rest_template): + exc_info = match = rest = None + try: + try: + raise exc + except* T: + exc_info = sys.exc_info() + match = sys.exc_info()[1] + else: + if rest_template: + self.fail("Exception not raised") + except BaseException as e: + rest = e + self.assertExceptionIsLike(match, match_template) + if match_template: + self.assertEqual(exc_info[0], type(match_template)) + self.assertExceptionIsLike(rest, rest_template) + self.assertEqual(sys.exc_info(), (None, None, None)) + + def doSplitTest(self, exc, T, match_template, rest_template): + self.doSplitTestNamed(exc, T, match_template, rest_template) + self.doSplitTestUnnamed(exc, T, match_template, rest_template) + + def test_no_match_single_type(self): + self.doSplitTest( + ExceptionGroup("test1", [ValueError("V"), TypeError("T")]), + SyntaxError, + None, + ExceptionGroup("test1", [ValueError("V"), TypeError("T")])) + + def test_match_single_type(self): + self.doSplitTest( + ExceptionGroup("test2", [ValueError("V1"), ValueError("V2")]), + ValueError, + ExceptionGroup("test2", [ValueError("V1"), ValueError("V2")]), + None) + + def test_match_single_type_partial_match(self): + self.doSplitTest( + ExceptionGroup( + "test3", + [ValueError("V1"), OSError("OS"), ValueError("V2")]), + ValueError, + ExceptionGroup("test3", [ValueError("V1"), ValueError("V2")]), + ExceptionGroup("test3", [OSError("OS")])) + + def test_match_single_type_nested(self): + self.doSplitTest( + ExceptionGroup( + "g1", [ + ValueError("V1"), + OSError("OS1"), + ExceptionGroup( + "g2", [ + OSError("OS2"), + ValueError("V2"), + TypeError("T")])]), + ValueError, + ExceptionGroup( + "g1", [ + ValueError("V1"), + ExceptionGroup("g2", [ValueError("V2")])]), + ExceptionGroup("g1", [ + OSError("OS1"), + ExceptionGroup("g2", [ + OSError("OS2"), TypeError("T")])])) + + def test_match_type_tuple_nested(self): + self.doSplitTest( + ExceptionGroup( + "h1", [ + ValueError("V1"), + OSError("OS1"), + ExceptionGroup( + "h2", [OSError("OS2"), ValueError("V2"), TypeError("T")])]), + (ValueError, TypeError), + ExceptionGroup( + "h1", [ + ValueError("V1"), + ExceptionGroup("h2", [ValueError("V2"), TypeError("T")])]), + ExceptionGroup( + "h1", [ + OSError("OS1"), + ExceptionGroup("h2", [OSError("OS2")])])) + + def test_empty_groups_removed(self): + self.doSplitTest( + ExceptionGroup( + "eg", [ + ExceptionGroup("i1", [ValueError("V1")]), + ExceptionGroup("i2", [ValueError("V2"), TypeError("T1")]), + ExceptionGroup("i3", [TypeError("T2")])]), + TypeError, + ExceptionGroup("eg", [ + ExceptionGroup("i2", [TypeError("T1")]), + ExceptionGroup("i3", [TypeError("T2")])]), + ExceptionGroup("eg", [ + ExceptionGroup("i1", [ValueError("V1")]), + ExceptionGroup("i2", [ValueError("V2")])])) + + def test_singleton_groups_are_kept(self): + self.doSplitTest( + ExceptionGroup("j1", [ + ExceptionGroup("j2", [ + ExceptionGroup("j3", [ValueError("V1")]), + ExceptionGroup("j4", [TypeError("T")])])]), + TypeError, + ExceptionGroup( + "j1", + [ExceptionGroup("j2", [ExceptionGroup("j4", [TypeError("T")])])]), + ExceptionGroup( + "j1", + [ExceptionGroup("j2", [ExceptionGroup("j3", [ValueError("V1")])])])) + + def test_naked_exception_matched_wrapped1(self): + self.doSplitTest( + ValueError("V"), + ValueError, + ExceptionGroup("", [ValueError("V")]), + None) + + def test_naked_exception_matched_wrapped2(self): + self.doSplitTest( + ValueError("V"), + Exception, + ExceptionGroup("", [ValueError("V")]), + None) + + def test_exception_group_except_star_Exception_not_wrapped(self): + self.doSplitTest( + ExceptionGroup("eg", [ValueError("V")]), + Exception, + ExceptionGroup("eg", [ValueError("V")]), + None) + + def test_plain_exception_not_matched(self): + self.doSplitTest( + ValueError("V"), + TypeError, + None, + ValueError("V")) + + def test_match__supertype(self): + self.doSplitTest( + ExceptionGroup("st", [BlockingIOError("io"), TypeError("T")]), + OSError, + ExceptionGroup("st", [BlockingIOError("io")]), + ExceptionGroup("st", [TypeError("T")])) + + def test_multiple_matches_named(self): + try: + raise ExceptionGroup("mmn", [OSError("os"), BlockingIOError("io")]) + except* BlockingIOError as e: + self.assertExceptionIsLike(e, + ExceptionGroup("mmn", [BlockingIOError("io")])) + except* OSError as e: + self.assertExceptionIsLike(e, + ExceptionGroup("mmn", [OSError("os")])) + else: + self.fail("Exception not raised") + + def test_multiple_matches_unnamed(self): + try: + raise ExceptionGroup("mmu", [OSError("os"), BlockingIOError("io")]) + except* BlockingIOError: + e = sys.exc_info()[1] + self.assertExceptionIsLike(e, + ExceptionGroup("mmu", [BlockingIOError("io")])) + except* OSError: + e = sys.exc_info()[1] + self.assertExceptionIsLike(e, + ExceptionGroup("mmu", [OSError("os")])) + else: + self.fail("Exception not raised") + + def test_first_match_wins_named(self): + try: + raise ExceptionGroup("fst", [BlockingIOError("io")]) + except* OSError as e: + self.assertExceptionIsLike(e, + ExceptionGroup("fst", [BlockingIOError("io")])) + except* BlockingIOError: + self.fail("Should have been matched as OSError") + else: + self.fail("Exception not raised") + + def test_first_match_wins_unnamed(self): + try: + raise ExceptionGroup("fstu", [BlockingIOError("io")]) + except* OSError: + e = sys.exc_info()[1] + self.assertExceptionIsLike(e, + ExceptionGroup("fstu", [BlockingIOError("io")])) + except* BlockingIOError: + pass + else: + self.fail("Exception not raised") + + def test_nested_except_stars(self): + try: + raise ExceptionGroup("n", [BlockingIOError("io")]) + except* BlockingIOError: + try: + raise ExceptionGroup("n", [ValueError("io")]) + except* ValueError: + pass + else: + self.fail("Exception not raised") + e = sys.exc_info()[1] + self.assertExceptionIsLike(e, + ExceptionGroup("n", [BlockingIOError("io")])) + else: + self.fail("Exception not raised") + + def test_nested_in_loop(self): + for _ in range(2): + try: + raise ExceptionGroup("nl", [BlockingIOError("io")]) + except* BlockingIOError: + pass + else: + self.fail("Exception not raised") + + +class TestExceptStarReraise(ExceptStarTest): + def test_reraise_all_named(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2), OSError(3)]) + except* TypeError as e: + raise + except* ValueError as e: + raise + # OSError not handled + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup("eg", [TypeError(1), ValueError(2), OSError(3)])) + + def test_reraise_all_unnamed(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2), OSError(3)]) + except* TypeError: + raise + except* ValueError: + raise + # OSError not handled + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup("eg", [TypeError(1), ValueError(2), OSError(3)])) + + def test_reraise_some_handle_all_named(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2), OSError(3)]) + except* TypeError as e: + raise + except* ValueError as e: + pass + # OSError not handled + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("eg", [TypeError(1), OSError(3)])) + + def test_reraise_partial_handle_all_unnamed(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2)]) + except* TypeError: + raise + except* ValueError: + pass + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("eg", [TypeError(1)])) + + def test_reraise_partial_handle_some_named(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2), OSError(3)]) + except* TypeError as e: + raise + except* ValueError as e: + pass + # OSError not handled + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("eg", [TypeError(1), OSError(3)])) + + def test_reraise_partial_handle_some_unnamed(self): + try: + try: + raise ExceptionGroup( + "eg", [TypeError(1), ValueError(2), OSError(3)]) + except* TypeError: + raise + except* ValueError: + pass + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("eg", [TypeError(1), OSError(3)])) + + def test_reraise_plain_exception_named(self): + try: + try: + raise ValueError(42) + except* ValueError as e: + raise + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [ValueError(42)])) + + def test_reraise_plain_exception_unnamed(self): + try: + try: + raise ValueError(42) + except* ValueError: + raise + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [ValueError(42)])) + + +class TestExceptStarRaise(ExceptStarTest): + def test_raise_named(self): + orig = ExceptionGroup("eg", [ValueError(1), OSError(2)]) + try: + try: + raise orig + except* OSError as e: + raise TypeError(3) + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup( + "", [TypeError(3), ExceptionGroup("eg", [ValueError(1)])])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + + def test_raise_unnamed(self): + orig = ExceptionGroup("eg", [ValueError(1), OSError(2)]) + try: + try: + raise orig + except* OSError: + raise TypeError(3) + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup( + "", [TypeError(3), ExceptionGroup("eg", [ValueError(1)])])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + + def test_raise_handle_all_raise_one_named(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* (TypeError, ValueError) as e: + raise SyntaxError(3) + except BaseException as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + + def test_raise_handle_all_raise_one_unnamed(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* (TypeError, ValueError) as e: + raise SyntaxError(3) + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + + def test_raise_handle_all_raise_two_named(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* TypeError as e: + raise SyntaxError(3) + except* ValueError as e: + raise SyntaxError(4) + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__context__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[1].__context__) + + def test_raise_handle_all_raise_two_unnamed(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* TypeError: + raise SyntaxError(3) + except* ValueError: + raise SyntaxError(4) + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__context__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[1].__context__) + + +class TestExceptStarRaiseFrom(ExceptStarTest): + def test_raise_named(self): + orig = ExceptionGroup("eg", [ValueError(1), OSError(2)]) + try: + try: + raise orig + except* OSError as e: + raise TypeError(3) from e + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup( + "", [TypeError(3), ExceptionGroup("eg", [ValueError(1)])])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + self.assertMetadataNotEqual(orig, exc.exceptions[1].__context__) + self.assertMetadataNotEqual(orig, exc.exceptions[1].__cause__) + + def test_raise_unnamed(self): + orig = ExceptionGroup("eg", [ValueError(1), OSError(2)]) + try: + try: + raise orig + except* OSError: + e = sys.exc_info()[1] + raise TypeError(3) from e + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, + ExceptionGroup( + "", [TypeError(3), ExceptionGroup("eg", [ValueError(1)])])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [OSError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + self.assertMetadataNotEqual(orig, exc.exceptions[1].__context__) + self.assertMetadataNotEqual(orig, exc.exceptions[1].__cause__) + + def test_raise_handle_all_raise_one_named(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* (TypeError, ValueError) as e: + raise SyntaxError(3) from e + except BaseException as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + + def test_raise_handle_all_raise_one_unnamed(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* (TypeError, ValueError) as e: + e = sys.exc_info()[1] + raise SyntaxError(3) from e + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [TypeError(1), ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + + def test_raise_handle_all_raise_two_named(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* TypeError as e: + raise SyntaxError(3) from e + except* ValueError as e: + raise SyntaxError(4) from e + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__context__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__cause__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + + def test_raise_handle_all_raise_two_unnamed(self): + orig = ExceptionGroup("eg", [TypeError(1), ValueError(2)]) + try: + try: + raise orig + except* TypeError: + e = sys.exc_info()[1] + raise SyntaxError(3) from e + except* ValueError: + e = sys.exc_info()[1] + raise SyntaxError(4) from e + except ExceptionGroup as e: + exc = e + + self.assertExceptionIsLike( + exc, ExceptionGroup("", [SyntaxError(3), SyntaxError(4)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__context__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[0].__cause__, + ExceptionGroup("eg", [TypeError(1)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__context__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertExceptionIsLike( + exc.exceptions[1].__cause__, + ExceptionGroup("eg", [ValueError(2)])) + + self.assertMetadataNotEqual(orig, exc) + self.assertMetadataEqual(orig, exc.exceptions[0].__context__) + self.assertMetadataEqual(orig, exc.exceptions[0].__cause__) + self.assertMetadataEqual(orig, exc.exceptions[1].__context__) + self.assertMetadataEqual(orig, exc.exceptions[1].__cause__) + + +class TestExceptStarExceptionGroupSubclass(ExceptStarTest): + def test_except_star_EG_subclass(self): + class EG(ExceptionGroup): + def __new__(cls, message, excs, code): + obj = super().__new__(cls, message, excs) + obj.code = code + return obj + + def derive(self, excs): + return EG(self.message, excs, self.code) + + try: + try: + try: + try: + raise TypeError(2) + except TypeError as te: + raise EG("nested", [te], 101) from None + except EG as nested: + try: + raise ValueError(1) + except ValueError as ve: + raise EG("eg", [ve, nested], 42) + except* ValueError as eg: + veg = eg + except EG as eg: + teg = eg + + self.assertIsInstance(veg, EG) + self.assertIsInstance(teg, EG) + self.assertIsInstance(teg.exceptions[0], EG) + self.assertMetadataEqual(veg, teg) + self.assertEqual(veg.code, 42) + self.assertEqual(teg.code, 42) + self.assertEqual(teg.exceptions[0].code, 101) + + +if __name__ == '__main__': + unittest.main() + diff --git a/Lib/test/test_exception_group.py b/Lib/test/test_exception_group.py index 5bb6094cde742c..3bf38522f30bec 100644 --- a/Lib/test/test_exception_group.py +++ b/Lib/test/test_exception_group.py @@ -211,7 +211,8 @@ def setUp(self): def test_basics_subgroup_split__bad_arg_type(self): bad_args = ["bad arg", OSError('instance not type'), - [OSError('instance not type')],] + [OSError, TypeError], + (OSError, 42)] for arg in bad_args: with self.assertRaises(TypeError): self.eg.subgroup(arg) diff --git a/Lib/test/test_exception_variations.py b/Lib/test/test_exception_variations.py index d874b0e3d10a82..aabac6d27701f6 100644 --- a/Lib/test/test_exception_variations.py +++ b/Lib/test/test_exception_variations.py @@ -172,5 +172,283 @@ def test_nested_else(self): self.assertTrue(hit_finally) self.assertTrue(hit_except) + +class ExceptStarTestCases(unittest.TestCase): + def test_try_except_else_finally(self): + hit_except = False + hit_else = False + hit_finally = False + + try: + raise Exception('nyaa!') + except* BaseException: + hit_except = True + else: + hit_else = True + finally: + hit_finally = True + + self.assertTrue(hit_except) + self.assertTrue(hit_finally) + self.assertFalse(hit_else) + + def test_try_except_else_finally_no_exception(self): + hit_except = False + hit_else = False + hit_finally = False + + try: + pass + except* BaseException: + hit_except = True + else: + hit_else = True + finally: + hit_finally = True + + self.assertFalse(hit_except) + self.assertTrue(hit_finally) + self.assertTrue(hit_else) + + def test_try_except_finally(self): + hit_except = False + hit_finally = False + + try: + raise Exception('yarr!') + except* BaseException: + hit_except = True + finally: + hit_finally = True + + self.assertTrue(hit_except) + self.assertTrue(hit_finally) + + def test_try_except_finally_no_exception(self): + hit_except = False + hit_finally = False + + try: + pass + except* BaseException: + hit_except = True + finally: + hit_finally = True + + self.assertFalse(hit_except) + self.assertTrue(hit_finally) + + def test_try_except(self): + hit_except = False + + try: + raise Exception('ahoy!') + except* BaseException: + hit_except = True + + self.assertTrue(hit_except) + + def test_try_except_no_exception(self): + hit_except = False + + try: + pass + except* BaseException: + hit_except = True + + self.assertFalse(hit_except) + + def test_try_except_else(self): + hit_except = False + hit_else = False + + try: + raise Exception('foo!') + except* BaseException: + hit_except = True + else: + hit_else = True + + self.assertFalse(hit_else) + self.assertTrue(hit_except) + + def test_try_except_else_no_exception(self): + hit_except = False + hit_else = False + + try: + pass + except* BaseException: + hit_except = True + else: + hit_else = True + + self.assertFalse(hit_except) + self.assertTrue(hit_else) + + def test_try_finally_no_exception(self): + hit_finally = False + + try: + pass + finally: + hit_finally = True + + self.assertTrue(hit_finally) + + def test_nested(self): + hit_finally = False + hit_inner_except = False + hit_inner_finally = False + + try: + try: + raise Exception('inner exception') + except* BaseException: + hit_inner_except = True + finally: + hit_inner_finally = True + finally: + hit_finally = True + + self.assertTrue(hit_inner_except) + self.assertTrue(hit_inner_finally) + self.assertTrue(hit_finally) + + def test_nested_else(self): + hit_else = False + hit_finally = False + hit_except = False + hit_inner_except = False + hit_inner_else = False + + try: + try: + pass + except* BaseException: + hit_inner_except = True + else: + hit_inner_else = True + + raise Exception('outer exception') + except* BaseException: + hit_except = True + else: + hit_else = True + finally: + hit_finally = True + + self.assertFalse(hit_inner_except) + self.assertTrue(hit_inner_else) + self.assertFalse(hit_else) + self.assertTrue(hit_finally) + self.assertTrue(hit_except) + + def test_nested_mixed1(self): + hit_except = False + hit_finally = False + hit_inner_except = False + hit_inner_finally = False + + try: + try: + raise Exception('inner exception') + except* BaseException: + hit_inner_except = True + finally: + hit_inner_finally = True + except: + hit_except = True + finally: + hit_finally = True + + self.assertTrue(hit_inner_except) + self.assertTrue(hit_inner_finally) + self.assertFalse(hit_except) + self.assertTrue(hit_finally) + + def test_nested_mixed2(self): + hit_except = False + hit_finally = False + hit_inner_except = False + hit_inner_finally = False + + try: + try: + raise Exception('inner exception') + except: + hit_inner_except = True + finally: + hit_inner_finally = True + except* BaseException: + hit_except = True + finally: + hit_finally = True + + self.assertTrue(hit_inner_except) + self.assertTrue(hit_inner_finally) + self.assertFalse(hit_except) + self.assertTrue(hit_finally) + + + def test_nested_else_mixed1(self): + hit_else = False + hit_finally = False + hit_except = False + hit_inner_except = False + hit_inner_else = False + + try: + try: + pass + except* BaseException: + hit_inner_except = True + else: + hit_inner_else = True + + raise Exception('outer exception') + except: + hit_except = True + else: + hit_else = True + finally: + hit_finally = True + + self.assertFalse(hit_inner_except) + self.assertTrue(hit_inner_else) + self.assertFalse(hit_else) + self.assertTrue(hit_finally) + self.assertTrue(hit_except) + + def test_nested_else_mixed2(self): + hit_else = False + hit_finally = False + hit_except = False + hit_inner_except = False + hit_inner_else = False + + try: + try: + pass + except: + hit_inner_except = True + else: + hit_inner_else = True + + raise Exception('outer exception') + except* BaseException: + hit_except = True + else: + hit_else = True + finally: + hit_finally = True + + self.assertFalse(hit_inner_except) + self.assertTrue(hit_inner_else) + self.assertFalse(hit_else) + self.assertTrue(hit_finally) + self.assertTrue(hit_except) + + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 0f8a8f134b61f0..ce0d99978eb11f 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -239,6 +239,8 @@ def testSyntaxErrorOffset(self): check('def f():\n continue', 2, 3) check('def f():\n break', 2, 3) check('try:\n pass\nexcept:\n pass\nexcept ValueError:\n pass', 3, 1) + check('try:\n pass\nexcept*:\n pass', 3, 8) + check('try:\n pass\nexcept*:\n pass\nexcept* ValueError:\n pass', 3, 8) # Errors thrown by tokenizer.c check('(0x+1)', 1, 3) diff --git a/Objects/exceptions.c b/Objects/exceptions.c index a5459da89a073d..292ccedaaf544d 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -741,6 +741,25 @@ BaseExceptionGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } +PyObject * +_PyExc_CreateExceptionGroup( + const char *msg_str, PyObject *excs) +{ + PyObject *msg = PyUnicode_FromString(msg_str); + if (!msg) { + return NULL; + } + PyObject *args = PyTuple_Pack(2, msg, excs); + Py_DECREF(msg); + if (!args) { + return NULL; + } + PyObject *result = PyObject_CallObject( + PyExc_BaseExceptionGroup, args); + Py_DECREF(args); + return result; +} + static int BaseExceptionGroup_init(PyBaseExceptionGroupObject *self, PyObject *args, PyObject *kwds) @@ -864,26 +883,43 @@ typedef enum { EXCEPTION_GROUP_MATCH_BY_TYPE = 0, /* A PyFunction returning True for matching exceptions */ EXCEPTION_GROUP_MATCH_BY_PREDICATE = 1, - /* An instance or container thereof, checked with equality - * This matcher type is only used internally by the - * interpreter, it is not exposed to python code */ + /* A set of leaf exceptions to include in the result. + * This matcher type is used internally by the interpreter + * to construct reraised exceptions. + */ EXCEPTION_GROUP_MATCH_INSTANCES = 2 } _exceptiongroup_split_matcher_type; static int get_matcher_type(PyObject *value, - _exceptiongroup_split_matcher_type *type) + _exceptiongroup_split_matcher_type *type) { - /* the python API supports only BY_TYPE and BY_PREDICATE */ - if (PyExceptionClass_Check(value) || - PyTuple_CheckExact(value)) { - *type = EXCEPTION_GROUP_MATCH_BY_TYPE; - return 0; + if (!value) { + goto error; } + if (PyFunction_Check(value)) { *type = EXCEPTION_GROUP_MATCH_BY_PREDICATE; return 0; } + + if (PyExceptionClass_Check(value)) { + *type = EXCEPTION_GROUP_MATCH_BY_TYPE; + return 0; + } + + if (PyTuple_CheckExact(value)) { + Py_ssize_t n = PyTuple_Size(value); + for (Py_ssize_t i=0; iexcs); + if (num_excs < 0) { + return -1; + } + /* recursive calls */ + for (Py_ssize_t i = 0; i < num_excs; i++) { + PyObject *e = PyTuple_GET_ITEM(eg->excs, i); + if (collect_exception_group_leaves(e, leaves) == -1) { + return -1; + } + } + return 0; +} + +/* This function is used by the interpreter to construct reraised + * exception groups. It takes an exception group eg and a list + * of exception groups keep and returns the sub-exception group + * of eg which contains all leaf exceptions that are contained + * in any exception group in keep. + */ +PyObject * +_PyExc_ExceptionGroupProjection(PyObject *eg, PyObject *keep) +{ + assert(_PyBaseExceptionGroup_Check(eg)); + assert(PyList_CheckExact(keep)); + + Py_ssize_t n = PyList_Size(keep); + if (n == -1) { + return NULL; + } + + PyObject *leaves = PySet_New(NULL); + if (!leaves) { + return NULL; + } + + for (Py_ssize_t i = 0; i < n; i++) { + PyObject *e = PyList_GET_ITEM(keep, i); + assert(e != NULL); + assert(_PyBaseExceptionGroup_Check(e)); + if (collect_exception_group_leaves(e, leaves) == -1) { + Py_DECREF(leaves); + return NULL; + } + } + + _exceptiongroup_split_result split_result; + bool construct_rest = false; + if (exceptiongroup_split_recursive( + eg, EXCEPTION_GROUP_MATCH_INSTANCES, leaves, + construct_rest, &split_result) == -1) { + Py_DECREF(leaves); + return NULL; + } + Py_DECREF(leaves); + PyObject *result = Py_NewRef( + split_result.match ? split_result.match : Py_None); + + Py_XDECREF(split_result.match); + assert(split_result.rest == NULL); + return result; +} + static PyMemberDef BaseExceptionGroup_members[] = { {"message", T_OBJECT, offsetof(PyBaseExceptionGroupObject, msg), READONLY, PyDoc_STR("exception message")}, diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 09857c7fa007d8..58dc7e9f6f5011 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -206,6 +206,7 @@ mark_stacks(PyCodeObject *code_obj, int len) case POP_JUMP_IF_FALSE: case POP_JUMP_IF_TRUE: case JUMP_IF_NOT_EXC_MATCH: + case JUMP_IF_NOT_EG_MATCH: { int64_t target_stack; int j = get_arg(code, i); diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 85225fc88c5a54..8a4792d808b1ec 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -39,7 +39,7 @@ module Python | Match(expr subject, match_case* cases) | Raise(expr? exc, expr? cause) - | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) + | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star) | Assert(expr test, expr? msg) | Import(alias* names) diff --git a/Parser/parser.c b/Parser/parser.c index b508c1ddec15cb..fabd3a33c3e664 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -11,39 +11,39 @@ static KeywordToken *reserved_keywords[] = { (KeywordToken[]) {{NULL, -1}}, (KeywordToken[]) {{NULL, -1}}, (KeywordToken[]) { - {"if", 627}, - {"as", 625}, - {"in", 634}, - {"or", 571}, - {"is", 579}, + {"if", 637}, + {"as", 635}, + {"in", 644}, + {"or", 574}, + {"is", 582}, {NULL, -1}, }, (KeywordToken[]) { - {"del", 600}, - {"def", 635}, - {"for", 633}, - {"try", 612}, - {"and", 572}, - {"not", 578}, + {"del", 603}, + {"def", 645}, + {"for", 643}, + {"try", 615}, + {"and", 575}, + {"not", 581}, {NULL, -1}, }, (KeywordToken[]) { - {"from", 569}, + {"from", 572}, {"pass", 504}, - {"with", 609}, - {"elif", 629}, - {"else", 630}, - {"None", 598}, - {"True", 597}, + {"with", 612}, + {"elif", 639}, + {"else", 640}, + {"None", 601}, + {"True", 600}, {NULL, -1}, }, (KeywordToken[]) { {"raise", 522}, - {"yield", 570}, + {"yield", 573}, {"break", 508}, - {"class", 636}, - {"while", 632}, - {"False", 599}, + {"class", 646}, + {"while", 642}, + {"False", 602}, {NULL, -1}, }, (KeywordToken[]) { @@ -51,12 +51,12 @@ static KeywordToken *reserved_keywords[] = { {"import", 531}, {"assert", 526}, {"global", 523}, - {"except", 623}, - {"lambda", 583}, + {"except", 632}, + {"lambda", 586}, {NULL, -1}, }, (KeywordToken[]) { - {"finally", 620}, + {"finally", 628}, {NULL, -1}, }, (KeywordToken[]) { @@ -128,376 +128,385 @@ static char *soft_keywords[] = { #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 assignment_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 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 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 -#define invalid_legacy_expression_type 1181 -#define invalid_expression_type 1182 -#define invalid_named_expression_type 1183 -#define invalid_assignment_type 1184 -#define invalid_ann_assign_target_type 1185 -#define invalid_del_stmt_type 1186 -#define invalid_block_type 1187 -#define invalid_comprehension_type 1188 -#define invalid_dict_comprehension_type 1189 -#define invalid_parameters_type 1190 -#define invalid_parameters_helper_type 1191 -#define invalid_lambda_parameters_type 1192 -#define invalid_lambda_parameters_helper_type 1193 -#define invalid_star_etc_type 1194 -#define invalid_lambda_star_etc_type 1195 -#define invalid_double_type_comments_type 1196 -#define invalid_with_item_type 1197 -#define invalid_for_target_type 1198 -#define invalid_group_type 1199 -#define invalid_import_from_targets_type 1200 -#define invalid_with_stmt_type 1201 -#define invalid_with_stmt_indent_type 1202 -#define invalid_try_stmt_type 1203 -#define invalid_except_stmt_type 1204 -#define invalid_finally_stmt_type 1205 -#define invalid_except_stmt_indent_type 1206 -#define invalid_match_stmt_type 1207 -#define invalid_case_block_type 1208 -#define invalid_as_pattern_type 1209 -#define invalid_class_pattern_type 1210 -#define invalid_class_argument_pattern_type 1211 -#define invalid_if_stmt_type 1212 -#define invalid_elif_stmt_type 1213 -#define invalid_else_stmt_type 1214 -#define invalid_while_stmt_type 1215 -#define invalid_for_stmt_type 1216 -#define invalid_def_raw_type 1217 -#define invalid_class_def_raw_type 1218 -#define invalid_double_starred_kvpairs_type 1219 -#define invalid_kvpair_type 1220 -#define _loop0_1_type 1221 -#define _loop0_2_type 1222 -#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 _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 _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 _tmp_33_type 1253 -#define _tmp_34_type 1254 -#define _tmp_35_type 1255 -#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 _tmp_64_type 1284 -#define _tmp_65_type 1285 -#define _tmp_66_type 1286 -#define _tmp_67_type 1287 -#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 _loop1_78_type 1298 -#define _loop0_80_type 1299 -#define _gather_79_type 1300 -#define _loop1_81_type 1301 -#define _loop1_82_type 1302 -#define _loop1_83_type 1303 -#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 _loop0_93_type 1313 -#define _loop0_94_type 1314 -#define _loop1_95_type 1315 -#define _loop0_96_type 1316 -#define _loop1_97_type 1317 -#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 _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 _loop1_110_type 1330 -#define _loop0_111_type 1331 -#define _loop0_112_type 1332 -#define _tmp_113_type 1333 -#define _loop0_115_type 1334 -#define _gather_114_type 1335 -#define _tmp_116_type 1336 -#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 _loop0_125_type 1345 -#define _loop0_127_type 1346 -#define _gather_126_type 1347 -#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_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 -#define _tmp_144_type 1364 -#define _tmp_145_type 1365 -#define _tmp_146_type 1366 -#define _tmp_147_type 1367 -#define _tmp_148_type 1368 -#define _loop0_149_type 1369 -#define _loop0_150_type 1370 -#define _loop0_151_type 1371 -#define _tmp_152_type 1372 -#define _tmp_153_type 1373 -#define _tmp_154_type 1374 -#define _tmp_155_type 1375 -#define _loop0_156_type 1376 -#define _loop1_157_type 1377 -#define _loop0_158_type 1378 -#define _loop1_159_type 1379 -#define _tmp_160_type 1380 -#define _tmp_161_type 1381 -#define _tmp_162_type 1382 -#define _loop0_164_type 1383 -#define _gather_163_type 1384 -#define _loop0_166_type 1385 -#define _gather_165_type 1386 -#define _loop0_168_type 1387 -#define _gather_167_type 1388 -#define _loop0_170_type 1389 -#define _gather_169_type 1390 -#define _tmp_171_type 1391 -#define _tmp_172_type 1392 -#define _tmp_173_type 1393 -#define _tmp_174_type 1394 -#define _tmp_175_type 1395 -#define _tmp_176_type 1396 -#define _tmp_177_type 1397 -#define _loop0_179_type 1398 -#define _gather_178_type 1399 -#define _tmp_180_type 1400 -#define _tmp_181_type 1401 -#define _tmp_182_type 1402 -#define _tmp_183_type 1403 -#define _tmp_184_type 1404 -#define _tmp_185_type 1405 -#define _tmp_186_type 1406 -#define _tmp_187_type 1407 -#define _tmp_188_type 1408 -#define _tmp_189_type 1409 -#define _tmp_190_type 1410 -#define _tmp_191_type 1411 -#define _tmp_192_type 1412 -#define _tmp_193_type 1413 -#define _tmp_194_type 1414 -#define _tmp_195_type 1415 -#define _tmp_196_type 1416 -#define _tmp_197_type 1417 -#define _tmp_198_type 1418 -#define _tmp_199_type 1419 -#define _tmp_200_type 1420 -#define _tmp_201_type 1421 -#define _tmp_202_type 1422 -#define _tmp_203_type 1423 -#define _tmp_204_type 1424 -#define _tmp_205_type 1425 -#define _tmp_206_type 1426 +#define except_star_block_type 1057 +#define finally_block_type 1058 +#define match_stmt_type 1059 +#define subject_expr_type 1060 +#define case_block_type 1061 +#define guard_type 1062 +#define patterns_type 1063 +#define pattern_type 1064 +#define as_pattern_type 1065 +#define or_pattern_type 1066 +#define closed_pattern_type 1067 +#define literal_pattern_type 1068 +#define literal_expr_type 1069 +#define complex_number_type 1070 +#define signed_number_type 1071 +#define signed_real_number_type 1072 +#define real_number_type 1073 +#define imaginary_number_type 1074 +#define capture_pattern_type 1075 +#define pattern_capture_target_type 1076 +#define wildcard_pattern_type 1077 +#define value_pattern_type 1078 +#define attr_type 1079 // Left-recursive +#define name_or_attr_type 1080 // Left-recursive +#define group_pattern_type 1081 +#define sequence_pattern_type 1082 +#define open_sequence_pattern_type 1083 +#define maybe_sequence_pattern_type 1084 +#define maybe_star_pattern_type 1085 +#define star_pattern_type 1086 +#define mapping_pattern_type 1087 +#define items_pattern_type 1088 +#define key_value_pattern_type 1089 +#define double_star_pattern_type 1090 +#define class_pattern_type 1091 +#define positional_patterns_type 1092 +#define keyword_patterns_type 1093 +#define keyword_pattern_type 1094 +#define expressions_type 1095 +#define expression_type 1096 +#define yield_expr_type 1097 +#define star_expressions_type 1098 +#define star_expression_type 1099 +#define star_named_expressions_type 1100 +#define star_named_expression_type 1101 +#define assignment_expression_type 1102 +#define named_expression_type 1103 +#define disjunction_type 1104 +#define conjunction_type 1105 +#define inversion_type 1106 +#define comparison_type 1107 +#define compare_op_bitwise_or_pair_type 1108 +#define eq_bitwise_or_type 1109 +#define noteq_bitwise_or_type 1110 +#define lte_bitwise_or_type 1111 +#define lt_bitwise_or_type 1112 +#define gte_bitwise_or_type 1113 +#define gt_bitwise_or_type 1114 +#define notin_bitwise_or_type 1115 +#define in_bitwise_or_type 1116 +#define isnot_bitwise_or_type 1117 +#define is_bitwise_or_type 1118 +#define bitwise_or_type 1119 // Left-recursive +#define bitwise_xor_type 1120 // Left-recursive +#define bitwise_and_type 1121 // Left-recursive +#define shift_expr_type 1122 // Left-recursive +#define sum_type 1123 // Left-recursive +#define term_type 1124 // Left-recursive +#define factor_type 1125 +#define power_type 1126 +#define await_primary_type 1127 +#define primary_type 1128 // Left-recursive +#define slices_type 1129 +#define slice_type 1130 +#define atom_type 1131 +#define group_type 1132 +#define lambdef_type 1133 +#define lambda_params_type 1134 +#define lambda_parameters_type 1135 +#define lambda_slash_no_default_type 1136 +#define lambda_slash_with_default_type 1137 +#define lambda_star_etc_type 1138 +#define lambda_kwds_type 1139 +#define lambda_param_no_default_type 1140 +#define lambda_param_with_default_type 1141 +#define lambda_param_maybe_default_type 1142 +#define lambda_param_type 1143 +#define strings_type 1144 +#define list_type 1145 +#define tuple_type 1146 +#define set_type 1147 +#define dict_type 1148 +#define double_starred_kvpairs_type 1149 +#define double_starred_kvpair_type 1150 +#define kvpair_type 1151 +#define for_if_clauses_type 1152 +#define for_if_clause_type 1153 +#define listcomp_type 1154 +#define setcomp_type 1155 +#define genexp_type 1156 +#define dictcomp_type 1157 +#define arguments_type 1158 +#define args_type 1159 +#define kwargs_type 1160 +#define starred_expression_type 1161 +#define kwarg_or_starred_type 1162 +#define kwarg_or_double_starred_type 1163 +#define star_targets_type 1164 +#define star_targets_list_seq_type 1165 +#define star_targets_tuple_seq_type 1166 +#define star_target_type 1167 +#define target_with_star_atom_type 1168 +#define star_atom_type 1169 +#define single_target_type 1170 +#define single_subscript_attribute_target_type 1171 +#define t_primary_type 1172 // Left-recursive +#define t_lookahead_type 1173 +#define del_targets_type 1174 +#define del_target_type 1175 +#define del_t_atom_type 1176 +#define type_expressions_type 1177 +#define func_type_comment_type 1178 +#define invalid_arguments_type 1179 +#define invalid_kwarg_type 1180 +#define expression_without_invalid_type 1181 +#define invalid_legacy_expression_type 1182 +#define invalid_expression_type 1183 +#define invalid_named_expression_type 1184 +#define invalid_assignment_type 1185 +#define invalid_ann_assign_target_type 1186 +#define invalid_del_stmt_type 1187 +#define invalid_block_type 1188 +#define invalid_comprehension_type 1189 +#define invalid_dict_comprehension_type 1190 +#define invalid_parameters_type 1191 +#define invalid_parameters_helper_type 1192 +#define invalid_lambda_parameters_type 1193 +#define invalid_lambda_parameters_helper_type 1194 +#define invalid_star_etc_type 1195 +#define invalid_lambda_star_etc_type 1196 +#define invalid_double_type_comments_type 1197 +#define invalid_with_item_type 1198 +#define invalid_for_target_type 1199 +#define invalid_group_type 1200 +#define invalid_import_from_targets_type 1201 +#define invalid_with_stmt_type 1202 +#define invalid_with_stmt_indent_type 1203 +#define invalid_try_stmt_type 1204 +#define invalid_except_stmt_type 1205 +#define invalid_except_star_stmt_type 1206 +#define invalid_finally_stmt_type 1207 +#define invalid_except_stmt_indent_type 1208 +#define invalid_except_star_stmt_indent_type 1209 +#define invalid_match_stmt_type 1210 +#define invalid_case_block_type 1211 +#define invalid_as_pattern_type 1212 +#define invalid_class_pattern_type 1213 +#define invalid_class_argument_pattern_type 1214 +#define invalid_if_stmt_type 1215 +#define invalid_elif_stmt_type 1216 +#define invalid_else_stmt_type 1217 +#define invalid_while_stmt_type 1218 +#define invalid_for_stmt_type 1219 +#define invalid_def_raw_type 1220 +#define invalid_class_def_raw_type 1221 +#define invalid_double_starred_kvpairs_type 1222 +#define invalid_kvpair_type 1223 +#define _loop0_1_type 1224 +#define _loop0_2_type 1225 +#define _loop1_3_type 1226 +#define _loop0_5_type 1227 +#define _gather_4_type 1228 +#define _tmp_6_type 1229 +#define _tmp_7_type 1230 +#define _tmp_8_type 1231 +#define _tmp_9_type 1232 +#define _tmp_10_type 1233 +#define _tmp_11_type 1234 +#define _tmp_12_type 1235 +#define _tmp_13_type 1236 +#define _loop1_14_type 1237 +#define _tmp_15_type 1238 +#define _tmp_16_type 1239 +#define _tmp_17_type 1240 +#define _loop0_19_type 1241 +#define _gather_18_type 1242 +#define _loop0_21_type 1243 +#define _gather_20_type 1244 +#define _tmp_22_type 1245 +#define _tmp_23_type 1246 +#define _loop0_24_type 1247 +#define _loop1_25_type 1248 +#define _loop0_27_type 1249 +#define _gather_26_type 1250 +#define _tmp_28_type 1251 +#define _loop0_30_type 1252 +#define _gather_29_type 1253 +#define _tmp_31_type 1254 +#define _loop1_32_type 1255 +#define _tmp_33_type 1256 +#define _tmp_34_type 1257 +#define _tmp_35_type 1258 +#define _loop0_36_type 1259 +#define _loop0_37_type 1260 +#define _loop0_38_type 1261 +#define _loop1_39_type 1262 +#define _loop0_40_type 1263 +#define _loop1_41_type 1264 +#define _loop1_42_type 1265 +#define _loop1_43_type 1266 +#define _loop0_44_type 1267 +#define _loop1_45_type 1268 +#define _loop0_46_type 1269 +#define _loop1_47_type 1270 +#define _loop0_48_type 1271 +#define _loop1_49_type 1272 +#define _loop0_51_type 1273 +#define _gather_50_type 1274 +#define _loop0_53_type 1275 +#define _gather_52_type 1276 +#define _loop0_55_type 1277 +#define _gather_54_type 1278 +#define _loop0_57_type 1279 +#define _gather_56_type 1280 +#define _tmp_58_type 1281 +#define _loop1_59_type 1282 +#define _loop1_60_type 1283 +#define _tmp_61_type 1284 +#define _tmp_62_type 1285 +#define _loop1_63_type 1286 +#define _loop0_65_type 1287 +#define _gather_64_type 1288 +#define _tmp_66_type 1289 +#define _tmp_67_type 1290 +#define _tmp_68_type 1291 +#define _tmp_69_type 1292 +#define _loop0_71_type 1293 +#define _gather_70_type 1294 +#define _loop0_73_type 1295 +#define _gather_72_type 1296 +#define _tmp_74_type 1297 +#define _loop0_76_type 1298 +#define _gather_75_type 1299 +#define _loop0_78_type 1300 +#define _gather_77_type 1301 +#define _loop1_79_type 1302 +#define _loop1_80_type 1303 +#define _loop0_82_type 1304 +#define _gather_81_type 1305 +#define _loop1_83_type 1306 +#define _loop1_84_type 1307 +#define _loop1_85_type 1308 +#define _tmp_86_type 1309 +#define _loop0_88_type 1310 +#define _gather_87_type 1311 +#define _tmp_89_type 1312 +#define _tmp_90_type 1313 +#define _tmp_91_type 1314 +#define _tmp_92_type 1315 +#define _tmp_93_type 1316 +#define _loop0_94_type 1317 +#define _loop0_95_type 1318 +#define _loop0_96_type 1319 +#define _loop1_97_type 1320 +#define _loop0_98_type 1321 +#define _loop1_99_type 1322 +#define _loop1_100_type 1323 +#define _loop1_101_type 1324 +#define _loop0_102_type 1325 +#define _loop1_103_type 1326 +#define _loop0_104_type 1327 +#define _loop1_105_type 1328 +#define _loop0_106_type 1329 +#define _loop1_107_type 1330 +#define _loop1_108_type 1331 +#define _tmp_109_type 1332 +#define _loop0_111_type 1333 +#define _gather_110_type 1334 +#define _loop1_112_type 1335 +#define _loop0_113_type 1336 +#define _loop0_114_type 1337 +#define _tmp_115_type 1338 +#define _loop0_117_type 1339 +#define _gather_116_type 1340 +#define _tmp_118_type 1341 +#define _loop0_120_type 1342 +#define _gather_119_type 1343 +#define _loop0_122_type 1344 +#define _gather_121_type 1345 +#define _loop0_124_type 1346 +#define _gather_123_type 1347 +#define _loop0_126_type 1348 +#define _gather_125_type 1349 +#define _loop0_127_type 1350 +#define _loop0_129_type 1351 +#define _gather_128_type 1352 +#define _loop1_130_type 1353 +#define _tmp_131_type 1354 +#define _loop0_133_type 1355 +#define _gather_132_type 1356 +#define _loop0_135_type 1357 +#define _gather_134_type 1358 +#define _loop0_137_type 1359 +#define _gather_136_type 1360 +#define _loop0_139_type 1361 +#define _gather_138_type 1362 +#define _loop0_141_type 1363 +#define _gather_140_type 1364 +#define _tmp_142_type 1365 +#define _tmp_143_type 1366 +#define _tmp_144_type 1367 +#define _tmp_145_type 1368 +#define _tmp_146_type 1369 +#define _tmp_147_type 1370 +#define _tmp_148_type 1371 +#define _tmp_149_type 1372 +#define _tmp_150_type 1373 +#define _loop0_151_type 1374 +#define _loop0_152_type 1375 +#define _loop0_153_type 1376 +#define _tmp_154_type 1377 +#define _tmp_155_type 1378 +#define _tmp_156_type 1379 +#define _tmp_157_type 1380 +#define _loop0_158_type 1381 +#define _loop1_159_type 1382 +#define _loop0_160_type 1383 +#define _loop1_161_type 1384 +#define _tmp_162_type 1385 +#define _tmp_163_type 1386 +#define _tmp_164_type 1387 +#define _loop0_166_type 1388 +#define _gather_165_type 1389 +#define _loop0_168_type 1390 +#define _gather_167_type 1391 +#define _loop0_170_type 1392 +#define _gather_169_type 1393 +#define _loop0_172_type 1394 +#define _gather_171_type 1395 +#define _tmp_173_type 1396 +#define _tmp_174_type 1397 +#define _tmp_175_type 1398 +#define _tmp_176_type 1399 +#define _tmp_177_type 1400 +#define _tmp_178_type 1401 +#define _tmp_179_type 1402 +#define _tmp_180_type 1403 +#define _tmp_181_type 1404 +#define _tmp_182_type 1405 +#define _tmp_183_type 1406 +#define _loop0_185_type 1407 +#define _gather_184_type 1408 +#define _tmp_186_type 1409 +#define _tmp_187_type 1410 +#define _tmp_188_type 1411 +#define _tmp_189_type 1412 +#define _tmp_190_type 1413 +#define _tmp_191_type 1414 +#define _tmp_192_type 1415 +#define _tmp_193_type 1416 +#define _tmp_194_type 1417 +#define _tmp_195_type 1418 +#define _tmp_196_type 1419 +#define _tmp_197_type 1420 +#define _tmp_198_type 1421 +#define _tmp_199_type 1422 +#define _tmp_200_type 1423 +#define _tmp_201_type 1424 +#define _tmp_202_type 1425 +#define _tmp_203_type 1426 +#define _tmp_204_type 1427 +#define _tmp_205_type 1428 +#define _tmp_206_type 1429 +#define _tmp_207_type 1430 +#define _tmp_208_type 1431 +#define _tmp_209_type 1432 +#define _tmp_210_type 1433 +#define _tmp_211_type 1434 +#define _tmp_212_type 1435 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -556,6 +565,7 @@ static stmt_ty with_stmt_rule(Parser *p); static withitem_ty with_item_rule(Parser *p); static stmt_ty try_stmt_rule(Parser *p); static excepthandler_ty except_block_rule(Parser *p); +static excepthandler_ty except_star_block_rule(Parser *p); static asdl_stmt_seq* finally_block_rule(Parser *p); static stmt_ty match_stmt_rule(Parser *p); static expr_ty subject_expr_rule(Parser *p); @@ -704,8 +714,10 @@ static void *invalid_with_stmt_rule(Parser *p); static void *invalid_with_stmt_indent_rule(Parser *p); static void *invalid_try_stmt_rule(Parser *p); static void *invalid_except_stmt_rule(Parser *p); +static void *invalid_except_star_stmt_rule(Parser *p); static void *invalid_finally_stmt_rule(Parser *p); static void *invalid_except_stmt_indent_rule(Parser *p); +static void *invalid_except_star_stmt_indent_rule(Parser *p); static void *invalid_match_stmt_rule(Parser *p); static void *invalid_case_block_rule(Parser *p); static void *invalid_as_pattern_rule(Parser *p); @@ -779,78 +791,78 @@ 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 void *_tmp_64_rule(Parser *p); -static void *_tmp_65_rule(Parser *p); +static asdl_seq *_loop1_60_rule(Parser *p); +static void *_tmp_61_rule(Parser *p); +static void *_tmp_62_rule(Parser *p); +static asdl_seq *_loop1_63_rule(Parser *p); +static asdl_seq *_loop0_65_rule(Parser *p); +static asdl_seq *_gather_64_rule(Parser *p); static void *_tmp_66_rule(Parser *p); static void *_tmp_67_rule(Parser *p); -static asdl_seq *_loop0_69_rule(Parser *p); -static asdl_seq *_gather_68_rule(Parser *p); +static void *_tmp_68_rule(Parser *p); +static void *_tmp_69_rule(Parser *p); static asdl_seq *_loop0_71_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 *_gather_73_rule(Parser *p); +static asdl_seq *_loop0_73_rule(Parser *p); +static asdl_seq *_gather_72_rule(Parser *p); +static void *_tmp_74_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 *_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 *_loop1_82_rule(Parser *p); +static asdl_seq *_loop0_78_rule(Parser *p); +static asdl_seq *_gather_77_rule(Parser *p); +static asdl_seq *_loop1_79_rule(Parser *p); +static asdl_seq *_loop1_80_rule(Parser *p); +static asdl_seq *_loop0_82_rule(Parser *p); +static asdl_seq *_gather_81_rule(Parser *p); static asdl_seq *_loop1_83_rule(Parser *p); -static 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 asdl_seq *_loop1_84_rule(Parser *p); +static asdl_seq *_loop1_85_rule(Parser *p); +static void *_tmp_86_rule(Parser *p); +static asdl_seq *_loop0_88_rule(Parser *p); +static asdl_seq *_gather_87_rule(Parser *p); static void *_tmp_89_rule(Parser *p); static void *_tmp_90_rule(Parser *p); static void *_tmp_91_rule(Parser *p); -static asdl_seq *_loop0_92_rule(Parser *p); -static asdl_seq *_loop0_93_rule(Parser *p); +static void *_tmp_92_rule(Parser *p); +static void *_tmp_93_rule(Parser *p); static asdl_seq *_loop0_94_rule(Parser *p); -static asdl_seq *_loop1_95_rule(Parser *p); +static asdl_seq *_loop0_95_rule(Parser *p); static asdl_seq *_loop0_96_rule(Parser *p); static asdl_seq *_loop1_97_rule(Parser *p); -static asdl_seq *_loop1_98_rule(Parser *p); +static asdl_seq *_loop0_98_rule(Parser *p); static asdl_seq *_loop1_99_rule(Parser *p); -static asdl_seq *_loop0_100_rule(Parser *p); +static asdl_seq *_loop1_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 *_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 asdl_seq *_loop1_110_rule(Parser *p); +static asdl_seq *_loop0_106_rule(Parser *p); +static asdl_seq *_loop1_107_rule(Parser *p); +static asdl_seq *_loop1_108_rule(Parser *p); +static void *_tmp_109_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 *_loop0_115_rule(Parser *p); -static asdl_seq *_gather_114_rule(Parser *p); -static void *_tmp_116_rule(Parser *p); -static asdl_seq *_loop0_118_rule(Parser *p); -static asdl_seq *_gather_117_rule(Parser *p); +static asdl_seq *_gather_110_rule(Parser *p); +static asdl_seq *_loop1_112_rule(Parser *p); +static asdl_seq *_loop0_113_rule(Parser *p); +static asdl_seq *_loop0_114_rule(Parser *p); +static void *_tmp_115_rule(Parser *p); +static asdl_seq *_loop0_117_rule(Parser *p); +static asdl_seq *_gather_116_rule(Parser *p); +static void *_tmp_118_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 asdl_seq *_loop0_125_rule(Parser *p); +static asdl_seq *_loop0_126_rule(Parser *p); +static asdl_seq *_gather_125_rule(Parser *p); static asdl_seq *_loop0_127_rule(Parser *p); -static asdl_seq *_gather_126_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_129_rule(Parser *p); +static asdl_seq *_gather_128_rule(Parser *p); +static asdl_seq *_loop1_130_rule(Parser *p); +static void *_tmp_131_rule(Parser *p); static asdl_seq *_loop0_133_rule(Parser *p); static asdl_seq *_gather_132_rule(Parser *p); static asdl_seq *_loop0_135_rule(Parser *p); @@ -859,8 +871,8 @@ 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 asdl_seq *_loop0_141_rule(Parser *p); +static asdl_seq *_gather_140_rule(Parser *p); static void *_tmp_142_rule(Parser *p); static void *_tmp_143_rule(Parser *p); static void *_tmp_144_rule(Parser *p); @@ -868,43 +880,43 @@ static void *_tmp_145_rule(Parser *p); static void *_tmp_146_rule(Parser *p); static void *_tmp_147_rule(Parser *p); static void *_tmp_148_rule(Parser *p); -static asdl_seq *_loop0_149_rule(Parser *p); -static asdl_seq *_loop0_150_rule(Parser *p); +static void *_tmp_149_rule(Parser *p); +static void *_tmp_150_rule(Parser *p); static asdl_seq *_loop0_151_rule(Parser *p); -static void *_tmp_152_rule(Parser *p); -static void *_tmp_153_rule(Parser *p); +static asdl_seq *_loop0_152_rule(Parser *p); +static asdl_seq *_loop0_153_rule(Parser *p); static void *_tmp_154_rule(Parser *p); static void *_tmp_155_rule(Parser *p); -static asdl_seq *_loop0_156_rule(Parser *p); -static asdl_seq *_loop1_157_rule(Parser *p); +static void *_tmp_156_rule(Parser *p); +static void *_tmp_157_rule(Parser *p); static asdl_seq *_loop0_158_rule(Parser *p); static asdl_seq *_loop1_159_rule(Parser *p); -static void *_tmp_160_rule(Parser *p); -static void *_tmp_161_rule(Parser *p); +static asdl_seq *_loop0_160_rule(Parser *p); +static asdl_seq *_loop1_161_rule(Parser *p); static void *_tmp_162_rule(Parser *p); -static asdl_seq *_loop0_164_rule(Parser *p); -static asdl_seq *_gather_163_rule(Parser *p); +static void *_tmp_163_rule(Parser *p); +static void *_tmp_164_rule(Parser *p); static asdl_seq *_loop0_166_rule(Parser *p); static asdl_seq *_gather_165_rule(Parser *p); static asdl_seq *_loop0_168_rule(Parser *p); static asdl_seq *_gather_167_rule(Parser *p); static asdl_seq *_loop0_170_rule(Parser *p); static asdl_seq *_gather_169_rule(Parser *p); -static void *_tmp_171_rule(Parser *p); -static void *_tmp_172_rule(Parser *p); +static asdl_seq *_loop0_172_rule(Parser *p); +static asdl_seq *_gather_171_rule(Parser *p); static void *_tmp_173_rule(Parser *p); static void *_tmp_174_rule(Parser *p); static void *_tmp_175_rule(Parser *p); static void *_tmp_176_rule(Parser *p); static void *_tmp_177_rule(Parser *p); -static asdl_seq *_loop0_179_rule(Parser *p); -static asdl_seq *_gather_178_rule(Parser *p); +static void *_tmp_178_rule(Parser *p); +static void *_tmp_179_rule(Parser *p); static void *_tmp_180_rule(Parser *p); static void *_tmp_181_rule(Parser *p); static void *_tmp_182_rule(Parser *p); static void *_tmp_183_rule(Parser *p); -static void *_tmp_184_rule(Parser *p); -static void *_tmp_185_rule(Parser *p); +static asdl_seq *_loop0_185_rule(Parser *p); +static asdl_seq *_gather_184_rule(Parser *p); static void *_tmp_186_rule(Parser *p); static void *_tmp_187_rule(Parser *p); static void *_tmp_188_rule(Parser *p); @@ -926,6 +938,12 @@ static void *_tmp_203_rule(Parser *p); static void *_tmp_204_rule(Parser *p); static void *_tmp_205_rule(Parser *p); static void *_tmp_206_rule(Parser *p); +static void *_tmp_207_rule(Parser *p); +static void *_tmp_208_rule(Parser *p); +static void *_tmp_209_rule(Parser *p); +static void *_tmp_210_rule(Parser *p); +static void *_tmp_211_rule(Parser *p); +static void *_tmp_212_rule(Parser *p); // file: statements? $ @@ -1660,7 +1678,7 @@ simple_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'del' del_stmt")); stmt_ty del_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 600) // token='del' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 603) // token='del' && (del_stmt_var = del_stmt_rule(p)) // del_stmt ) @@ -1681,7 +1699,7 @@ simple_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> simple_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'yield' yield_stmt")); stmt_ty yield_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 570) // token='yield' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 573) // token='yield' && (yield_stmt_var = yield_stmt_rule(p)) // yield_stmt ) @@ -1878,7 +1896,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); stmt_ty if_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 627) // token='if' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 637) // token='if' && (if_stmt_var = if_stmt_rule(p)) // if_stmt ) @@ -1962,7 +1980,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); stmt_ty try_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 612) // token='try' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 615) // token='try' && (try_stmt_var = try_stmt_rule(p)) // try_stmt ) @@ -1983,7 +2001,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); stmt_ty while_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 632) // token='while' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 642) // token='while' && (while_stmt_var = while_stmt_rule(p)) // while_stmt ) @@ -2952,7 +2970,7 @@ del_stmt_rule(Parser *p) Token * _keyword; asdl_expr_seq* a; if ( - (_keyword = _PyPegen_expect_token(p, 600)) // token='del' + (_keyword = _PyPegen_expect_token(p, 603)) // token='del' && (a = del_targets_rule(p)) // del_targets && @@ -3281,7 +3299,7 @@ import_from_rule(Parser *p) expr_ty b; asdl_alias_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 569)) // token='from' + (_keyword = _PyPegen_expect_token(p, 572)) // token='from' && (a = _loop0_24_rule(p)) // (('.' | '...'))* && @@ -3325,7 +3343,7 @@ import_from_rule(Parser *p) asdl_seq * a; asdl_alias_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 569)) // token='from' + (_keyword = _PyPegen_expect_token(p, 572)) // token='from' && (a = _loop1_25_rule(p)) // (('.' | '...'))+ && @@ -4053,7 +4071,7 @@ class_def_raw_rule(Parser *p) void *b; asdl_stmt_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 636)) // token='class' + (_keyword = _PyPegen_expect_token(p, 646)) // token='class' && (a = _PyPegen_name_token(p)) // NAME && @@ -4213,7 +4231,7 @@ function_def_raw_rule(Parser *p) void *params; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='def' + (_keyword = _PyPegen_expect_token(p, 645)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -4273,7 +4291,7 @@ function_def_raw_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 635)) // token='def' + (_keyword = _PyPegen_expect_token(p, 645)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -5321,7 +5339,7 @@ if_stmt_rule(Parser *p) asdl_stmt_seq* b; stmt_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (a = named_expression_rule(p)) // named_expression && @@ -5366,7 +5384,7 @@ if_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (a = named_expression_rule(p)) // named_expression && @@ -5459,7 +5477,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; stmt_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 629)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -5504,7 +5522,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 629)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -5583,7 +5601,7 @@ else_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 630)) // token='else' + (_keyword = _PyPegen_expect_token(p, 640)) // token='else' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -5660,7 +5678,7 @@ while_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='while' + (_keyword = _PyPegen_expect_token(p, 642)) // token='while' && (a = named_expression_rule(p)) // named_expression && @@ -5758,11 +5776,11 @@ for_stmt_rule(Parser *p) expr_ty t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' && (_cut_var = 1) && @@ -5822,11 +5840,11 @@ for_stmt_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' && (_cut_var = 1) && @@ -5952,7 +5970,7 @@ with_stmt_rule(Parser *p) asdl_withitem_seq* a; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && @@ -6001,7 +6019,7 @@ with_stmt_rule(Parser *p) asdl_stmt_seq* b; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && (a = (asdl_withitem_seq*)_gather_52_rule(p)) // ','.with_item+ && @@ -6052,7 +6070,7 @@ with_stmt_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && @@ -6104,7 +6122,7 @@ with_stmt_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && (a = (asdl_withitem_seq*)_gather_56_rule(p)) // ','.with_item+ && @@ -6188,7 +6206,7 @@ with_item_rule(Parser *p) if ( (e = expression_rule(p)) // expression && - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (t = star_target_rule(p)) // star_target && @@ -6261,6 +6279,7 @@ with_item_rule(Parser *p) // | invalid_try_stmt // | 'try' &&':' block finally_block // | 'try' &&':' block except_block+ else_block? finally_block? +// | 'try' &&':' block except_star_block+ else_block? finally_block? static stmt_ty try_stmt_rule(Parser *p) { @@ -6310,7 +6329,7 @@ try_stmt_rule(Parser *p) asdl_stmt_seq* b; asdl_stmt_seq* f; if ( - (_keyword = _PyPegen_expect_token(p, 612)) // token='try' + (_keyword = _PyPegen_expect_token(p, 615)) // token='try' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6329,7 +6348,7 @@ try_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_Try ( b , NULL , NULL , f , EXTRA ); + _res = _PyAST_Try ( b , NULL , NULL , f , 0 , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6354,7 +6373,7 @@ try_stmt_rule(Parser *p) asdl_excepthandler_seq* ex; void *f; if ( - (_keyword = _PyPegen_expect_token(p, 612)) // token='try' + (_keyword = _PyPegen_expect_token(p, 615)) // token='try' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6377,7 +6396,7 @@ try_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_Try ( b , ex , el , f , EXTRA ); + _res = _PyAST_Try ( b , ex , el , f , 0 , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6389,6 +6408,54 @@ try_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s try_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_block+ else_block? finally_block?")); } + { // 'try' &&':' block except_star_block+ else_block? finally_block? + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?")); + Token * _keyword; + Token * _literal; + asdl_stmt_seq* b; + void *el; + asdl_excepthandler_seq* ex; + void *f; + if ( + (_keyword = _PyPegen_expect_token(p, 615)) // token='try' + && + (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' + && + (b = block_rule(p)) // block + && + (ex = (asdl_excepthandler_seq*)_loop1_60_rule(p)) // except_star_block+ + && + (el = else_block_rule(p), !p->error_indicator) // else_block? + && + (f = finally_block_rule(p), !p->error_indicator) // finally_block? + ) + { + D(fprintf(stderr, "%*c+ try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_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_Try ( b , ex , el , f , 1 , 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 try_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' &&':' block except_star_block+ else_block? finally_block?")); + } _res = NULL; done: D(p->level--); @@ -6450,11 +6517,11 @@ except_block_rule(Parser *p) expr_ty e; void *t; if ( - (_keyword = _PyPegen_expect_token(p, 623)) // token='except' + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' && (e = expression_rule(p)) // expression && - (t = _tmp_60_rule(p), !p->error_indicator) // ['as' NAME] + (t = _tmp_61_rule(p), !p->error_indicator) // ['as' NAME] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6493,7 +6560,7 @@ except_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 623)) // token='except' + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6547,6 +6614,121 @@ except_block_rule(Parser *p) return _res; } +// except_star_block: +// | invalid_except_star_stmt_indent +// | 'except' '*' expression ['as' NAME] ':' block +// | invalid_except_star_stmt +static excepthandler_ty +except_star_block_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + excepthandler_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_except_star_stmt_indent + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent")); + void *invalid_except_star_stmt_indent_var; + if ( + (invalid_except_star_stmt_indent_var = invalid_except_star_stmt_indent_rule(p)) // invalid_except_star_stmt_indent + ) + { + D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt_indent")); + _res = invalid_except_star_stmt_indent_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt_indent")); + } + { // 'except' '*' expression ['as' NAME] ':' block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block")); + Token * _keyword; + Token * _literal; + Token * _literal_1; + asdl_stmt_seq* b; + expr_ty e; + void *t; + if ( + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + && + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (e = expression_rule(p)) // expression + && + (t = _tmp_62_rule(p), !p->error_indicator) // ['as' NAME] + && + (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' + && + (b = block_rule(p)) // block + ) + { + D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' 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_ExceptHandler ( e , ( t ) ? ( ( expr_ty ) t ) -> v . Name . id : NULL , 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 except_star_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block")); + } + if (p->call_invalid_rules) { // invalid_except_star_stmt + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); + void *invalid_except_star_stmt_var; + if ( + (invalid_except_star_stmt_var = invalid_except_star_stmt_rule(p)) // invalid_except_star_stmt + ) + { + D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); + _res = invalid_except_star_stmt_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + // finally_block: invalid_finally_stmt | 'finally' &&':' block static asdl_stmt_seq* finally_block_rule(Parser *p) @@ -6587,7 +6769,7 @@ finally_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* a; if ( - (_keyword = _PyPegen_expect_token(p, 620)) // token='finally' + (_keyword = _PyPegen_expect_token(p, 628)) // token='finally' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6659,7 +6841,7 @@ match_stmt_rule(Parser *p) && (indent_var = _PyPegen_expect_token(p, INDENT)) // token='INDENT' && - (cases = (asdl_match_case_seq*)_loop1_61_rule(p)) // case_block+ + (cases = (asdl_match_case_seq*)_loop1_63_rule(p)) // case_block+ && (dedent_var = _PyPegen_expect_token(p, DEDENT)) // token='DEDENT' ) @@ -6887,7 +7069,7 @@ guard_rule(Parser *p) Token * _keyword; expr_ty guard; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (guard = named_expression_rule(p)) // named_expression ) @@ -7076,7 +7258,7 @@ as_pattern_rule(Parser *p) if ( (pattern = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (target = pattern_capture_target_rule(p)) // pattern_capture_target ) @@ -7156,7 +7338,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_62_rule(p)) // '|'.closed_pattern+ + (patterns = (asdl_pattern_seq*)_gather_64_rule(p)) // '|'.closed_pattern+ ) { D(fprintf(stderr, "%*c+ or_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'|'.closed_pattern+")); @@ -7400,7 +7582,7 @@ literal_pattern_rule(Parser *p) if ( (value = signed_number_rule(p)) // signed_number && - _PyPegen_lookahead(0, _tmp_64_rule, p) + _PyPegen_lookahead(0, _tmp_66_rule, p) ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); @@ -7499,7 +7681,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, 598)) // token='None' + (_keyword = _PyPegen_expect_token(p, 601)) // token='None' ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); @@ -7532,7 +7714,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, 597)) // token='True' + (_keyword = _PyPegen_expect_token(p, 600)) // token='True' ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); @@ -7565,7 +7747,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, 599)) // token='False' + (_keyword = _PyPegen_expect_token(p, 602)) // token='False' ) { D(fprintf(stderr, "%*c+ literal_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); @@ -7632,7 +7814,7 @@ literal_expr_rule(Parser *p) if ( (signed_number_var = signed_number_rule(p)) // signed_number && - _PyPegen_lookahead(0, _tmp_65_rule, p) + _PyPegen_lookahead(0, _tmp_67_rule, p) ) { D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "signed_number !('+' | '-')")); @@ -7689,7 +7871,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, 598)) // token='None' + (_keyword = _PyPegen_expect_token(p, 601)) // token='None' ) { D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); @@ -7722,7 +7904,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, 597)) // token='True' + (_keyword = _PyPegen_expect_token(p, 600)) // token='True' ) { D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); @@ -7755,7 +7937,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, 599)) // token='False' + (_keyword = _PyPegen_expect_token(p, 602)) // token='False' ) { D(fprintf(stderr, "%*c+ literal_expr[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); @@ -8218,7 +8400,7 @@ pattern_capture_target_rule(Parser *p) && (name = _PyPegen_name_token(p)) // NAME && - _PyPegen_lookahead(0, _tmp_66_rule, p) + _PyPegen_lookahead(0, _tmp_68_rule, p) ) { D(fprintf(stderr, "%*c+ pattern_capture_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!\"_\" NAME !('.' | '(' | '=')")); @@ -8329,7 +8511,7 @@ value_pattern_rule(Parser *p) if ( (attr = attr_rule(p)) // attr && - _PyPegen_lookahead(0, _tmp_67_rule, p) + _PyPegen_lookahead(0, _tmp_69_rule, p) ) { D(fprintf(stderr, "%*c+ value_pattern[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "attr !('.' | '(' | '=')")); @@ -8734,7 +8916,7 @@ maybe_sequence_pattern_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * patterns; if ( - (patterns = _gather_68_rule(p)) // ','.maybe_star_pattern+ + (patterns = _gather_70_rule(p)) // ','.maybe_star_pattern+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -9129,13 +9311,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_70_var; + asdl_seq * _gather_72_var; if ( - (_gather_70_var = _gather_70_rule(p)) // ','.key_value_pattern+ + (_gather_72_var = _gather_72_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_70_var; + _res = _gather_72_var; goto done; } p->mark = _mark; @@ -9169,7 +9351,7 @@ key_value_pattern_rule(Parser *p) void *key; pattern_ty pattern; if ( - (key = _tmp_72_rule(p)) // literal_expr | attr + (key = _tmp_74_rule(p)) // literal_expr | attr && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -9491,7 +9673,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_73_rule(p)) // ','.pattern+ + (args = (asdl_pattern_seq*)_gather_75_rule(p)) // ','.pattern+ ) { D(fprintf(stderr, "%*c+ positional_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.pattern+")); @@ -9530,13 +9712,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_75_var; + asdl_seq * _gather_77_var; if ( - (_gather_75_var = _gather_75_rule(p)) // ','.keyword_pattern+ + (_gather_77_var = _gather_77_rule(p)) // ','.keyword_pattern+ ) { D(fprintf(stderr, "%*c+ keyword_patterns[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.keyword_pattern+")); - _res = _gather_75_var; + _res = _gather_77_var; goto done; } p->mark = _mark; @@ -9629,7 +9811,7 @@ expressions_rule(Parser *p) if ( (a = expression_rule(p)) // expression && - (b = _loop1_77_rule(p)) // ((',' expression))+ + (b = _loop1_79_rule(p)) // ((',' expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -9778,11 +9960,11 @@ expression_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 630)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 640)) // token='else' && (c = expression_rule(p)) // expression ) @@ -9884,9 +10066,9 @@ yield_expr_rule(Parser *p) Token * _keyword_1; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 570)) // token='yield' + (_keyword = _PyPegen_expect_token(p, 573)) // token='yield' && - (_keyword_1 = _PyPegen_expect_token(p, 569)) // token='from' + (_keyword_1 = _PyPegen_expect_token(p, 572)) // token='from' && (a = expression_rule(p)) // expression ) @@ -9922,7 +10104,7 @@ yield_expr_rule(Parser *p) Token * _keyword; void *a; if ( - (_keyword = _PyPegen_expect_token(p, 570)) // token='yield' + (_keyword = _PyPegen_expect_token(p, 573)) // token='yield' && (a = star_expressions_rule(p), !p->error_indicator) // star_expressions? ) @@ -9991,7 +10173,7 @@ star_expressions_rule(Parser *p) if ( (a = star_expression_rule(p)) // star_expression && - (b = _loop1_78_rule(p)) // ((',' star_expression))+ + (b = _loop1_80_rule(p)) // ((',' star_expression))+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -10186,7 +10368,7 @@ star_named_expressions_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_79_rule(p)) // ','.star_named_expression+ + (a = (asdl_expr_seq*)_gather_81_rule(p)) // ','.star_named_expression+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -10474,7 +10656,7 @@ disjunction_rule(Parser *p) if ( (a = conjunction_rule(p)) // conjunction && - (b = _loop1_81_rule(p)) // (('or' conjunction))+ + (b = _loop1_83_rule(p)) // (('or' conjunction))+ ) { D(fprintf(stderr, "%*c+ disjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "conjunction (('or' conjunction))+")); @@ -10560,7 +10742,7 @@ conjunction_rule(Parser *p) if ( (a = inversion_rule(p)) // inversion && - (b = _loop1_82_rule(p)) // (('and' inversion))+ + (b = _loop1_84_rule(p)) // (('and' inversion))+ ) { D(fprintf(stderr, "%*c+ conjunction[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "inversion (('and' inversion))+")); @@ -10644,7 +10826,7 @@ inversion_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 578)) // token='not' + (_keyword = _PyPegen_expect_token(p, 581)) // token='not' && (a = inversion_rule(p)) // inversion ) @@ -10728,7 +10910,7 @@ comparison_rule(Parser *p) if ( (a = bitwise_or_rule(p)) // bitwise_or && - (b = _loop1_83_rule(p)) // compare_op_bitwise_or_pair+ + (b = _loop1_85_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+")); @@ -11056,10 +11238,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_84_var; + void *_tmp_86_var; expr_ty a; if ( - (_tmp_84_var = _tmp_84_rule(p)) // '!=' + (_tmp_86_var = _tmp_86_rule(p)) // '!=' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -11280,9 +11462,9 @@ notin_bitwise_or_rule(Parser *p) Token * _keyword_1; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 578)) // token='not' + (_keyword = _PyPegen_expect_token(p, 581)) // token='not' && - (_keyword_1 = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -11326,7 +11508,7 @@ in_bitwise_or_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword = _PyPegen_expect_token(p, 644)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -11371,9 +11553,9 @@ isnot_bitwise_or_rule(Parser *p) Token * _keyword_1; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 579)) // token='is' + (_keyword = _PyPegen_expect_token(p, 582)) // token='is' && - (_keyword_1 = _PyPegen_expect_token(p, 578)) // token='not' + (_keyword_1 = _PyPegen_expect_token(p, 581)) // token='not' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -11417,7 +11599,7 @@ is_bitwise_or_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 579)) // token='is' + (_keyword = _PyPegen_expect_token(p, 582)) // token='is' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -13016,7 +13198,7 @@ slices_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_85_rule(p)) // ','.slice+ + (a = (asdl_expr_seq*)_gather_87_rule(p)) // ','.slice+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -13086,7 +13268,7 @@ slice_rule(Parser *p) && (b = expression_rule(p), !p->error_indicator) // expression? && - (c = _tmp_87_rule(p), !p->error_indicator) // [':' expression?] + (c = _tmp_89_rule(p), !p->error_indicator) // [':' expression?] ) { D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression? ':' expression? [':' expression?]")); @@ -13198,7 +13380,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, 597)) // token='True' + (_keyword = _PyPegen_expect_token(p, 600)) // token='True' ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); @@ -13231,7 +13413,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, 599)) // token='False' + (_keyword = _PyPegen_expect_token(p, 602)) // token='False' ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); @@ -13264,7 +13446,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, 598)) // token='None' + (_keyword = _PyPegen_expect_token(p, 601)) // token='None' ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); @@ -13335,15 +13517,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_88_var; + void *_tmp_90_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 7) // token='(' && - (_tmp_88_var = _tmp_88_rule(p)) // tuple | group | genexp + (_tmp_90_var = _tmp_90_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_88_var; + _res = _tmp_90_var; goto done; } p->mark = _mark; @@ -13356,15 +13538,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_89_var; + void *_tmp_91_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 9) // token='[' && - (_tmp_89_var = _tmp_89_rule(p)) // list | listcomp + (_tmp_91_var = _tmp_91_rule(p)) // list | listcomp ) { D(fprintf(stderr, "%*c+ atom[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "&'[' (list | listcomp)")); - _res = _tmp_89_var; + _res = _tmp_91_var; goto done; } p->mark = _mark; @@ -13377,15 +13559,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_90_var; + void *_tmp_92_var; if ( _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 25) // token='{' && - (_tmp_90_var = _tmp_90_rule(p)) // dict | set | dictcomp | setcomp + (_tmp_92_var = _tmp_92_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_90_var; + _res = _tmp_92_var; goto done; } p->mark = _mark; @@ -13454,7 +13636,7 @@ group_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_91_rule(p)) // yield_expr | named_expression + (a = _tmp_93_rule(p)) // yield_expr | named_expression && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -13528,7 +13710,7 @@ lambdef_rule(Parser *p) void *a; expr_ty b; if ( - (_keyword = _PyPegen_expect_token(p, 583)) // token='lambda' + (_keyword = _PyPegen_expect_token(p, 586)) // token='lambda' && (a = lambda_params_rule(p), !p->error_indicator) // lambda_params? && @@ -13649,9 +13831,9 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_no_default_rule(p)) // lambda_slash_no_default && - (b = (asdl_arg_seq*)_loop0_92_rule(p)) // lambda_param_no_default* + (b = (asdl_arg_seq*)_loop0_94_rule(p)) // lambda_param_no_default* && - (c = _loop0_93_rule(p)) // lambda_param_with_default* + (c = _loop0_95_rule(p)) // lambda_param_with_default* && (d = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? ) @@ -13681,7 +13863,7 @@ lambda_parameters_rule(Parser *p) if ( (a = lambda_slash_with_default_rule(p)) // lambda_slash_with_default && - (b = _loop0_94_rule(p)) // lambda_param_with_default* + (b = _loop0_96_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? ) @@ -13709,9 +13891,9 @@ lambda_parameters_rule(Parser *p) asdl_seq * b; void *c; if ( - (a = (asdl_arg_seq*)_loop1_95_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_97_rule(p)) // lambda_param_no_default+ && - (b = _loop0_96_rule(p)) // lambda_param_with_default* + (b = _loop0_98_rule(p)) // lambda_param_with_default* && (c = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? ) @@ -13738,7 +13920,7 @@ lambda_parameters_rule(Parser *p) asdl_seq * a; void *b; if ( - (a = _loop1_97_rule(p)) // lambda_param_with_default+ + (a = _loop1_99_rule(p)) // lambda_param_with_default+ && (b = lambda_star_etc_rule(p), !p->error_indicator) // lambda_star_etc? ) @@ -13809,7 +13991,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal_1; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_98_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_100_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -13838,7 +14020,7 @@ lambda_slash_no_default_rule(Parser *p) Token * _literal; asdl_arg_seq* a; if ( - (a = (asdl_arg_seq*)_loop1_99_rule(p)) // lambda_param_no_default+ + (a = (asdl_arg_seq*)_loop1_101_rule(p)) // lambda_param_no_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -13888,9 +14070,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_100_rule(p)) // lambda_param_no_default* + (a = _loop0_102_rule(p)) // lambda_param_no_default* && - (b = _loop1_101_rule(p)) // lambda_param_with_default+ + (b = _loop1_103_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -13920,9 +14102,9 @@ lambda_slash_with_default_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _loop0_102_rule(p)) // lambda_param_no_default* + (a = _loop0_104_rule(p)) // lambda_param_no_default* && - (b = _loop1_103_rule(p)) // lambda_param_with_default+ + (b = _loop1_105_rule(p)) // lambda_param_with_default+ && (_literal = _PyPegen_expect_token(p, 17)) // token='/' && @@ -13978,7 +14160,7 @@ lambda_star_etc_rule(Parser *p) && (a = lambda_param_no_default_rule(p)) // lambda_param_no_default && - (b = _loop0_104_rule(p)) // lambda_param_maybe_default* + (b = _loop0_106_rule(p)) // lambda_param_maybe_default* && (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? ) @@ -14011,7 +14193,7 @@ lambda_star_etc_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _loop1_105_rule(p)) // lambda_param_maybe_default+ + (b = _loop1_107_rule(p)) // lambda_param_maybe_default+ && (c = lambda_kwds_rule(p), !p->error_indicator) // lambda_kwds? ) @@ -14426,7 +14608,7 @@ strings_rule(Parser *p) 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+ + (a = _loop1_108_rule(p)) // STRING+ ) { D(fprintf(stderr, "%*c+ strings[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "STRING+")); @@ -14546,7 +14728,7 @@ tuple_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_107_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?] + (a = _tmp_109_rule(p), !p->error_indicator) // [star_named_expression ',' star_named_expressions?] && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) @@ -14755,7 +14937,7 @@ double_starred_kvpairs_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_seq * a; if ( - (a = _gather_108_rule(p)) // ','.double_starred_kvpair+ + (a = _gather_110_rule(p)) // ','.double_starred_kvpair+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -14908,7 +15090,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_110_rule(p)) // for_if_clause+ + (a = (asdl_comprehension_seq*)_loop1_112_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+")); @@ -14960,17 +15142,17 @@ for_if_clause_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' && (_cut_var = 1) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_111_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_113_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))*")); @@ -15003,17 +15185,17 @@ for_if_clause_rule(Parser *p) expr_ty b; asdl_expr_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' && (_cut_var = 1) && (b = disjunction_rule(p)) // disjunction && - (c = (asdl_expr_seq*)_loop0_112_rule(p)) // (('if' disjunction))* + (c = (asdl_expr_seq*)_loop0_114_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))*")); @@ -15267,7 +15449,7 @@ genexp_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = _tmp_113_rule(p)) // assignment_expression | expression !':=' + (a = _tmp_115_rule(p)) // assignment_expression | expression !':=' && (b = for_if_clauses_rule(p)) // for_if_clauses && @@ -15510,9 +15692,9 @@ args_rule(Parser *p) asdl_expr_seq* a; void *b; if ( - (a = (asdl_expr_seq*)_gather_114_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ + (a = (asdl_expr_seq*)_gather_116_rule(p)) // ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ && - (b = _tmp_116_rule(p), !p->error_indicator) // [',' kwargs] + (b = _tmp_118_rule(p), !p->error_indicator) // [',' kwargs] ) { D(fprintf(stderr, "%*c+ args[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs]")); @@ -15600,11 +15782,11 @@ kwargs_rule(Parser *p) asdl_seq * a; asdl_seq * b; if ( - (a = _gather_117_rule(p)) // ','.kwarg_or_starred+ + (a = _gather_119_rule(p)) // ','.kwarg_or_starred+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (b = _gather_119_rule(p)) // ','.kwarg_or_double_starred+ + (b = _gather_121_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+")); @@ -15626,13 +15808,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_121_var; + asdl_seq * _gather_123_var; if ( - (_gather_121_var = _gather_121_rule(p)) // ','.kwarg_or_starred+ + (_gather_123_var = _gather_123_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_121_var; + _res = _gather_123_var; goto done; } p->mark = _mark; @@ -15645,13 +15827,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_123_var; + asdl_seq * _gather_125_var; if ( - (_gather_123_var = _gather_123_rule(p)) // ','.kwarg_or_double_starred+ + (_gather_125_var = _gather_125_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_123_var; + _res = _gather_125_var; goto done; } p->mark = _mark; @@ -16013,7 +16195,7 @@ star_targets_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop0_125_rule(p)) // ((',' star_target))* + (b = _loop0_127_rule(p)) // ((',' star_target))* && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -16067,7 +16249,7 @@ star_targets_list_seq_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_126_rule(p)) // ','.star_target+ + (a = (asdl_expr_seq*)_gather_128_rule(p)) // ','.star_target+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -16115,7 +16297,7 @@ star_targets_tuple_seq_rule(Parser *p) if ( (a = star_target_rule(p)) // star_target && - (b = _loop1_128_rule(p)) // ((',' star_target))+ + (b = _loop1_130_rule(p)) // ((',' star_target))+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -16201,7 +16383,7 @@ star_target_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (a = _tmp_129_rule(p)) // !'*' star_target + (a = _tmp_131_rule(p)) // !'*' star_target ) { D(fprintf(stderr, "%*c+ star_target[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (!'*' star_target)")); @@ -17108,7 +17290,7 @@ del_targets_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings asdl_expr_seq* a; if ( - (a = (asdl_expr_seq*)_gather_130_rule(p)) // ','.del_target+ + (a = (asdl_expr_seq*)_gather_132_rule(p)) // ','.del_target+ && (_opt_var = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? ) @@ -17460,7 +17642,7 @@ type_expressions_rule(Parser *p) expr_ty b; expr_ty c; if ( - (a = _gather_132_rule(p)) // ','.expression+ + (a = _gather_134_rule(p)) // ','.expression+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -17499,7 +17681,7 @@ type_expressions_rule(Parser *p) asdl_seq * a; expr_ty b; if ( - (a = _gather_134_rule(p)) // ','.expression+ + (a = _gather_136_rule(p)) // ','.expression+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -17532,7 +17714,7 @@ type_expressions_rule(Parser *p) asdl_seq * a; expr_ty b; if ( - (a = _gather_136_rule(p)) // ','.expression+ + (a = _gather_138_rule(p)) // ','.expression+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -17652,7 +17834,7 @@ type_expressions_rule(Parser *p) 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+ + (a = (asdl_expr_seq*)_gather_140_rule(p)) // ','.expression+ ) { D(fprintf(stderr, "%*c+ type_expressions[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.expression+")); @@ -17701,7 +17883,7 @@ func_type_comment_rule(Parser *p) && (t = _PyPegen_expect_token(p, TYPE_COMMENT)) // token='TYPE_COMMENT' && - _PyPegen_lookahead(1, _tmp_140_rule, p) + _PyPegen_lookahead(1, _tmp_142_rule, p) ) { D(fprintf(stderr, "%*c+ func_type_comment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NEWLINE TYPE_COMMENT &(NEWLINE INDENT)")); @@ -17826,7 +18008,7 @@ invalid_arguments_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_opt_var = _tmp_141_rule(p), !p->error_indicator) // [args | expression for_if_clauses] + (_opt_var = _tmp_143_rule(p), !p->error_indicator) // [args | expression for_if_clauses] ) { D(fprintf(stderr, "%*c+ invalid_arguments[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses ',' [args | expression for_if_clauses]")); @@ -17994,7 +18176,7 @@ invalid_kwarg_rule(Parser *p) Token* a; Token * b; if ( - (a = (Token*)_tmp_142_rule(p)) // 'True' | 'False' | 'None' + (a = (Token*)_tmp_144_rule(p)) // 'True' | 'False' | 'None' && (b = _PyPegen_expect_token(p, 22)) // token='=' ) @@ -18054,7 +18236,7 @@ invalid_kwarg_rule(Parser *p) expr_ty a; Token * b; if ( - _PyPegen_lookahead(0, _tmp_143_rule, p) + _PyPegen_lookahead(0, _tmp_145_rule, p) && (a = expression_rule(p)) // expression && @@ -18117,11 +18299,11 @@ expression_without_invalid_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 630)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 640)) // token='else' && (c = expression_rule(p)) // expression ) @@ -18280,7 +18462,7 @@ invalid_expression_rule(Parser *p) expr_ty a; expr_ty b; if ( - _PyPegen_lookahead(0, _tmp_144_rule, p) + _PyPegen_lookahead(0, _tmp_146_rule, p) && (a = disjunction_rule(p)) // disjunction && @@ -18312,11 +18494,11 @@ invalid_expression_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (b = disjunction_rule(p)) // disjunction && - _PyPegen_lookahead(0, _tmp_145_rule, p) + _PyPegen_lookahead(0, _tmp_147_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "disjunction 'if' disjunction !('else' | ':')")); @@ -18398,7 +18580,7 @@ invalid_named_expression_rule(Parser *p) && (b = bitwise_or_rule(p)) // bitwise_or && - _PyPegen_lookahead(0, _tmp_146_rule, p) + _PyPegen_lookahead(0, _tmp_148_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '=' bitwise_or !('=' | ':=')")); @@ -18424,7 +18606,7 @@ invalid_named_expression_rule(Parser *p) Token * b; expr_ty bitwise_or_var; if ( - _PyPegen_lookahead(0, _tmp_147_rule, p) + _PyPegen_lookahead(0, _tmp_149_rule, p) && (a = bitwise_or_rule(p)) // bitwise_or && @@ -18432,7 +18614,7 @@ invalid_named_expression_rule(Parser *p) && (bitwise_or_var = bitwise_or_rule(p)) // bitwise_or && - _PyPegen_lookahead(0, _tmp_148_rule, p) + _PyPegen_lookahead(0, _tmp_150_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_named_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')")); @@ -18509,7 +18691,7 @@ invalid_assignment_rule(Parser *p) D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions* ':' expression")); Token * _literal; Token * _literal_1; - asdl_seq * _loop0_149_var; + asdl_seq * _loop0_151_var; expr_ty a; expr_ty expression_var; if ( @@ -18517,7 +18699,7 @@ invalid_assignment_rule(Parser *p) && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_loop0_149_var = _loop0_149_rule(p)) // star_named_expressions* + (_loop0_151_var = _loop0_151_rule(p)) // star_named_expressions* && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -18574,10 +18756,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* star_expressions '='")); Token * _literal; - asdl_seq * _loop0_150_var; + asdl_seq * _loop0_152_var; expr_ty a; if ( - (_loop0_150_var = _loop0_150_rule(p)) // ((star_targets '='))* + (_loop0_152_var = _loop0_152_rule(p)) // ((star_targets '='))* && (a = star_expressions_rule(p)) // star_expressions && @@ -18604,10 +18786,10 @@ invalid_assignment_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "((star_targets '='))* yield_expr '='")); Token * _literal; - asdl_seq * _loop0_151_var; + asdl_seq * _loop0_153_var; expr_ty a; if ( - (_loop0_151_var = _loop0_151_rule(p)) // ((star_targets '='))* + (_loop0_153_var = _loop0_153_rule(p)) // ((star_targets '='))* && (a = yield_expr_rule(p)) // yield_expr && @@ -18633,7 +18815,7 @@ invalid_assignment_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_assignment[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); - void *_tmp_152_var; + void *_tmp_154_var; expr_ty a; AugOperator* augassign_var; if ( @@ -18641,7 +18823,7 @@ invalid_assignment_rule(Parser *p) && (augassign_var = augassign_rule(p)) // augassign && - (_tmp_152_var = _tmp_152_rule(p)) // yield_expr | star_expressions + (_tmp_154_var = _tmp_154_rule(p)) // yield_expr | star_expressions ) { D(fprintf(stderr, "%*c+ invalid_assignment[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions augassign (yield_expr | star_expressions)")); @@ -18768,7 +18950,7 @@ invalid_del_stmt_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 600)) // token='del' + (_keyword = _PyPegen_expect_token(p, 603)) // token='del' && (a = star_expressions_rule(p)) // star_expressions ) @@ -18855,11 +19037,11 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '(' | '{') starred_expression for_if_clauses")); - void *_tmp_153_var; + void *_tmp_155_var; expr_ty a; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_153_var = _tmp_153_rule(p)) // '[' | '(' | '{' + (_tmp_155_var = _tmp_155_rule(p)) // '[' | '(' | '{' && (a = starred_expression_rule(p)) // starred_expression && @@ -18886,12 +19068,12 @@ invalid_comprehension_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses")); Token * _literal; - void *_tmp_154_var; + void *_tmp_156_var; expr_ty a; asdl_expr_seq* b; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_154_var = _tmp_154_rule(p)) // '[' | '{' + (_tmp_156_var = _tmp_156_rule(p)) // '[' | '{' && (a = star_named_expression_rule(p)) // star_named_expression && @@ -18921,12 +19103,12 @@ invalid_comprehension_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_comprehension[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('[' | '{') star_named_expression ',' for_if_clauses")); - void *_tmp_155_var; + void *_tmp_157_var; expr_ty a; Token * b; asdl_comprehension_seq* for_if_clauses_var; if ( - (_tmp_155_var = _tmp_155_rule(p)) // '[' | '{' + (_tmp_157_var = _tmp_157_rule(p)) // '[' | '{' && (a = star_named_expression_rule(p)) // star_named_expression && @@ -19024,11 +19206,11 @@ invalid_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default* invalid_parameters_helper param_no_default")); - asdl_seq * _loop0_156_var; + asdl_seq * _loop0_158_var; arg_ty a; void *invalid_parameters_helper_var; if ( - (_loop0_156_var = _loop0_156_rule(p)) // param_no_default* + (_loop0_158_var = _loop0_158_rule(p)) // param_no_default* && (invalid_parameters_helper_var = invalid_parameters_helper_rule(p)) // invalid_parameters_helper && @@ -19095,13 +19277,13 @@ invalid_parameters_helper_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - asdl_seq * _loop1_157_var; + asdl_seq * _loop1_159_var; if ( - (_loop1_157_var = _loop1_157_rule(p)) // param_with_default+ + (_loop1_159_var = _loop1_159_rule(p)) // param_with_default+ ) { D(fprintf(stderr, "%*c+ invalid_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "param_with_default+")); - _res = _loop1_157_var; + _res = _loop1_159_var; goto done; } p->mark = _mark; @@ -19132,11 +19314,11 @@ invalid_lambda_parameters_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default")); - asdl_seq * _loop0_158_var; + asdl_seq * _loop0_160_var; arg_ty a; void *invalid_lambda_parameters_helper_var; if ( - (_loop0_158_var = _loop0_158_rule(p)) // lambda_param_no_default* + (_loop0_160_var = _loop0_160_rule(p)) // lambda_param_no_default* && (invalid_lambda_parameters_helper_var = invalid_lambda_parameters_helper_rule(p)) // invalid_lambda_parameters_helper && @@ -19205,13 +19387,13 @@ invalid_lambda_parameters_helper_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_lambda_parameters_helper[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - asdl_seq * _loop1_159_var; + asdl_seq * _loop1_161_var; if ( - (_loop1_159_var = _loop1_159_rule(p)) // lambda_param_with_default+ + (_loop1_161_var = _loop1_161_rule(p)) // lambda_param_with_default+ ) { D(fprintf(stderr, "%*c+ invalid_lambda_parameters_helper[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default+")); - _res = _loop1_159_var; + _res = _loop1_161_var; goto done; } p->mark = _mark; @@ -19241,12 +19423,12 @@ invalid_star_etc_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); - void *_tmp_160_var; + void *_tmp_162_var; Token * a; if ( (a = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_160_var = _tmp_160_rule(p)) // ')' | ',' (')' | '**') + (_tmp_162_var = _tmp_162_rule(p)) // ')' | ',' (')' | '**') ) { D(fprintf(stderr, "%*c+ invalid_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (')' | ',' (')' | '**'))")); @@ -19316,11 +19498,11 @@ invalid_lambda_star_etc_rule(Parser *p) } D(fprintf(stderr, "%*c> invalid_lambda_star_etc[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); Token * _literal; - void *_tmp_161_var; + void *_tmp_163_var; if ( (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_161_var = _tmp_161_rule(p)) // ':' | ',' (':' | '**') + (_tmp_163_var = _tmp_163_rule(p)) // ':' | ',' (':' | '**') ) { D(fprintf(stderr, "%*c+ invalid_lambda_star_etc[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'*' (':' | ',' (':' | '**'))")); @@ -19418,11 +19600,11 @@ invalid_with_item_rule(Parser *p) if ( (expression_var = expression_rule(p)) // expression && - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (a = expression_rule(p)) // expression && - _PyPegen_lookahead(1, _tmp_162_rule, p) + _PyPegen_lookahead(1, _tmp_164_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_with_item[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression 'as' expression &(',' | ')' | ':')")); @@ -19468,7 +19650,7 @@ invalid_for_target_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' && (a = star_expressions_rule(p)) // star_expressions ) @@ -19638,7 +19820,7 @@ invalid_with_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); - asdl_seq * _gather_163_var; + asdl_seq * _gather_165_var; Token * _keyword; Token * _literal; void *_opt_var; @@ -19646,15 +19828,15 @@ invalid_with_stmt_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && - (_gather_163_var = _gather_163_rule(p)) // ','.(expression ['as' star_target])+ + (_gather_165_var = _gather_165_rule(p)) // ','.(expression ['as' star_target])+ && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' ) { D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ &&':'")); - _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_163_var, _literal); + _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _gather_165_var, _literal); goto done; } p->mark = _mark; @@ -19667,7 +19849,7 @@ invalid_with_stmt_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); - asdl_seq * _gather_165_var; + asdl_seq * _gather_167_var; Token * _keyword; Token * _literal; Token * _literal_1; @@ -19679,11 +19861,11 @@ invalid_with_stmt_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_gather_165_var = _gather_165_rule(p)) // ','.(expressions ['as' star_target])+ + (_gather_167_var = _gather_167_rule(p)) // ','.(expressions ['as' star_target])+ && (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? && @@ -19693,7 +19875,7 @@ invalid_with_stmt_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_with_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' &&':'")); - _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_165_var, _opt_var_1, _literal_1, _literal_2); + _res = _PyPegen_dummy_name(p, _opt_var, _keyword, _literal, _gather_167_var, _opt_var_1, _literal_1, _literal_2); goto done; } p->mark = _mark; @@ -19725,7 +19907,7 @@ invalid_with_stmt_indent_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' ','.(expression ['as' star_target])+ ':' NEWLINE !INDENT")); - asdl_seq * _gather_167_var; + asdl_seq * _gather_169_var; Token * _literal; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings @@ -19734,9 +19916,9 @@ invalid_with_stmt_indent_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 609)) // token='with' + (a = _PyPegen_expect_token(p, 612)) // token='with' && - (_gather_167_var = _gather_167_rule(p)) // ','.(expression ['as' star_target])+ + (_gather_169_var = _gather_169_rule(p)) // ','.(expression ['as' star_target])+ && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -19764,7 +19946,7 @@ invalid_with_stmt_indent_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_with_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "ASYNC? 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' ':' NEWLINE !INDENT")); - asdl_seq * _gather_169_var; + asdl_seq * _gather_171_var; Token * _literal; Token * _literal_1; Token * _literal_2; @@ -19777,11 +19959,11 @@ invalid_with_stmt_indent_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 609)) // token='with' + (a = _PyPegen_expect_token(p, 612)) // token='with' && (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (_gather_169_var = _gather_169_rule(p)) // ','.(expressions ['as' star_target])+ + (_gather_171_var = _gather_171_rule(p)) // ','.(expressions ['as' star_target])+ && (_opt_var_1 = _PyPegen_expect_token(p, 12), !p->error_indicator) // ','? && @@ -19834,7 +20016,7 @@ invalid_try_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 612)) // token='try' + (a = _PyPegen_expect_token(p, 615)) // token='try' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -19866,13 +20048,13 @@ invalid_try_stmt_rule(Parser *p) Token * _literal; asdl_stmt_seq* block_var; if ( - (_keyword = _PyPegen_expect_token(p, 612)) // token='try' + (_keyword = _PyPegen_expect_token(p, 615)) // token='try' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && (block_var = block_rule(p)) // block && - _PyPegen_lookahead(0, _tmp_171_rule, p) + _PyPegen_lookahead(0, _tmp_173_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block !('except' | 'finally')")); @@ -19922,7 +20104,7 @@ invalid_except_stmt_rule(Parser *p) expr_ty a; expr_ty expressions_var; if ( - (_keyword = _PyPegen_expect_token(p, 623)) // token='except' + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' && (a = expression_rule(p)) // expression && @@ -19930,7 +20112,7 @@ invalid_except_stmt_rule(Parser *p) && (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_172_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var = _tmp_174_rule(p), !p->error_indicator) // ['as' NAME] && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) @@ -19960,11 +20142,11 @@ invalid_except_stmt_rule(Parser *p) expr_ty expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 623)) // token='except' + (a = _PyPegen_expect_token(p, 632)) // token='except' && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_173_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var = _tmp_175_rule(p), !p->error_indicator) // ['as' NAME] && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) @@ -19991,7 +20173,7 @@ invalid_except_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 623)) // token='except' + (a = _PyPegen_expect_token(p, 632)) // token='except' && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) @@ -20015,9 +20197,12 @@ invalid_except_stmt_rule(Parser *p) return _res; } -// invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT +// invalid_except_star_stmt: +// | 'except' '*' expression ',' expressions ['as' NAME] ':' +// | 'except' '*' expression ['as' NAME] NEWLINE +// | 'except' '*' (NEWLINE | ':') static void * -invalid_finally_stmt_rule(Parser *p) +invalid_except_star_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20026,27 +20211,38 @@ invalid_finally_stmt_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'finally' ':' NEWLINE !INDENT + { // 'except' '*' expression ',' expressions ['as' NAME] ':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); + D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); + Token * _keyword; Token * _literal; - Token * a; - Token * newline_var; + Token * _literal_1; + Token * _literal_2; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + expr_ty a; + expr_ty expressions_var; if ( - (a = _PyPegen_expect_token(p, 620)) // token='finally' + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (a = expression_rule(p)) // expression && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' + && + (expressions_var = expressions_rule(p)) // expressions + && + (_opt_var = _tmp_176_rule(p), !p->error_indicator) // ['as' NAME] + && + (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); - _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno ); + D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); + _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -20055,34 +20251,15 @@ invalid_finally_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// invalid_except_stmt_indent: -// | 'except' expression ['as' NAME] ':' NEWLINE !INDENT -// | 'except' ':' NEWLINE !INDENT -static void * -invalid_except_stmt_indent_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; + D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); } - void * _res = NULL; - int _mark = p->mark; - { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT + { // 'except' '*' expression ['as' NAME] NEWLINE if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); + D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); Token * _literal; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings @@ -20090,21 +20267,19 @@ invalid_except_stmt_indent_rule(Parser *p) expr_ty expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 623)) // token='except' + (a = _PyPegen_expect_token(p, 632)) // token='except' && - (expression_var = expression_rule(p)) // expression + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_opt_var = _tmp_174_rule(p), !p->error_indicator) // ['as' NAME] + (expression_var = expression_rule(p)) // expression && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['as' NAME] && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT ) { - D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); - _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); + D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); + _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -20113,30 +20288,28 @@ invalid_except_stmt_indent_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); + D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); } - { // 'except' ':' NEWLINE !INDENT + { // 'except' '*' (NEWLINE | ':') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); + D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); Token * _literal; + void *_tmp_178_var; Token * a; - Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 623)) // token='except' - && - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (a = _PyPegen_expect_token(p, 632)) // token='except' && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + (_tmp_178_var = _tmp_178_rule(p)) // NEWLINE | ':' ) { - D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); - _res = RAISE_SYNTAX_ERROR ( "expected an indented block after except statement on line %d" , a -> lineno ); + D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); + _res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -20145,8 +20318,8 @@ invalid_except_stmt_indent_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT")); + D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' (NEWLINE | ':')")); } _res = NULL; done: @@ -20154,11 +20327,210 @@ invalid_except_stmt_indent_rule(Parser *p) return _res; } -// invalid_match_stmt: -// | "match" subject_expr !':' -// | "match" subject_expr ':' NEWLINE !INDENT +// invalid_finally_stmt: 'finally' ':' NEWLINE !INDENT static void * -invalid_match_stmt_rule(Parser *p) +invalid_finally_stmt_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'finally' ':' NEWLINE !INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_finally_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); + Token * _literal; + Token * a; + Token * newline_var; + if ( + (a = _PyPegen_expect_token(p, 628)) // token='finally' + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + ) + { + D(fprintf(stderr, "%*c+ invalid_finally_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); + _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'finally' statement on line %d" , a -> lineno ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_finally_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally' ':' NEWLINE !INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_except_stmt_indent: +// | 'except' expression ['as' NAME] ':' NEWLINE !INDENT +// | 'except' ':' NEWLINE !INDENT +static void * +invalid_except_stmt_indent_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'except' expression ['as' NAME] ':' NEWLINE !INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); + Token * _literal; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + Token * a; + expr_ty expression_var; + Token * newline_var; + if ( + (a = _PyPegen_expect_token(p, 632)) // token='except' + && + (expression_var = expression_rule(p)) // expression + && + (_opt_var = _tmp_179_rule(p), !p->error_indicator) // ['as' NAME] + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + ) + { + D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); + _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except' statement on line %d" , a -> lineno ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] ':' NEWLINE !INDENT")); + } + { // 'except' ':' NEWLINE !INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); + Token * _literal; + Token * a; + Token * newline_var; + if ( + (a = _PyPegen_expect_token(p, 632)) // token='except' + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + ) + { + D(fprintf(stderr, "%*c+ invalid_except_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' ':' NEWLINE !INDENT")); + _res = RAISE_SYNTAX_ERROR ( "expected an indented block after except statement on line %d" , a -> lineno ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' ':' NEWLINE !INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_except_star_stmt_indent: +// | 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT +static void * +invalid_except_star_stmt_indent_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_except_star_stmt_indent[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); + Token * _literal; + Token * _literal_1; + void *_opt_var; + UNUSED(_opt_var); // Silence compiler warnings + Token * a; + expr_ty expression_var; + Token * newline_var; + if ( + (a = _PyPegen_expect_token(p, 632)) // token='except' + && + (_literal = _PyPegen_expect_token(p, 16)) // token='*' + && + (expression_var = expression_rule(p)) // expression + && + (_opt_var = _tmp_180_rule(p), !p->error_indicator) // ['as' NAME] + && + (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' + && + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' + && + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, INDENT) // token=INDENT + ) + { + D(fprintf(stderr, "%*c+ invalid_except_star_stmt_indent[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); + _res = RAISE_INDENTATION_ERROR ( "expected an indented block after 'except*' statement on line %d" , a -> lineno ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_except_star_stmt_indent[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' NEWLINE !INDENT")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// invalid_match_stmt: +// | "match" subject_expr !':' +// | "match" subject_expr ':' NEWLINE !INDENT +static void * +invalid_match_stmt_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -20351,7 +20723,7 @@ invalid_as_pattern_rule(Parser *p) if ( (or_pattern_var = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' ) @@ -20381,7 +20753,7 @@ invalid_as_pattern_rule(Parser *p) if ( (or_pattern_var = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p) && @@ -20478,7 +20850,7 @@ invalid_class_argument_pattern_rule(Parser *p) asdl_pattern_seq* a; asdl_seq* keyword_patterns_var; if ( - (_opt_var = _tmp_175_rule(p), !p->error_indicator) // [positional_patterns ','] + (_opt_var = _tmp_181_rule(p), !p->error_indicator) // [positional_patterns ','] && (keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns && @@ -20529,7 +20901,7 @@ invalid_if_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20560,7 +20932,7 @@ invalid_if_stmt_rule(Parser *p) expr_ty a_1; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 627)) // token='if' + (a = _PyPegen_expect_token(p, 637)) // token='if' && (a_1 = named_expression_rule(p)) // named_expression && @@ -20613,7 +20985,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 629)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20644,7 +21016,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 629)) // token='elif' + (a = _PyPegen_expect_token(p, 639)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20695,7 +21067,7 @@ invalid_else_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 630)) // token='else' + (a = _PyPegen_expect_token(p, 640)) // token='else' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20746,7 +21118,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='while' + (_keyword = _PyPegen_expect_token(p, 642)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20777,7 +21149,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='while' + (a = _PyPegen_expect_token(p, 642)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20835,11 +21207,11 @@ invalid_for_stmt_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 633)) // token='for' + (a = _PyPegen_expect_token(p, 643)) // token='for' && (star_targets_var = star_targets_rule(p)) // star_targets && - (_keyword = _PyPegen_expect_token(p, 634)) // token='in' + (_keyword = _PyPegen_expect_token(p, 644)) // token='in' && (star_expressions_var = star_expressions_rule(p)) // star_expressions && @@ -20902,7 +21274,7 @@ invalid_def_raw_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 635)) // token='def' + (a = _PyPegen_expect_token(p, 645)) // token='def' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -20912,7 +21284,7 @@ invalid_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (_opt_var_2 = _tmp_176_rule(p), !p->error_indicator) // ['->' expression] + (_opt_var_2 = _tmp_182_rule(p), !p->error_indicator) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20964,11 +21336,11 @@ invalid_class_def_raw_rule(Parser *p) expr_ty name_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 636)) // token='class' + (a = _PyPegen_expect_token(p, 646)) // token='class' && (name_var = _PyPegen_name_token(p)) // NAME && - (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['(' arguments? ')'] + (_opt_var = _tmp_183_rule(p), !p->error_indicator) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -21016,11 +21388,11 @@ invalid_double_starred_kvpairs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - asdl_seq * _gather_178_var; + asdl_seq * _gather_184_var; Token * _literal; void *invalid_kvpair_var; if ( - (_gather_178_var = _gather_178_rule(p)) // ','.double_starred_kvpair+ + (_gather_184_var = _gather_184_rule(p)) // ','.double_starred_kvpair+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21028,7 +21400,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - _res = _PyPegen_dummy_name(p, _gather_178_var, _literal, invalid_kvpair_var); + _res = _PyPegen_dummy_name(p, _gather_184_var, _literal, invalid_kvpair_var); goto done; } p->mark = _mark; @@ -21081,7 +21453,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) && (a = _PyPegen_expect_token(p, 11)) // token=':' && - _PyPegen_lookahead(1, _tmp_180_rule, p) + _PyPegen_lookahead(1, _tmp_186_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); @@ -21561,7 +21933,7 @@ _tmp_6_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'from'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 569)) // token='from' + (_keyword = _PyPegen_expect_token(p, 572)) // token='from' ) { D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'from'")); @@ -21597,7 +21969,7 @@ _tmp_7_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='def' + (_keyword = _PyPegen_expect_token(p, 645)) // token='def' ) { D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); @@ -21671,7 +22043,7 @@ _tmp_8_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 636)) // token='class' + (_keyword = _PyPegen_expect_token(p, 646)) // token='class' ) { D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); @@ -21726,7 +22098,7 @@ _tmp_9_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'with'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 609)) // token='with' + (_keyword = _PyPegen_expect_token(p, 612)) // token='with' ) { D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'with'")); @@ -21781,7 +22153,7 @@ _tmp_10_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 633)) // token='for' + (_keyword = _PyPegen_expect_token(p, 643)) // token='for' ) { D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); @@ -21998,12 +22370,12 @@ _loop1_14_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_181_var; + void *_tmp_187_var; while ( - (_tmp_181_var = _tmp_181_rule(p)) // star_targets '=' + (_tmp_187_var = _tmp_187_rule(p)) // star_targets '=' ) { - _res = _tmp_181_var; + _res = _tmp_187_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22172,7 +22544,7 @@ _tmp_17_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 569)) // token='from' + (_keyword = _PyPegen_expect_token(p, 572)) // token='from' && (z = expression_rule(p)) // expression ) @@ -22550,12 +22922,12 @@ _loop0_24_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_182_var; + void *_tmp_188_var; while ( - (_tmp_182_var = _tmp_182_rule(p)) // '.' | '...' + (_tmp_188_var = _tmp_188_rule(p)) // '.' | '...' ) { - _res = _tmp_182_var; + _res = _tmp_188_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22616,12 +22988,12 @@ _loop1_25_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_183_var; + void *_tmp_189_var; while ( - (_tmp_183_var = _tmp_183_rule(p)) // '.' | '...' + (_tmp_189_var = _tmp_189_rule(p)) // '.' | '...' ) { - _res = _tmp_183_var; + _res = _tmp_189_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22794,7 +23166,7 @@ _tmp_28_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -22952,7 +23324,7 @@ _tmp_31_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -23003,12 +23375,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_184_var; + void *_tmp_190_var; while ( - (_tmp_184_var = _tmp_184_rule(p)) // '@' named_expression NEWLINE + (_tmp_190_var = _tmp_190_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_184_var; + _res = _tmp_190_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24742,53 +25114,9 @@ _loop1_59_rule(Parser *p) return _seq; } -// _tmp_60: 'as' NAME -static void * -_tmp_60_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'as' NAME - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty z; - if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' - && - (z = _PyPegen_name_token(p)) // NAME - ) - { - 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 _tmp_60[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); - } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// _loop1_61: case_block +// _loop1_60: except_star_block static asdl_seq * -_loop1_61_rule(Parser *p) +_loop1_60_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24807,18 +25135,18 @@ _loop1_61_rule(Parser *p) } Py_ssize_t _children_capacity = 1; Py_ssize_t _n = 0; - { // case_block + { // except_star_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; + D(fprintf(stderr, "%*c> _loop1_60[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block")); + excepthandler_ty except_star_block_var; while ( - (case_block_var = case_block_rule(p)) // case_block + (except_star_block_var = except_star_block_rule(p)) // except_star_block ) { - _res = case_block_var; + _res = except_star_block_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -24834,8 +25162,8 @@ _loop1_61_rule(Parser *p) _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")); + D(fprintf(stderr, "%*c%s _loop1_60[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block")); } if (_n == 0 || p->error_indicator) { PyMem_Free(_children); @@ -24852,40 +25180,199 @@ _loop1_61_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_61_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_60_type, _seq); D(p->level--); return _seq; } -// _loop0_63: '|' closed_pattern -static asdl_seq * -_loop0_63_rule(Parser *p) +// _tmp_61: 'as' NAME +static void * +_tmp_61_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; - { // '|' closed_pattern + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_63[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'|' closed_pattern")); - Token * _literal; - pattern_ty elem; + D(fprintf(stderr, "%*c> _tmp_61[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_61[%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 _tmp_61[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_62: 'as' NAME +static void * +_tmp_62_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty z; + if ( + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + && + (z = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_62[%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 _tmp_62[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _loop1_63: case_block +static asdl_seq * +_loop1_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; + { // case_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop1_63[%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_63[%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_63_type, _seq); + D(p->level--); + return _seq; +} + +// _loop0_65: '|' closed_pattern +static asdl_seq * +_loop0_65_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, "'|' closed_pattern")); + Token * _literal; + pattern_ty elem; while ( (_literal = _PyPegen_expect_token(p, 18)) // token='|' && @@ -24914,7 +25401,7 @@ _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, ' ', + D(fprintf(stderr, "%*c%s _loop0_65[%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); @@ -24927,14 +25414,14 @@ _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, _loop0_65_type, _seq); D(p->level--); return _seq; } -// _gather_62: closed_pattern _loop0_63 +// _gather_64: closed_pattern _loop0_65 static asdl_seq * -_gather_62_rule(Parser *p) +_gather_64_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24943,27 +25430,27 @@ _gather_62_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // closed_pattern _loop0_63 + { // closed_pattern _loop0_65 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_62[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_63")); + D(fprintf(stderr, "%*c> _gather_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_65")); pattern_ty elem; asdl_seq * seq; if ( (elem = closed_pattern_rule(p)) // closed_pattern && - (seq = _loop0_63_rule(p)) // _loop0_63 + (seq = _loop0_65_rule(p)) // _loop0_65 ) { - D(fprintf(stderr, "%*c+ _gather_62[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_63")); + D(fprintf(stderr, "%*c+ _gather_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "closed_pattern _loop0_65")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); 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, "closed_pattern _loop0_63")); + D(fprintf(stderr, "%*c%s _gather_64[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "closed_pattern _loop0_65")); } _res = NULL; done: @@ -24971,9 +25458,9 @@ _gather_62_rule(Parser *p) return _res; } -// _tmp_64: '+' | '-' +// _tmp_66: '+' | '-' static void * -_tmp_64_rule(Parser *p) +_tmp_66_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -24987,18 +25474,18 @@ _tmp_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); + D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 14)) // token='+' ) { - D(fprintf(stderr, "%*c+ _tmp_64[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); + 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_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); } { // '-' @@ -25006,18 +25493,18 @@ _tmp_64_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_64[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); + D(fprintf(stderr, "%*c> _tmp_66[%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, "'-'")); + 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_64[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_66[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); } _res = NULL; @@ -25026,9 +25513,9 @@ _tmp_64_rule(Parser *p) return _res; } -// _tmp_65: '+' | '-' +// _tmp_67: '+' | '-' static void * -_tmp_65_rule(Parser *p) +_tmp_67_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25042,18 +25529,18 @@ _tmp_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); + D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'+'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 14)) // token='+' ) { - D(fprintf(stderr, "%*c+ _tmp_65[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'+'")); + 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_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'+'")); } { // '-' @@ -25061,18 +25548,18 @@ _tmp_65_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_65[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'-'")); + D(fprintf(stderr, "%*c> _tmp_67[%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, "'-'")); + 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_65[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_67[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'-'")); } _res = NULL; @@ -25081,9 +25568,9 @@ _tmp_65_rule(Parser *p) return _res; } -// _tmp_66: '.' | '(' | '=' +// _tmp_68: '.' | '(' | '=' static void * -_tmp_66_rule(Parser *p) +_tmp_68_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25097,18 +25584,18 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_66[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_68[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '(' @@ -25116,18 +25603,18 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_68[%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, "'('")); + D(fprintf(stderr, "%*c+ _tmp_68[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '=' @@ -25135,18 +25622,18 @@ _tmp_66_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_66[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_68[%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, "'='")); + D(fprintf(stderr, "%*c+ _tmp_68[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_68[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } _res = NULL; @@ -25155,9 +25642,9 @@ _tmp_66_rule(Parser *p) return _res; } -// _tmp_67: '.' | '(' | '=' +// _tmp_69: '.' | '(' | '=' static void * -_tmp_67_rule(Parser *p) +_tmp_69_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25171,18 +25658,18 @@ _tmp_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_67[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_69[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '(' @@ -25190,18 +25677,18 @@ _tmp_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_69[%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, "'('")); + D(fprintf(stderr, "%*c+ _tmp_69[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '=' @@ -25209,18 +25696,18 @@ _tmp_67_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_67[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_69[%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, "'='")); + D(fprintf(stderr, "%*c+ _tmp_69[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_69[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } _res = NULL; @@ -25229,9 +25716,9 @@ _tmp_67_rule(Parser *p) return _res; } -// _loop0_69: ',' maybe_star_pattern +// _loop0_71: ',' maybe_star_pattern static asdl_seq * -_loop0_69_rule(Parser *p) +_loop0_71_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25255,7 +25742,7 @@ _loop0_69_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_69[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); + D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' maybe_star_pattern")); Token * _literal; pattern_ty elem; while ( @@ -25286,7 +25773,7 @@ _loop0_69_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_69[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_71[%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); @@ -25299,14 +25786,14 @@ _loop0_69_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_69_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_71_type, _seq); D(p->level--); return _seq; } -// _gather_68: maybe_star_pattern _loop0_69 +// _gather_70: maybe_star_pattern _loop0_71 static asdl_seq * -_gather_68_rule(Parser *p) +_gather_70_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25315,27 +25802,27 @@ _gather_68_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // maybe_star_pattern _loop0_69 + { // maybe_star_pattern _loop0_71 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_68[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_69")); + D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_71")); pattern_ty elem; asdl_seq * seq; if ( (elem = maybe_star_pattern_rule(p)) // maybe_star_pattern && - (seq = _loop0_69_rule(p)) // _loop0_69 + (seq = _loop0_71_rule(p)) // _loop0_71 ) { - D(fprintf(stderr, "%*c+ _gather_68[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_69")); + D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "maybe_star_pattern _loop0_71")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_70[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "maybe_star_pattern _loop0_71")); } _res = NULL; done: @@ -25343,9 +25830,9 @@ _gather_68_rule(Parser *p) return _res; } -// _loop0_71: ',' key_value_pattern +// _loop0_73: ',' key_value_pattern static asdl_seq * -_loop0_71_rule(Parser *p) +_loop0_73_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25369,7 +25856,7 @@ _loop0_71_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_71[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); + D(fprintf(stderr, "%*c> _loop0_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' key_value_pattern")); Token * _literal; KeyPatternPair* elem; while ( @@ -25400,7 +25887,7 @@ _loop0_71_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_71[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_73[%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); @@ -25413,14 +25900,14 @@ _loop0_71_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_71_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_73_type, _seq); D(p->level--); return _seq; } -// _gather_70: key_value_pattern _loop0_71 +// _gather_72: key_value_pattern _loop0_73 static asdl_seq * -_gather_70_rule(Parser *p) +_gather_72_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25429,27 +25916,27 @@ _gather_70_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // key_value_pattern _loop0_71 + { // key_value_pattern _loop0_73 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_70[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); + D(fprintf(stderr, "%*c> _gather_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); KeyPatternPair* elem; asdl_seq * seq; if ( (elem = key_value_pattern_rule(p)) // key_value_pattern && - (seq = _loop0_71_rule(p)) // _loop0_71 + (seq = _loop0_73_rule(p)) // _loop0_73 ) { - D(fprintf(stderr, "%*c+ _gather_70[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_71")); + D(fprintf(stderr, "%*c+ _gather_72[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "key_value_pattern _loop0_73")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_72[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "key_value_pattern _loop0_73")); } _res = NULL; done: @@ -25457,9 +25944,9 @@ _gather_70_rule(Parser *p) return _res; } -// _tmp_72: literal_expr | attr +// _tmp_74: literal_expr | attr static void * -_tmp_72_rule(Parser *p) +_tmp_74_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25473,18 +25960,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "literal_expr")); + D(fprintf(stderr, "%*c> _tmp_74[%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")); + D(fprintf(stderr, "%*c+ _tmp_74[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "literal_expr")); } { // attr @@ -25492,18 +25979,18 @@ _tmp_72_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_72[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "attr")); + D(fprintf(stderr, "%*c> _tmp_74[%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")); + D(fprintf(stderr, "%*c+ _tmp_74[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_74[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "attr")); } _res = NULL; @@ -25512,9 +25999,9 @@ _tmp_72_rule(Parser *p) return _res; } -// _loop0_74: ',' pattern +// _loop0_76: ',' pattern static asdl_seq * -_loop0_74_rule(Parser *p) +_loop0_76_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25538,7 +26025,7 @@ _loop0_74_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_74[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); + D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' pattern")); Token * _literal; pattern_ty elem; while ( @@ -25569,7 +26056,7 @@ _loop0_74_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_74[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' pattern")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -25582,14 +26069,14 @@ _loop0_74_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_74_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_76_type, _seq); D(p->level--); return _seq; } -// _gather_73: pattern _loop0_74 +// _gather_75: pattern _loop0_76 static asdl_seq * -_gather_73_rule(Parser *p) +_gather_75_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25598,27 +26085,27 @@ _gather_73_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // pattern _loop0_74 + { // pattern _loop0_76 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_73[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_74")); + D(fprintf(stderr, "%*c> _gather_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "pattern _loop0_76")); pattern_ty elem; asdl_seq * seq; if ( (elem = pattern_rule(p)) // pattern && - (seq = _loop0_74_rule(p)) // _loop0_74 + (seq = _loop0_76_rule(p)) // _loop0_76 ) { - D(fprintf(stderr, "%*c+ _gather_73[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_74")); + D(fprintf(stderr, "%*c+ _gather_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "pattern _loop0_76")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_73[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_74")); + D(fprintf(stderr, "%*c%s _gather_75[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "pattern _loop0_76")); } _res = NULL; done: @@ -25626,9 +26113,9 @@ _gather_73_rule(Parser *p) return _res; } -// _loop0_76: ',' keyword_pattern +// _loop0_78: ',' keyword_pattern static asdl_seq * -_loop0_76_rule(Parser *p) +_loop0_78_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25652,7 +26139,7 @@ _loop0_76_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_76[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); + D(fprintf(stderr, "%*c> _loop0_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' keyword_pattern")); Token * _literal; KeyPatternPair* elem; while ( @@ -25683,7 +26170,7 @@ _loop0_76_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_76[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_78[%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); @@ -25696,14 +26183,14 @@ _loop0_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, _loop0_76_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_78_type, _seq); D(p->level--); return _seq; } -// _gather_75: keyword_pattern _loop0_76 +// _gather_77: keyword_pattern _loop0_78 static asdl_seq * -_gather_75_rule(Parser *p) +_gather_77_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25712,27 +26199,27 @@ _gather_75_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // keyword_pattern _loop0_76 + { // keyword_pattern _loop0_78 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_75[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_76")); + D(fprintf(stderr, "%*c> _gather_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_78")); KeyPatternPair* elem; asdl_seq * seq; if ( (elem = keyword_pattern_rule(p)) // keyword_pattern && - (seq = _loop0_76_rule(p)) // _loop0_76 + (seq = _loop0_78_rule(p)) // _loop0_78 ) { - D(fprintf(stderr, "%*c+ _gather_75[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_76")); + D(fprintf(stderr, "%*c+ _gather_77[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "keyword_pattern _loop0_78")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_77[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "keyword_pattern _loop0_78")); } _res = NULL; done: @@ -25740,9 +26227,9 @@ _gather_75_rule(Parser *p) return _res; } -// _loop1_77: (',' expression) +// _loop1_79: (',' expression) static asdl_seq * -_loop1_77_rule(Parser *p) +_loop1_79_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25766,13 +26253,13 @@ _loop1_77_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_77[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_185_var; + D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); + void *_tmp_191_var; while ( - (_tmp_185_var = _tmp_185_rule(p)) // ',' expression + (_tmp_191_var = _tmp_191_rule(p)) // ',' expression ) { - _res = _tmp_185_var; + _res = _tmp_191_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25788,7 +26275,7 @@ _loop1_77_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_77[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_79[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' expression)")); } if (_n == 0 || p->error_indicator) { @@ -25806,14 +26293,14 @@ _loop1_77_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_77_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_79_type, _seq); D(p->level--); return _seq; } -// _loop1_78: (',' star_expression) +// _loop1_80: (',' star_expression) static asdl_seq * -_loop1_78_rule(Parser *p) +_loop1_80_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25837,13 +26324,13 @@ _loop1_78_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_78[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_186_var; + D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); + void *_tmp_192_var; while ( - (_tmp_186_var = _tmp_186_rule(p)) // ',' star_expression + (_tmp_192_var = _tmp_192_rule(p)) // ',' star_expression ) { - _res = _tmp_186_var; + _res = _tmp_192_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25859,7 +26346,7 @@ _loop1_78_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_78[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_80[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_expression)")); } if (_n == 0 || p->error_indicator) { @@ -25877,14 +26364,14 @@ _loop1_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, _loop1_78_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_80_type, _seq); D(p->level--); return _seq; } -// _loop0_80: ',' star_named_expression +// _loop0_82: ',' star_named_expression static asdl_seq * -_loop0_80_rule(Parser *p) +_loop0_82_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25908,7 +26395,7 @@ _loop0_80_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); + D(fprintf(stderr, "%*c> _loop0_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_named_expression")); Token * _literal; expr_ty elem; while ( @@ -25939,7 +26426,7 @@ _loop0_80_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_80[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_82[%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); @@ -25952,14 +26439,14 @@ _loop0_80_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_80_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_82_type, _seq); D(p->level--); return _seq; } -// _gather_79: star_named_expression _loop0_80 +// _gather_81: star_named_expression _loop0_82 static asdl_seq * -_gather_79_rule(Parser *p) +_gather_81_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -25968,27 +26455,27 @@ _gather_79_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_named_expression _loop0_80 + { // star_named_expression _loop0_82 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_80")); + D(fprintf(stderr, "%*c> _gather_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_82")); expr_ty elem; asdl_seq * seq; if ( (elem = star_named_expression_rule(p)) // star_named_expression && - (seq = _loop0_80_rule(p)) // _loop0_80 + (seq = _loop0_82_rule(p)) // _loop0_82 ) { - D(fprintf(stderr, "%*c+ _gather_79[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_80")); + D(fprintf(stderr, "%*c+ _gather_81[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression _loop0_82")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_81[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression _loop0_82")); } _res = NULL; done: @@ -25996,9 +26483,9 @@ _gather_79_rule(Parser *p) return _res; } -// _loop1_81: ('or' conjunction) +// _loop1_83: ('or' conjunction) static asdl_seq * -_loop1_81_rule(Parser *p) +_loop1_83_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26022,13 +26509,13 @@ _loop1_81_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_81[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_187_var; + D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); + void *_tmp_193_var; while ( - (_tmp_187_var = _tmp_187_rule(p)) // 'or' conjunction + (_tmp_193_var = _tmp_193_rule(p)) // 'or' conjunction ) { - _res = _tmp_187_var; + _res = _tmp_193_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26044,7 +26531,7 @@ _loop1_81_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_81[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_83[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('or' conjunction)")); } if (_n == 0 || p->error_indicator) { @@ -26062,14 +26549,14 @@ _loop1_81_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_81_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_83_type, _seq); D(p->level--); return _seq; } -// _loop1_82: ('and' inversion) +// _loop1_84: ('and' inversion) static asdl_seq * -_loop1_82_rule(Parser *p) +_loop1_84_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26093,13 +26580,13 @@ _loop1_82_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_82[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_188_var; + D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); + void *_tmp_194_var; while ( - (_tmp_188_var = _tmp_188_rule(p)) // 'and' inversion + (_tmp_194_var = _tmp_194_rule(p)) // 'and' inversion ) { - _res = _tmp_188_var; + _res = _tmp_194_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26115,7 +26602,7 @@ _loop1_82_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_82[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_84[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "('and' inversion)")); } if (_n == 0 || p->error_indicator) { @@ -26133,14 +26620,14 @@ _loop1_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, _loop1_82_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_84_type, _seq); D(p->level--); return _seq; } -// _loop1_83: compare_op_bitwise_or_pair +// _loop1_85: compare_op_bitwise_or_pair static asdl_seq * -_loop1_83_rule(Parser *p) +_loop1_85_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26164,7 +26651,7 @@ _loop1_83_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); + D(fprintf(stderr, "%*c> _loop1_85[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "compare_op_bitwise_or_pair")); CmpopExprPair* compare_op_bitwise_or_pair_var; while ( (compare_op_bitwise_or_pair_var = compare_op_bitwise_or_pair_rule(p)) // compare_op_bitwise_or_pair @@ -26186,7 +26673,7 @@ _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, ' ', + D(fprintf(stderr, "%*c%s _loop1_85[%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) { @@ -26204,14 +26691,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_85_type, _seq); D(p->level--); return _seq; } -// _tmp_84: '!=' +// _tmp_86: '!=' static void * -_tmp_84_rule(Parser *p) +_tmp_86_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26225,13 +26712,13 @@ _tmp_84_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c> _tmp_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'!='")); Token * tok; if ( (tok = _PyPegen_expect_token(p, 28)) // token='!=' ) { - D(fprintf(stderr, "%*c+ _tmp_84[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'!='")); + D(fprintf(stderr, "%*c+ _tmp_86[%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; @@ -26241,7 +26728,7 @@ _tmp_84_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_84[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_86[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'!='")); } _res = NULL; @@ -26250,9 +26737,9 @@ _tmp_84_rule(Parser *p) return _res; } -// _loop0_86: ',' slice +// _loop0_88: ',' slice static asdl_seq * -_loop0_86_rule(Parser *p) +_loop0_88_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26276,7 +26763,7 @@ _loop0_86_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_86[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); + D(fprintf(stderr, "%*c> _loop0_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' slice")); Token * _literal; expr_ty elem; while ( @@ -26307,7 +26794,7 @@ _loop0_86_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_86[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_88[%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); @@ -26320,14 +26807,14 @@ _loop0_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, _loop0_86_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_88_type, _seq); D(p->level--); return _seq; } -// _gather_85: slice _loop0_86 +// _gather_87: slice _loop0_88 static asdl_seq * -_gather_85_rule(Parser *p) +_gather_87_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26336,27 +26823,27 @@ _gather_85_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // slice _loop0_86 + { // slice _loop0_88 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")); + D(fprintf(stderr, "%*c> _gather_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "slice _loop0_88")); expr_ty elem; asdl_seq * seq; if ( (elem = slice_rule(p)) // slice && - (seq = _loop0_86_rule(p)) // _loop0_86 + (seq = _loop0_88_rule(p)) // _loop0_88 ) { - D(fprintf(stderr, "%*c+ _gather_85[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_86")); + D(fprintf(stderr, "%*c+ _gather_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "slice _loop0_88")); _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")); + D(fprintf(stderr, "%*c%s _gather_87[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "slice _loop0_88")); } _res = NULL; done: @@ -26364,9 +26851,9 @@ _gather_85_rule(Parser *p) return _res; } -// _tmp_87: ':' expression? +// _tmp_89: ':' expression? static void * -_tmp_87_rule(Parser *p) +_tmp_89_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26380,7 +26867,7 @@ _tmp_87_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_87[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':' expression?")); Token * _literal; void *d; if ( @@ -26389,7 +26876,7 @@ _tmp_87_rule(Parser *p) (d = expression_rule(p), !p->error_indicator) // expression? ) { - D(fprintf(stderr, "%*c+ _tmp_87[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); + D(fprintf(stderr, "%*c+ _tmp_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':' expression?")); _res = d; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -26399,7 +26886,7 @@ _tmp_87_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_87[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_89[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':' expression?")); } _res = NULL; @@ -26408,9 +26895,9 @@ _tmp_87_rule(Parser *p) return _res; } -// _tmp_88: tuple | group | genexp +// _tmp_90: tuple | group | genexp static void * -_tmp_88_rule(Parser *p) +_tmp_90_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26424,18 +26911,18 @@ _tmp_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_90[%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_88[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_90[%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_88[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // group @@ -26443,18 +26930,18 @@ _tmp_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "group")); + D(fprintf(stderr, "%*c> _tmp_90[%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")); + D(fprintf(stderr, "%*c+ _tmp_90[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "group")); } { // genexp @@ -26462,18 +26949,18 @@ _tmp_88_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_88[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_90[%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")); + D(fprintf(stderr, "%*c+ _tmp_90[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_90[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } _res = NULL; @@ -26482,9 +26969,9 @@ _tmp_88_rule(Parser *p) return _res; } -// _tmp_89: list | listcomp +// _tmp_91: list | listcomp static void * -_tmp_89_rule(Parser *p) +_tmp_91_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26498,18 +26985,18 @@ _tmp_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_91[%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_89[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_91[%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_89[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // listcomp @@ -26517,18 +27004,18 @@ _tmp_89_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_89[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "listcomp")); + D(fprintf(stderr, "%*c> _tmp_91[%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")); + D(fprintf(stderr, "%*c+ _tmp_91[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_91[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "listcomp")); } _res = NULL; @@ -26537,9 +27024,9 @@ _tmp_89_rule(Parser *p) return _res; } -// _tmp_90: dict | set | dictcomp | setcomp +// _tmp_92: dict | set | dictcomp | setcomp static void * -_tmp_90_rule(Parser *p) +_tmp_92_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26553,18 +27040,18 @@ _tmp_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dict")); + D(fprintf(stderr, "%*c> _tmp_92[%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")); + D(fprintf(stderr, "%*c+ _tmp_92[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dict")); } { // set @@ -26572,18 +27059,18 @@ _tmp_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c> _tmp_92[%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_90[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "set")); + D(fprintf(stderr, "%*c+ _tmp_92[%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_90[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "set")); } { // dictcomp @@ -26591,18 +27078,18 @@ _tmp_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "dictcomp")); + D(fprintf(stderr, "%*c> _tmp_92[%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")); + D(fprintf(stderr, "%*c+ _tmp_92[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "dictcomp")); } { // setcomp @@ -26610,18 +27097,18 @@ _tmp_90_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_90[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "setcomp")); + D(fprintf(stderr, "%*c> _tmp_92[%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")); + D(fprintf(stderr, "%*c+ _tmp_92[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_92[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "setcomp")); } _res = NULL; @@ -26630,9 +27117,9 @@ _tmp_90_rule(Parser *p) return _res; } -// _tmp_91: yield_expr | named_expression +// _tmp_93: yield_expr | named_expression static void * -_tmp_91_rule(Parser *p) +_tmp_93_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26646,18 +27133,18 @@ _tmp_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_93[%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_91[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_93[%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_91[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // named_expression @@ -26665,18 +27152,18 @@ _tmp_91_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_91[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression")); + D(fprintf(stderr, "%*c> _tmp_93[%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")); + D(fprintf(stderr, "%*c+ _tmp_93[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_93[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression")); } _res = NULL; @@ -26685,9 +27172,9 @@ _tmp_91_rule(Parser *p) return _res; } -// _loop0_92: lambda_param_no_default +// _loop0_94: lambda_param_no_default static asdl_seq * -_loop0_92_rule(Parser *p) +_loop0_94_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26711,7 +27198,7 @@ _loop0_92_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_92[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_94[%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 @@ -26733,7 +27220,7 @@ _loop0_92_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_92[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -26746,14 +27233,14 @@ _loop0_92_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_92_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_94_type, _seq); D(p->level--); return _seq; } -// _loop0_93: lambda_param_with_default +// _loop0_95: lambda_param_with_default static asdl_seq * -_loop0_93_rule(Parser *p) +_loop0_95_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26777,7 +27264,7 @@ _loop0_93_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_93[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_95[%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 @@ -26799,7 +27286,7 @@ _loop0_93_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_93[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_95[%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); @@ -26812,14 +27299,14 @@ _loop0_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, _loop0_93_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_95_type, _seq); D(p->level--); return _seq; } -// _loop0_94: lambda_param_with_default +// _loop0_96: lambda_param_with_default static asdl_seq * -_loop0_94_rule(Parser *p) +_loop0_96_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26843,7 +27330,7 @@ _loop0_94_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_94[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + 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_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -26865,7 +27352,7 @@ _loop0_94_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_94[%d-%d]: %s failed!\n", p->level, ' ', + 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); @@ -26878,14 +27365,14 @@ _loop0_94_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_94_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_96_type, _seq); D(p->level--); return _seq; } -// _loop1_95: lambda_param_no_default +// _loop1_97: lambda_param_no_default static asdl_seq * -_loop1_95_rule(Parser *p) +_loop1_97_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26909,7 +27396,7 @@ _loop1_95_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_95[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + 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; while ( (lambda_param_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -26931,7 +27418,7 @@ _loop1_95_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_95[%d-%d]: %s failed!\n", p->level, ' ', + 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")); } if (_n == 0 || p->error_indicator) { @@ -26949,14 +27436,14 @@ _loop1_95_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_95_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_97_type, _seq); D(p->level--); return _seq; } -// _loop0_96: lambda_param_with_default +// _loop0_98: lambda_param_with_default static asdl_seq * -_loop0_96_rule(Parser *p) +_loop0_98_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -26980,7 +27467,7 @@ _loop0_96_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_96[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop0_98[%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 @@ -27002,7 +27489,7 @@ _loop0_96_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_96[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_98[%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); @@ -27015,14 +27502,14 @@ _loop0_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, _loop0_96_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_98_type, _seq); D(p->level--); return _seq; } -// _loop1_97: lambda_param_with_default +// _loop1_99: lambda_param_with_default static asdl_seq * -_loop1_97_rule(Parser *p) +_loop1_99_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27046,7 +27533,7 @@ _loop1_97_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_97[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + 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; while ( (lambda_param_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -27068,7 +27555,7 @@ _loop1_97_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_97[%d-%d]: %s failed!\n", p->level, ' ', + 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")); } if (_n == 0 || p->error_indicator) { @@ -27086,14 +27573,14 @@ _loop1_97_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_97_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_99_type, _seq); D(p->level--); return _seq; } -// _loop1_98: lambda_param_no_default +// _loop1_100: lambda_param_no_default static asdl_seq * -_loop1_98_rule(Parser *p) +_loop1_100_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27117,7 +27604,7 @@ _loop1_98_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_98[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_100[%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 @@ -27139,7 +27626,7 @@ _loop1_98_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_98[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_100[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -27157,14 +27644,14 @@ _loop1_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, _loop1_98_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_100_type, _seq); D(p->level--); return _seq; } -// _loop1_99: lambda_param_no_default +// _loop1_101: lambda_param_no_default static asdl_seq * -_loop1_99_rule(Parser *p) +_loop1_101_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27188,7 +27675,7 @@ _loop1_99_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_99[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop1_101[%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 @@ -27210,7 +27697,7 @@ _loop1_99_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_99[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } if (_n == 0 || p->error_indicator) { @@ -27228,14 +27715,14 @@ _loop1_99_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_99_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_101_type, _seq); D(p->level--); return _seq; } -// _loop0_100: lambda_param_no_default +// _loop0_102: lambda_param_no_default static asdl_seq * -_loop0_100_rule(Parser *p) +_loop0_102_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27259,7 +27746,7 @@ _loop0_100_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_100[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + 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_no_default_var = lambda_param_no_default_rule(p)) // lambda_param_no_default @@ -27281,7 +27768,7 @@ _loop0_100_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_100[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -27294,14 +27781,14 @@ _loop0_100_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_100_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_102_type, _seq); D(p->level--); return _seq; } -// _loop1_101: lambda_param_with_default +// _loop1_103: lambda_param_with_default static asdl_seq * -_loop1_101_rule(Parser *p) +_loop1_103_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27325,7 +27812,7 @@ _loop1_101_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_101[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + 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_with_default_var = lambda_param_with_default_rule(p)) // lambda_param_with_default @@ -27347,7 +27834,7 @@ _loop1_101_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_101[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -27365,14 +27852,14 @@ _loop1_101_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_101_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_103_type, _seq); D(p->level--); return _seq; } -// _loop0_102: lambda_param_no_default +// _loop0_104: lambda_param_no_default static asdl_seq * -_loop0_102_rule(Parser *p) +_loop0_104_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27396,7 +27883,7 @@ _loop0_102_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_102[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_104[%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 @@ -27418,7 +27905,7 @@ _loop0_102_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_102[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -27431,14 +27918,14 @@ _loop0_102_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_102_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_104_type, _seq); D(p->level--); return _seq; } -// _loop1_103: lambda_param_with_default +// _loop1_105: lambda_param_with_default static asdl_seq * -_loop1_103_rule(Parser *p) +_loop1_105_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27462,7 +27949,7 @@ _loop1_103_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_103[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_105[%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 @@ -27484,7 +27971,7 @@ _loop1_103_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_103[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -27502,14 +27989,14 @@ _loop1_103_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_103_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_105_type, _seq); D(p->level--); return _seq; } -// _loop0_104: lambda_param_maybe_default +// _loop0_106: lambda_param_maybe_default static asdl_seq * -_loop0_104_rule(Parser *p) +_loop0_106_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27533,7 +28020,7 @@ _loop0_104_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_104[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop0_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -27555,7 +28042,7 @@ _loop0_104_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_104[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_106[%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); @@ -27568,14 +28055,14 @@ _loop0_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, _loop0_104_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_106_type, _seq); D(p->level--); return _seq; } -// _loop1_105: lambda_param_maybe_default +// _loop1_107: lambda_param_maybe_default static asdl_seq * -_loop1_105_rule(Parser *p) +_loop1_107_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27599,7 +28086,7 @@ _loop1_105_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_105[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); + D(fprintf(stderr, "%*c> _loop1_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_maybe_default")); NameDefaultPair* lambda_param_maybe_default_var; while ( (lambda_param_maybe_default_var = lambda_param_maybe_default_rule(p)) // lambda_param_maybe_default @@ -27621,7 +28108,7 @@ _loop1_105_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_105[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_107[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_maybe_default")); } if (_n == 0 || p->error_indicator) { @@ -27639,14 +28126,14 @@ _loop1_105_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_105_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_107_type, _seq); D(p->level--); return _seq; } -// _loop1_106: STRING +// _loop1_108: STRING static asdl_seq * -_loop1_106_rule(Parser *p) +_loop1_108_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27670,7 +28157,7 @@ _loop1_106_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_106[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); + D(fprintf(stderr, "%*c> _loop1_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "STRING")); expr_ty string_var; while ( (string_var = _PyPegen_string_token(p)) // STRING @@ -27692,7 +28179,7 @@ _loop1_106_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_106[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_108[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "STRING")); } if (_n == 0 || p->error_indicator) { @@ -27710,14 +28197,14 @@ _loop1_106_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_106_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_108_type, _seq); D(p->level--); return _seq; } -// _tmp_107: star_named_expression ',' star_named_expressions? +// _tmp_109: star_named_expression ',' star_named_expressions? static void * -_tmp_107_rule(Parser *p) +_tmp_109_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27731,7 +28218,7 @@ _tmp_107_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_107[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c> _tmp_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); Token * _literal; expr_ty y; void *z; @@ -27743,7 +28230,7 @@ _tmp_107_rule(Parser *p) (z = star_named_expressions_rule(p), !p->error_indicator) // star_named_expressions? ) { - D(fprintf(stderr, "%*c+ _tmp_107[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_named_expression ',' star_named_expressions?")); + D(fprintf(stderr, "%*c+ _tmp_109[%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; @@ -27753,7 +28240,7 @@ _tmp_107_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_107[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_109[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expression ',' star_named_expressions?")); } _res = NULL; @@ -27762,9 +28249,9 @@ _tmp_107_rule(Parser *p) return _res; } -// _loop0_109: ',' double_starred_kvpair +// _loop0_111: ',' double_starred_kvpair static asdl_seq * -_loop0_109_rule(Parser *p) +_loop0_111_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27788,7 +28275,7 @@ _loop0_109_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_109[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -27819,7 +28306,7 @@ _loop0_109_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_109[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -27832,14 +28319,14 @@ _loop0_109_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_109_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_111_type, _seq); D(p->level--); return _seq; } -// _gather_108: double_starred_kvpair _loop0_109 +// _gather_110: double_starred_kvpair _loop0_111 static asdl_seq * -_gather_108_rule(Parser *p) +_gather_110_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27848,27 +28335,27 @@ _gather_108_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_109 + { // double_starred_kvpair _loop0_111 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_108[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_109")); + D(fprintf(stderr, "%*c> _gather_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_111")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_109_rule(p)) // _loop0_109 + (seq = _loop0_111_rule(p)) // _loop0_111 ) { - D(fprintf(stderr, "%*c+ _gather_108[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_109")); + D(fprintf(stderr, "%*c+ _gather_110[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_111")); _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, "double_starred_kvpair _loop0_109")); + D(fprintf(stderr, "%*c%s _gather_110[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_111")); } _res = NULL; done: @@ -27876,9 +28363,9 @@ _gather_108_rule(Parser *p) return _res; } -// _loop1_110: for_if_clause +// _loop1_112: for_if_clause static asdl_seq * -_loop1_110_rule(Parser *p) +_loop1_112_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27902,7 +28389,7 @@ _loop1_110_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_110[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "for_if_clause")); + D(fprintf(stderr, "%*c> _loop1_112[%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 @@ -27924,7 +28411,7 @@ _loop1_110_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_110[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_112[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "for_if_clause")); } if (_n == 0 || p->error_indicator) { @@ -27942,14 +28429,14 @@ _loop1_110_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_110_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_112_type, _seq); D(p->level--); return _seq; } -// _loop0_111: ('if' disjunction) +// _loop0_113: ('if' disjunction) static asdl_seq * -_loop0_111_rule(Parser *p) +_loop0_113_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -27973,13 +28460,13 @@ _loop0_111_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_111[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_189_var; + D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_195_var; while ( - (_tmp_189_var = _tmp_189_rule(p)) // 'if' disjunction + (_tmp_195_var = _tmp_195_rule(p)) // 'if' disjunction ) { - _res = _tmp_189_var; + _res = _tmp_195_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -27995,7 +28482,7 @@ _loop0_111_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_111[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_113[%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); @@ -28008,14 +28495,14 @@ _loop0_111_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_111_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_113_type, _seq); D(p->level--); return _seq; } -// _loop0_112: ('if' disjunction) +// _loop0_114: ('if' disjunction) static asdl_seq * -_loop0_112_rule(Parser *p) +_loop0_114_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28039,13 +28526,13 @@ _loop0_112_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_112[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_190_var; + D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); + void *_tmp_196_var; while ( - (_tmp_190_var = _tmp_190_rule(p)) // 'if' disjunction + (_tmp_196_var = _tmp_196_rule(p)) // 'if' disjunction ) { - _res = _tmp_190_var; + _res = _tmp_196_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28061,7 +28548,7 @@ _loop0_112_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_112[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_114[%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); @@ -28074,14 +28561,14 @@ _loop0_112_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_112_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_114_type, _seq); D(p->level--); return _seq; } -// _tmp_113: assignment_expression | expression !':=' +// _tmp_115: assignment_expression | expression !':=' static void * -_tmp_113_rule(Parser *p) +_tmp_115_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28095,18 +28582,18 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); expr_ty assignment_expression_var; if ( (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression ) { - D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c+ _tmp_115[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); _res = assignment_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_113[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression")); } { // expression !':=' @@ -28114,7 +28601,7 @@ _tmp_113_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c> _tmp_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression @@ -28122,12 +28609,12 @@ _tmp_113_rule(Parser *p) _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, "expression !':='")); + D(fprintf(stderr, "%*c+ _tmp_115[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_115[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); } _res = NULL; @@ -28136,9 +28623,9 @@ _tmp_113_rule(Parser *p) return _res; } -// _loop0_115: ',' (starred_expression | (assignment_expression | expression !':=') !'=') +// _loop0_117: ',' (starred_expression | (assignment_expression | expression !':=') !'=') static asdl_seq * -_loop0_115_rule(Parser *p) +_loop0_117_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28162,13 +28649,13 @@ _loop0_115_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_115[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')")); + D(fprintf(stderr, "%*c> _loop0_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_191_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' + (elem = _tmp_197_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' ) { _res = elem; @@ -28193,7 +28680,7 @@ _loop0_115_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_115[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_117[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (starred_expression | (assignment_expression | expression !':=') !'=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -28206,15 +28693,15 @@ _loop0_115_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_115_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_117_type, _seq); D(p->level--); return _seq; } -// _gather_114: -// | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_115 +// _gather_116: +// | (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_117 static asdl_seq * -_gather_114_rule(Parser *p) +_gather_116_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28223,27 +28710,27 @@ _gather_114_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_115 + { // (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_117 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_115")); + D(fprintf(stderr, "%*c> _gather_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_117")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_191_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' + (elem = _tmp_197_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' && - (seq = _loop0_115_rule(p)) // _loop0_115 + (seq = _loop0_117_rule(p)) // _loop0_117 ) { - D(fprintf(stderr, "%*c+ _gather_114[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_115")); + D(fprintf(stderr, "%*c+ _gather_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_117")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_114[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_115")); + D(fprintf(stderr, "%*c%s _gather_116[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(starred_expression | (assignment_expression | expression !':=') !'=') _loop0_117")); } _res = NULL; done: @@ -28251,9 +28738,9 @@ _gather_114_rule(Parser *p) return _res; } -// _tmp_116: ',' kwargs +// _tmp_118: ',' kwargs static void * -_tmp_116_rule(Parser *p) +_tmp_118_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28267,7 +28754,7 @@ _tmp_116_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_116[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + D(fprintf(stderr, "%*c> _tmp_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwargs")); Token * _literal; asdl_seq* k; if ( @@ -28276,7 +28763,7 @@ _tmp_116_rule(Parser *p) (k = kwargs_rule(p)) // kwargs ) { - D(fprintf(stderr, "%*c+ _tmp_116[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); + D(fprintf(stderr, "%*c+ _tmp_118[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' kwargs")); _res = k; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -28286,7 +28773,7 @@ _tmp_116_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_116[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_118[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' kwargs")); } _res = NULL; @@ -28295,9 +28782,9 @@ _tmp_116_rule(Parser *p) return _res; } -// _loop0_118: ',' kwarg_or_starred +// _loop0_120: ',' kwarg_or_starred static asdl_seq * -_loop0_118_rule(Parser *p) +_loop0_120_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28321,7 +28808,7 @@ _loop0_118_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_118[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -28352,7 +28839,7 @@ _loop0_118_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_118[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_120[%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); @@ -28365,14 +28852,14 @@ _loop0_118_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_118_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_120_type, _seq); D(p->level--); return _seq; } -// _gather_117: kwarg_or_starred _loop0_118 +// _gather_119: kwarg_or_starred _loop0_120 static asdl_seq * -_gather_117_rule(Parser *p) +_gather_119_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28381,27 +28868,27 @@ _gather_117_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_118 + { // kwarg_or_starred _loop0_120 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_117[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_118")); + D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_120")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_118_rule(p)) // _loop0_118 + (seq = _loop0_120_rule(p)) // _loop0_120 ) { - D(fprintf(stderr, "%*c+ _gather_117[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_118")); + D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_120")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_119[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_120")); } _res = NULL; done: @@ -28409,9 +28896,9 @@ _gather_117_rule(Parser *p) return _res; } -// _loop0_120: ',' kwarg_or_double_starred +// _loop0_122: ',' kwarg_or_double_starred static asdl_seq * -_loop0_120_rule(Parser *p) +_loop0_122_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28435,7 +28922,7 @@ _loop0_120_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_120[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -28466,7 +28953,7 @@ _loop0_120_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_120[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_122[%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); @@ -28479,14 +28966,14 @@ _loop0_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, _loop0_120_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_122_type, _seq); D(p->level--); return _seq; } -// _gather_119: kwarg_or_double_starred _loop0_120 +// _gather_121: kwarg_or_double_starred _loop0_122 static asdl_seq * -_gather_119_rule(Parser *p) +_gather_121_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28495,27 +28982,27 @@ _gather_119_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_120 + { // kwarg_or_double_starred _loop0_122 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_119[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_120")); + D(fprintf(stderr, "%*c> _gather_121[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_122")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_120_rule(p)) // _loop0_120 + (seq = _loop0_122_rule(p)) // _loop0_122 ) { - D(fprintf(stderr, "%*c+ _gather_119[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_120")); + D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_122")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - 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")); + D(fprintf(stderr, "%*c%s _gather_121[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_122")); } _res = NULL; done: @@ -28523,9 +29010,9 @@ _gather_119_rule(Parser *p) return _res; } -// _loop0_122: ',' kwarg_or_starred +// _loop0_124: ',' kwarg_or_starred static asdl_seq * -_loop0_122_rule(Parser *p) +_loop0_124_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28549,7 +29036,7 @@ _loop0_122_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_122[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); + D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -28580,7 +29067,7 @@ _loop0_122_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_122[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_124[%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); @@ -28593,14 +29080,14 @@ _loop0_122_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_122_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_124_type, _seq); D(p->level--); return _seq; } -// _gather_121: kwarg_or_starred _loop0_122 +// _gather_123: kwarg_or_starred _loop0_124 static asdl_seq * -_gather_121_rule(Parser *p) +_gather_123_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28609,27 +29096,27 @@ _gather_121_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_starred _loop0_122 + { // kwarg_or_starred _loop0_124 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")); + D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_124")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_starred_rule(p)) // kwarg_or_starred && - (seq = _loop0_122_rule(p)) // _loop0_122 + (seq = _loop0_124_rule(p)) // _loop0_124 ) { - D(fprintf(stderr, "%*c+ _gather_121[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_122")); + D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_starred _loop0_124")); _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")); + D(fprintf(stderr, "%*c%s _gather_123[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_starred _loop0_124")); } _res = NULL; done: @@ -28637,9 +29124,9 @@ _gather_121_rule(Parser *p) return _res; } -// _loop0_124: ',' kwarg_or_double_starred +// _loop0_126: ',' kwarg_or_double_starred static asdl_seq * -_loop0_124_rule(Parser *p) +_loop0_126_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28663,7 +29150,7 @@ _loop0_124_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_124[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); + D(fprintf(stderr, "%*c> _loop0_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' kwarg_or_double_starred")); Token * _literal; KeywordOrStarred* elem; while ( @@ -28694,7 +29181,7 @@ _loop0_124_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_124[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_126[%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); @@ -28707,14 +29194,14 @@ _loop0_124_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_124_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_126_type, _seq); D(p->level--); return _seq; } -// _gather_123: kwarg_or_double_starred _loop0_124 +// _gather_125: kwarg_or_double_starred _loop0_126 static asdl_seq * -_gather_123_rule(Parser *p) +_gather_125_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28723,27 +29210,27 @@ _gather_123_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // kwarg_or_double_starred _loop0_124 + { // kwarg_or_double_starred _loop0_126 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_123[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_124")); + D(fprintf(stderr, "%*c> _gather_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_126")); KeywordOrStarred* elem; asdl_seq * seq; if ( (elem = kwarg_or_double_starred_rule(p)) // kwarg_or_double_starred && - (seq = _loop0_124_rule(p)) // _loop0_124 + (seq = _loop0_126_rule(p)) // _loop0_126 ) { - D(fprintf(stderr, "%*c+ _gather_123[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_124")); + D(fprintf(stderr, "%*c+ _gather_125[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "kwarg_or_double_starred _loop0_126")); _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, "kwarg_or_double_starred _loop0_124")); + D(fprintf(stderr, "%*c%s _gather_125[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "kwarg_or_double_starred _loop0_126")); } _res = NULL; done: @@ -28751,9 +29238,9 @@ _gather_123_rule(Parser *p) return _res; } -// _loop0_125: (',' star_target) +// _loop0_127: (',' star_target) static asdl_seq * -_loop0_125_rule(Parser *p) +_loop0_127_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28777,13 +29264,13 @@ _loop0_125_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_125[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_192_var; + D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_198_var; while ( - (_tmp_192_var = _tmp_192_rule(p)) // ',' star_target + (_tmp_198_var = _tmp_198_rule(p)) // ',' star_target ) { - _res = _tmp_192_var; + _res = _tmp_198_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28799,7 +29286,7 @@ _loop0_125_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_125[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_127[%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); @@ -28812,14 +29299,14 @@ _loop0_125_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_125_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_127_type, _seq); D(p->level--); return _seq; } -// _loop0_127: ',' star_target +// _loop0_129: ',' star_target static asdl_seq * -_loop0_127_rule(Parser *p) +_loop0_129_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28843,7 +29330,7 @@ _loop0_127_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _loop0_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty elem; while ( @@ -28874,7 +29361,7 @@ _loop0_127_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_127[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_129[%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); @@ -28887,14 +29374,14 @@ _loop0_127_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_127_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_129_type, _seq); D(p->level--); return _seq; } -// _gather_126: star_target _loop0_127 +// _gather_128: star_target _loop0_129 static asdl_seq * -_gather_126_rule(Parser *p) +_gather_128_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28903,27 +29390,27 @@ _gather_126_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // star_target _loop0_127 + { // star_target _loop0_129 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_126[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_127")); + D(fprintf(stderr, "%*c> _gather_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_target _loop0_129")); expr_ty elem; asdl_seq * seq; if ( (elem = star_target_rule(p)) // star_target && - (seq = _loop0_127_rule(p)) // _loop0_127 + (seq = _loop0_129_rule(p)) // _loop0_129 ) { - D(fprintf(stderr, "%*c+ _gather_126[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_127")); + D(fprintf(stderr, "%*c+ _gather_128[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_target _loop0_129")); _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, "star_target _loop0_127")); + D(fprintf(stderr, "%*c%s _gather_128[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_target _loop0_129")); } _res = NULL; done: @@ -28931,9 +29418,9 @@ _gather_126_rule(Parser *p) return _res; } -// _loop1_128: (',' star_target) +// _loop1_130: (',' star_target) static asdl_seq * -_loop1_128_rule(Parser *p) +_loop1_130_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -28957,13 +29444,13 @@ _loop1_128_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_128[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_193_var; + D(fprintf(stderr, "%*c> _loop1_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); + void *_tmp_199_var; while ( - (_tmp_193_var = _tmp_193_rule(p)) // ',' star_target + (_tmp_199_var = _tmp_199_rule(p)) // ',' star_target ) { - _res = _tmp_193_var; + _res = _tmp_199_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28979,7 +29466,7 @@ _loop1_128_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_128[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_130[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(',' star_target)")); } if (_n == 0 || p->error_indicator) { @@ -28997,14 +29484,14 @@ _loop1_128_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_128_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_130_type, _seq); D(p->level--); return _seq; } -// _tmp_129: !'*' star_target +// _tmp_131: !'*' star_target static void * -_tmp_129_rule(Parser *p) +_tmp_131_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29018,7 +29505,7 @@ _tmp_129_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_129[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c> _tmp_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); expr_ty star_target_var; if ( _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 16) // token='*' @@ -29026,12 +29513,12 @@ _tmp_129_rule(Parser *p) (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_129[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!'*' star_target")); + D(fprintf(stderr, "%*c+ _tmp_131[%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 _tmp_129[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_131[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "!'*' star_target")); } _res = NULL; @@ -29040,9 +29527,9 @@ _tmp_129_rule(Parser *p) return _res; } -// _loop0_131: ',' del_target +// _loop0_133: ',' del_target static asdl_seq * -_loop0_131_rule(Parser *p) +_loop0_133_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29066,7 +29553,7 @@ _loop0_131_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_131[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); + D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' del_target")); Token * _literal; expr_ty elem; while ( @@ -29097,7 +29584,7 @@ _loop0_131_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_131[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' del_target")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -29110,14 +29597,14 @@ _loop0_131_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_131_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_133_type, _seq); D(p->level--); return _seq; } -// _gather_130: del_target _loop0_131 +// _gather_132: del_target _loop0_133 static asdl_seq * -_gather_130_rule(Parser *p) +_gather_132_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29126,27 +29613,27 @@ _gather_130_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // del_target _loop0_131 + { // del_target _loop0_133 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_131")); + D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "del_target _loop0_133")); expr_ty elem; asdl_seq * seq; if ( (elem = del_target_rule(p)) // del_target && - (seq = _loop0_131_rule(p)) // _loop0_131 + (seq = _loop0_133_rule(p)) // _loop0_133 ) { - D(fprintf(stderr, "%*c+ _gather_130[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_131")); + D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "del_target _loop0_133")); _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, "del_target _loop0_131")); + D(fprintf(stderr, "%*c%s _gather_132[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "del_target _loop0_133")); } _res = NULL; done: @@ -29154,9 +29641,9 @@ _gather_130_rule(Parser *p) return _res; } -// _loop0_133: ',' expression +// _loop0_135: ',' expression static asdl_seq * -_loop0_133_rule(Parser *p) +_loop0_135_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29180,7 +29667,7 @@ _loop0_133_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_133[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty elem; while ( @@ -29211,7 +29698,7 @@ _loop0_133_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_133[%d-%d]: %s failed!\n", p->level, ' ', + 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); @@ -29224,14 +29711,14 @@ _loop0_133_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_133_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_135_type, _seq); D(p->level--); return _seq; } -// _gather_132: expression _loop0_133 +// _gather_134: expression _loop0_135 static asdl_seq * -_gather_132_rule(Parser *p) +_gather_134_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29240,27 +29727,27 @@ _gather_132_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_133 + { // expression _loop0_135 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_132[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_133")); + 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 = expression_rule(p)) // expression && - (seq = _loop0_133_rule(p)) // _loop0_133 + (seq = _loop0_135_rule(p)) // _loop0_135 ) { - D(fprintf(stderr, "%*c+ _gather_132[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_133")); + 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_132[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_133")); + 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: @@ -29268,9 +29755,9 @@ _gather_132_rule(Parser *p) return _res; } -// _loop0_135: ',' expression +// _loop0_137: ',' expression static asdl_seq * -_loop0_135_rule(Parser *p) +_loop0_137_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29294,7 +29781,7 @@ _loop0_135_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_135[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty elem; while ( @@ -29325,7 +29812,7 @@ _loop0_135_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_135[%d-%d]: %s failed!\n", p->level, ' ', + 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); @@ -29338,14 +29825,14 @@ _loop0_135_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_135_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_137_type, _seq); D(p->level--); return _seq; } -// _gather_134: expression _loop0_135 +// _gather_136: expression _loop0_137 static asdl_seq * -_gather_134_rule(Parser *p) +_gather_136_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29354,27 +29841,27 @@ _gather_134_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_135 + { // expression _loop0_137 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_134[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_135")); + 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 ( (elem = expression_rule(p)) // expression && - (seq = _loop0_135_rule(p)) // _loop0_135 + (seq = _loop0_137_rule(p)) // _loop0_137 ) { - D(fprintf(stderr, "%*c+ _gather_134[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_135")); + 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 _gather_134[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_135")); + 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: @@ -29382,9 +29869,9 @@ _gather_134_rule(Parser *p) return _res; } -// _loop0_137: ',' expression +// _loop0_139: ',' expression static asdl_seq * -_loop0_137_rule(Parser *p) +_loop0_139_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29408,7 +29895,7 @@ _loop0_137_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_137[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty elem; while ( @@ -29439,7 +29926,7 @@ _loop0_137_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_137[%d-%d]: %s failed!\n", p->level, ' ', + 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); @@ -29452,14 +29939,14 @@ _loop0_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, _loop0_137_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_139_type, _seq); D(p->level--); return _seq; } -// _gather_136: expression _loop0_137 +// _gather_138: expression _loop0_139 static asdl_seq * -_gather_136_rule(Parser *p) +_gather_138_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29468,27 +29955,27 @@ _gather_136_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_137 + { // expression _loop0_139 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_136[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_137")); + 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 = expression_rule(p)) // expression && - (seq = _loop0_137_rule(p)) // _loop0_137 + (seq = _loop0_139_rule(p)) // _loop0_139 ) { - D(fprintf(stderr, "%*c+ _gather_136[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_137")); + 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_136[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_137")); + 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: @@ -29496,9 +29983,9 @@ _gather_136_rule(Parser *p) return _res; } -// _loop0_139: ',' expression +// _loop0_141: ',' expression static asdl_seq * -_loop0_139_rule(Parser *p) +_loop0_141_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29522,7 +30009,7 @@ _loop0_139_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_139[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _loop0_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty elem; while ( @@ -29553,7 +30040,7 @@ _loop0_139_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_139[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_141[%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); @@ -29566,14 +30053,14 @@ _loop0_139_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_139_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_141_type, _seq); D(p->level--); return _seq; } -// _gather_138: expression _loop0_139 +// _gather_140: expression _loop0_141 static asdl_seq * -_gather_138_rule(Parser *p) +_gather_140_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29582,27 +30069,27 @@ _gather_138_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // expression _loop0_139 + { // expression _loop0_141 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_138[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_139")); + D(fprintf(stderr, "%*c> _gather_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression _loop0_141")); expr_ty elem; asdl_seq * seq; if ( (elem = expression_rule(p)) // expression && - (seq = _loop0_139_rule(p)) // _loop0_139 + (seq = _loop0_141_rule(p)) // _loop0_141 ) { - D(fprintf(stderr, "%*c+ _gather_138[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_139")); + D(fprintf(stderr, "%*c+ _gather_140[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression _loop0_141")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_138[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_139")); + D(fprintf(stderr, "%*c%s _gather_140[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression _loop0_141")); } _res = NULL; done: @@ -29610,9 +30097,9 @@ _gather_138_rule(Parser *p) return _res; } -// _tmp_140: NEWLINE INDENT +// _tmp_142: NEWLINE INDENT static void * -_tmp_140_rule(Parser *p) +_tmp_142_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29626,7 +30113,7 @@ _tmp_140_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_140[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); + D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE INDENT")); Token * indent_var; Token * newline_var; if ( @@ -29635,12 +30122,12 @@ _tmp_140_rule(Parser *p) (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")); + D(fprintf(stderr, "%*c+ _tmp_142[%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, ' ', + D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE INDENT")); } _res = NULL; @@ -29649,9 +30136,9 @@ _tmp_140_rule(Parser *p) return _res; } -// _tmp_141: args | expression for_if_clauses +// _tmp_143: args | expression for_if_clauses static void * -_tmp_141_rule(Parser *p) +_tmp_143_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29665,18 +30152,18 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "args")); expr_ty args_var; if ( (args_var = args_rule(p)) // args ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "args")); _res = args_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "args")); } { // expression for_if_clauses @@ -29684,7 +30171,7 @@ _tmp_141_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_141[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); expr_ty expression_var; asdl_comprehension_seq* for_if_clauses_var; if ( @@ -29693,12 +30180,12 @@ _tmp_141_rule(Parser *p) (for_if_clauses_var = for_if_clauses_rule(p)) // for_if_clauses ) { - D(fprintf(stderr, "%*c+ _tmp_141[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); + D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression for_if_clauses")); _res = _PyPegen_dummy_name(p, expression_var, for_if_clauses_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_141[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression for_if_clauses")); } _res = NULL; @@ -29707,9 +30194,9 @@ _tmp_141_rule(Parser *p) return _res; } -// _tmp_142: 'True' | 'False' | 'None' +// _tmp_144: 'True' | 'False' | 'None' static void * -_tmp_142_rule(Parser *p) +_tmp_144_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29723,18 +30210,18 @@ _tmp_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 597)) // token='True' + (_keyword = _PyPegen_expect_token(p, 600)) // token='True' ) { - D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); } { // 'False' @@ -29742,18 +30229,18 @@ _tmp_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 599)) // token='False' + (_keyword = _PyPegen_expect_token(p, 602)) // token='False' ) { - D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); } { // 'None' @@ -29761,18 +30248,18 @@ _tmp_142_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_142[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 598)) // token='None' + (_keyword = _PyPegen_expect_token(p, 601)) // token='None' ) { - D(fprintf(stderr, "%*c+ _tmp_142[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_142[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); } _res = NULL; @@ -29781,9 +30268,9 @@ _tmp_142_rule(Parser *p) return _res; } -// _tmp_143: NAME '=' +// _tmp_145: NAME '=' static void * -_tmp_143_rule(Parser *p) +_tmp_145_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29797,7 +30284,7 @@ _tmp_143_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_143[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='")); + D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME '='")); Token * _literal; expr_ty name_var; if ( @@ -29806,12 +30293,12 @@ _tmp_143_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_143[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='")); + D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME '='")); _res = _PyPegen_dummy_name(p, name_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_143[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME '='")); } _res = NULL; @@ -29820,9 +30307,9 @@ _tmp_143_rule(Parser *p) return _res; } -// _tmp_144: NAME STRING | SOFT_KEYWORD +// _tmp_146: NAME STRING | SOFT_KEYWORD static void * -_tmp_144_rule(Parser *p) +_tmp_146_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29836,7 +30323,7 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NAME STRING")); expr_ty name_var; expr_ty string_var; if ( @@ -29845,12 +30332,12 @@ _tmp_144_rule(Parser *p) (string_var = _PyPegen_string_token(p)) // STRING ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "NAME STRING")); _res = _PyPegen_dummy_name(p, name_var, string_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NAME STRING")); } { // SOFT_KEYWORD @@ -29858,18 +30345,18 @@ _tmp_144_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_144[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); + D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); expr_ty soft_keyword_var; if ( (soft_keyword_var = _PyPegen_soft_keyword_token(p)) // SOFT_KEYWORD ) { - D(fprintf(stderr, "%*c+ _tmp_144[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); + D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "SOFT_KEYWORD")); _res = soft_keyword_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_144[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "SOFT_KEYWORD")); } _res = NULL; @@ -29878,9 +30365,9 @@ _tmp_144_rule(Parser *p) return _res; } -// _tmp_145: 'else' | ':' +// _tmp_147: 'else' | ':' static void * -_tmp_145_rule(Parser *p) +_tmp_147_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29894,18 +30381,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'")); + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 630)) // token='else' + (_keyword = _PyPegen_expect_token(p, 640)) // token='else' ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'")); + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else'")); } { // ':' @@ -29913,18 +30400,18 @@ _tmp_145_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_145[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_145[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_145[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } _res = NULL; @@ -29933,9 +30420,9 @@ _tmp_145_rule(Parser *p) return _res; } -// _tmp_146: '=' | ':=' +// _tmp_148: '=' | ':=' static void * -_tmp_146_rule(Parser *p) +_tmp_148_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -29949,18 +30436,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } { // ':=' @@ -29968,18 +30455,18 @@ _tmp_146_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_146[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 53)) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_146[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_146[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='")); } _res = NULL; @@ -29988,9 +30475,9 @@ _tmp_146_rule(Parser *p) return _res; } -// _tmp_147: list | tuple | genexp | 'True' | 'None' | 'False' +// _tmp_149: list | tuple | genexp | 'True' | 'None' | 'False' static void * -_tmp_147_rule(Parser *p) +_tmp_149_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30004,18 +30491,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c> _tmp_149[%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_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "list")); + D(fprintf(stderr, "%*c+ _tmp_149[%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_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "list")); } { // tuple @@ -30023,18 +30510,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c> _tmp_149[%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_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "tuple")); + D(fprintf(stderr, "%*c+ _tmp_149[%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_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "tuple")); } { // genexp @@ -30042,18 +30529,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c> _tmp_149[%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_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "genexp")); + D(fprintf(stderr, "%*c+ _tmp_149[%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_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "genexp")); } { // 'True' @@ -30061,18 +30548,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'True'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 597)) // token='True' + (_keyword = _PyPegen_expect_token(p, 600)) // token='True' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'True'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'True'")); } { // 'None' @@ -30080,18 +30567,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'None'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 598)) // token='None' + (_keyword = _PyPegen_expect_token(p, 601)) // token='None' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'None'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'None'")); } { // 'False' @@ -30099,18 +30586,18 @@ _tmp_147_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c> _tmp_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'False'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 599)) // token='False' + (_keyword = _PyPegen_expect_token(p, 602)) // token='False' ) { - D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); + D(fprintf(stderr, "%*c+ _tmp_149[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'False'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_147[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_149[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'False'")); } _res = NULL; @@ -30119,9 +30606,9 @@ _tmp_147_rule(Parser *p) return _res; } -// _tmp_148: '=' | ':=' +// _tmp_150: '=' | ':=' static void * -_tmp_148_rule(Parser *p) +_tmp_150_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30135,18 +30622,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'='")); } { // ':=' @@ -30154,18 +30641,18 @@ _tmp_148_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_148[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c> _tmp_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':='")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 53)) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_148[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); + D(fprintf(stderr, "%*c+ _tmp_150[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':='")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_148[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_150[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':='")); } _res = NULL; @@ -30174,9 +30661,9 @@ _tmp_148_rule(Parser *p) return _res; } -// _loop0_149: star_named_expressions +// _loop0_151: star_named_expressions static asdl_seq * -_loop0_149_rule(Parser *p) +_loop0_151_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30200,7 +30687,7 @@ _loop0_149_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_149[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); + D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_named_expressions")); asdl_expr_seq* star_named_expressions_var; while ( (star_named_expressions_var = star_named_expressions_rule(p)) // star_named_expressions @@ -30222,7 +30709,7 @@ _loop0_149_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_149[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_named_expressions")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -30235,14 +30722,14 @@ _loop0_149_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_149_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_151_type, _seq); D(p->level--); return _seq; } -// _loop0_150: (star_targets '=') +// _loop0_152: (star_targets '=') static asdl_seq * -_loop0_150_rule(Parser *p) +_loop0_152_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30266,13 +30753,13 @@ _loop0_150_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_150[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_194_var; + D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_200_var; while ( - (_tmp_194_var = _tmp_194_rule(p)) // star_targets '=' + (_tmp_200_var = _tmp_200_rule(p)) // star_targets '=' ) { - _res = _tmp_194_var; + _res = _tmp_200_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -30288,7 +30775,7 @@ _loop0_150_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_150[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_152[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -30301,14 +30788,14 @@ _loop0_150_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_150_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_152_type, _seq); D(p->level--); return _seq; } -// _loop0_151: (star_targets '=') +// _loop0_153: (star_targets '=') static asdl_seq * -_loop0_151_rule(Parser *p) +_loop0_153_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30332,13 +30819,13 @@ _loop0_151_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_151[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_195_var; + D(fprintf(stderr, "%*c> _loop0_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); + void *_tmp_201_var; while ( - (_tmp_195_var = _tmp_195_rule(p)) // star_targets '=' + (_tmp_201_var = _tmp_201_rule(p)) // star_targets '=' ) { - _res = _tmp_195_var; + _res = _tmp_201_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -30354,7 +30841,7 @@ _loop0_151_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_151[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_153[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(star_targets '=')")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -30367,14 +30854,14 @@ _loop0_151_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_151_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_153_type, _seq); D(p->level--); return _seq; } -// _tmp_152: yield_expr | star_expressions +// _tmp_154: yield_expr | star_expressions static void * -_tmp_152_rule(Parser *p) +_tmp_154_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30388,18 +30875,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c> _tmp_154[%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_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "yield_expr")); + D(fprintf(stderr, "%*c+ _tmp_154[%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_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "yield_expr")); } { // star_expressions @@ -30407,18 +30894,18 @@ _tmp_152_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c> _tmp_154[%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_152[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_expressions")); + D(fprintf(stderr, "%*c+ _tmp_154[%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_152[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_expressions")); } _res = NULL; @@ -30427,9 +30914,9 @@ _tmp_152_rule(Parser *p) return _res; } -// _tmp_153: '[' | '(' | '{' +// _tmp_155: '[' | '(' | '{' static void * -_tmp_153_rule(Parser *p) +_tmp_155_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30443,18 +30930,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '(' @@ -30462,18 +30949,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'('")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'('")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'('")); } { // '{' @@ -30481,18 +30968,18 @@ _tmp_153_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_153[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_153[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -30501,9 +30988,9 @@ _tmp_153_rule(Parser *p) return _res; } -// _tmp_154: '[' | '{' +// _tmp_156: '[' | '{' static void * -_tmp_154_rule(Parser *p) +_tmp_156_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30517,18 +31004,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '{' @@ -30536,18 +31023,18 @@ _tmp_154_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_154[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_154[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_156[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_154[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_156[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -30556,9 +31043,9 @@ _tmp_154_rule(Parser *p) return _res; } -// _tmp_155: '[' | '{' +// _tmp_157: '[' | '{' static void * -_tmp_155_rule(Parser *p) +_tmp_157_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30572,18 +31059,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'['")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 9)) // token='[' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'['")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'['")); } { // '{' @@ -30591,18 +31078,18 @@ _tmp_155_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_155[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c> _tmp_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'{'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 25)) // token='{' ) { - D(fprintf(stderr, "%*c+ _tmp_155[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); + D(fprintf(stderr, "%*c+ _tmp_157[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'{'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_155[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_157[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'{'")); } _res = NULL; @@ -30611,9 +31098,9 @@ _tmp_155_rule(Parser *p) return _res; } -// _loop0_156: param_no_default +// _loop0_158: param_no_default static asdl_seq * -_loop0_156_rule(Parser *p) +_loop0_158_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30637,7 +31124,7 @@ _loop0_156_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_156[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_no_default")); + D(fprintf(stderr, "%*c> _loop0_158[%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 @@ -30659,7 +31146,7 @@ _loop0_156_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_156[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_158[%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); @@ -30672,14 +31159,14 @@ _loop0_156_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_156_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_158_type, _seq); D(p->level--); return _seq; } -// _loop1_157: param_with_default +// _loop1_159: param_with_default static asdl_seq * -_loop1_157_rule(Parser *p) +_loop1_159_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30703,7 +31190,7 @@ _loop1_157_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_157[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "param_with_default")); + D(fprintf(stderr, "%*c> _loop1_159[%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 @@ -30725,7 +31212,7 @@ _loop1_157_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_157[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_159[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -30743,14 +31230,14 @@ _loop1_157_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_157_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_159_type, _seq); D(p->level--); return _seq; } -// _loop0_158: lambda_param_no_default +// _loop0_160: lambda_param_no_default static asdl_seq * -_loop0_158_rule(Parser *p) +_loop0_160_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30774,7 +31261,7 @@ _loop0_158_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_158[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_no_default")); + D(fprintf(stderr, "%*c> _loop0_160[%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 @@ -30796,7 +31283,7 @@ _loop0_158_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_158[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_160[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_no_default")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -30809,14 +31296,14 @@ _loop0_158_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_158_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_160_type, _seq); D(p->level--); return _seq; } -// _loop1_159: lambda_param_with_default +// _loop1_161: lambda_param_with_default static asdl_seq * -_loop1_159_rule(Parser *p) +_loop1_161_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30840,7 +31327,7 @@ _loop1_159_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop1_159[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "lambda_param_with_default")); + D(fprintf(stderr, "%*c> _loop1_161[%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 @@ -30862,7 +31349,7 @@ _loop1_159_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop1_159[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop1_161[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "lambda_param_with_default")); } if (_n == 0 || p->error_indicator) { @@ -30880,14 +31367,14 @@ _loop1_159_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_159_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop1_161_type, _seq); D(p->level--); return _seq; } -// _tmp_160: ')' | ',' (')' | '**') +// _tmp_162: ')' | ',' (')' | '**') static void * -_tmp_160_rule(Parser *p) +_tmp_162_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30901,18 +31388,18 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ',' (')' | '**') @@ -30920,21 +31407,21 @@ _tmp_160_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_160[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_196_var; + void *_tmp_202_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_196_var = _tmp_196_rule(p)) // ')' | '**' + (_tmp_202_var = _tmp_202_rule(p)) // ')' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_160[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_196_var); + D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_202_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_160[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (')' | '**')")); } _res = NULL; @@ -30943,9 +31430,9 @@ _tmp_160_rule(Parser *p) return _res; } -// _tmp_161: ':' | ',' (':' | '**') +// _tmp_163: ':' | ',' (':' | '**') static void * -_tmp_161_rule(Parser *p) +_tmp_163_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -30959,18 +31446,18 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // ',' (':' | '**') @@ -30978,21 +31465,21 @@ _tmp_161_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_161[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_197_var; + void *_tmp_203_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_197_var = _tmp_197_rule(p)) // ':' | '**' + (_tmp_203_var = _tmp_203_rule(p)) // ':' | '**' ) { - D(fprintf(stderr, "%*c+ _tmp_161[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_197_var); + D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); + _res = _PyPegen_dummy_name(p, _literal, _tmp_203_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_161[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_163[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (':' | '**')")); } _res = NULL; @@ -31001,9 +31488,9 @@ _tmp_161_rule(Parser *p) return _res; } -// _tmp_162: ',' | ')' | ':' +// _tmp_164: ',' | ')' | ':' static void * -_tmp_162_rule(Parser *p) +_tmp_164_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31017,18 +31504,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); } { // ')' @@ -31036,18 +31523,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // ':' @@ -31055,18 +31542,18 @@ _tmp_162_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_164[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_162[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_164[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } _res = NULL; @@ -31075,9 +31562,9 @@ _tmp_162_rule(Parser *p) return _res; } -// _loop0_164: ',' (expression ['as' star_target]) +// _loop0_166: ',' (expression ['as' star_target]) static asdl_seq * -_loop0_164_rule(Parser *p) +_loop0_166_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31101,13 +31588,13 @@ _loop0_164_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_164[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_198_rule(p)) // expression ['as' star_target] + (elem = _tmp_204_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -31132,7 +31619,7 @@ _loop0_164_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_164[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -31145,14 +31632,14 @@ _loop0_164_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_164_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_166_type, _seq); D(p->level--); return _seq; } -// _gather_163: (expression ['as' star_target]) _loop0_164 +// _gather_165: (expression ['as' star_target]) _loop0_166 static asdl_seq * -_gather_163_rule(Parser *p) +_gather_165_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31161,27 +31648,27 @@ _gather_163_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expression ['as' star_target]) _loop0_164 + { // (expression ['as' star_target]) _loop0_166 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164")); + D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_166")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_198_rule(p)) // expression ['as' star_target] + (elem = _tmp_204_rule(p)) // expression ['as' star_target] && - (seq = _loop0_164_rule(p)) // _loop0_164 + (seq = _loop0_166_rule(p)) // _loop0_166 ) { - D(fprintf(stderr, "%*c+ _gather_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_164")); + D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_166")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_163[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_164")); + D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_166")); } _res = NULL; done: @@ -31189,9 +31676,9 @@ _gather_163_rule(Parser *p) return _res; } -// _loop0_166: ',' (expressions ['as' star_target]) +// _loop0_168: ',' (expressions ['as' star_target]) static asdl_seq * -_loop0_166_rule(Parser *p) +_loop0_168_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31215,13 +31702,13 @@ _loop0_166_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_166[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_199_rule(p)) // expressions ['as' star_target] + (elem = _tmp_205_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -31246,7 +31733,7 @@ _loop0_166_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_166[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -31259,14 +31746,14 @@ _loop0_166_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_166_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_168_type, _seq); D(p->level--); return _seq; } -// _gather_165: (expressions ['as' star_target]) _loop0_166 +// _gather_167: (expressions ['as' star_target]) _loop0_168 static asdl_seq * -_gather_165_rule(Parser *p) +_gather_167_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31275,27 +31762,27 @@ _gather_165_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expressions ['as' star_target]) _loop0_166 + { // (expressions ['as' star_target]) _loop0_168 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_165[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166")); + D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_168")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_199_rule(p)) // expressions ['as' star_target] + (elem = _tmp_205_rule(p)) // expressions ['as' star_target] && - (seq = _loop0_166_rule(p)) // _loop0_166 + (seq = _loop0_168_rule(p)) // _loop0_168 ) { - D(fprintf(stderr, "%*c+ _gather_165[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_166")); + D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_168")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_165[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_166")); + D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_168")); } _res = NULL; done: @@ -31303,9 +31790,9 @@ _gather_165_rule(Parser *p) return _res; } -// _loop0_168: ',' (expression ['as' star_target]) +// _loop0_170: ',' (expression ['as' star_target]) static asdl_seq * -_loop0_168_rule(Parser *p) +_loop0_170_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31329,13 +31816,13 @@ _loop0_168_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_168[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expression ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_200_rule(p)) // expression ['as' star_target] + (elem = _tmp_206_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -31360,7 +31847,7 @@ _loop0_168_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_168[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expression ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -31373,14 +31860,14 @@ _loop0_168_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_168_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_170_type, _seq); D(p->level--); return _seq; } -// _gather_167: (expression ['as' star_target]) _loop0_168 +// _gather_169: (expression ['as' star_target]) _loop0_170 static asdl_seq * -_gather_167_rule(Parser *p) +_gather_169_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31389,27 +31876,27 @@ _gather_167_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expression ['as' star_target]) _loop0_168 + { // (expression ['as' star_target]) _loop0_170 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_167[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168")); + D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_170")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_200_rule(p)) // expression ['as' star_target] + (elem = _tmp_206_rule(p)) // expression ['as' star_target] && - (seq = _loop0_168_rule(p)) // _loop0_168 + (seq = _loop0_170_rule(p)) // _loop0_170 ) { - D(fprintf(stderr, "%*c+ _gather_167[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_168")); + D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expression ['as' star_target]) _loop0_170")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_167[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_168")); + D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expression ['as' star_target]) _loop0_170")); } _res = NULL; done: @@ -31417,9 +31904,9 @@ _gather_167_rule(Parser *p) return _res; } -// _loop0_170: ',' (expressions ['as' star_target]) +// _loop0_172: ',' (expressions ['as' star_target]) static asdl_seq * -_loop0_170_rule(Parser *p) +_loop0_172_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31443,13 +31930,13 @@ _loop0_170_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_170[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); + D(fprintf(stderr, "%*c> _loop0_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (expressions ['as' star_target])")); Token * _literal; void *elem; while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_201_rule(p)) // expressions ['as' star_target] + (elem = _tmp_207_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -31474,7 +31961,7 @@ _loop0_170_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_170[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_172[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' (expressions ['as' star_target])")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -31487,14 +31974,14 @@ _loop0_170_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_170_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_172_type, _seq); D(p->level--); return _seq; } -// _gather_169: (expressions ['as' star_target]) _loop0_170 +// _gather_171: (expressions ['as' star_target]) _loop0_172 static asdl_seq * -_gather_169_rule(Parser *p) +_gather_171_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31503,27 +31990,27 @@ _gather_169_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // (expressions ['as' star_target]) _loop0_170 + { // (expressions ['as' star_target]) _loop0_172 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_169[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170")); + D(fprintf(stderr, "%*c> _gather_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_172")); void *elem; asdl_seq * seq; if ( - (elem = _tmp_201_rule(p)) // expressions ['as' star_target] + (elem = _tmp_207_rule(p)) // expressions ['as' star_target] && - (seq = _loop0_170_rule(p)) // _loop0_170 + (seq = _loop0_172_rule(p)) // _loop0_172 ) { - D(fprintf(stderr, "%*c+ _gather_169[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_170")); + D(fprintf(stderr, "%*c+ _gather_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(expressions ['as' star_target]) _loop0_172")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_169[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_170")); + D(fprintf(stderr, "%*c%s _gather_171[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(expressions ['as' star_target]) _loop0_172")); } _res = NULL; done: @@ -31531,9 +32018,9 @@ _gather_169_rule(Parser *p) return _res; } -// _tmp_171: 'except' | 'finally' +// _tmp_173: 'except' | 'finally' static void * -_tmp_171_rule(Parser *p) +_tmp_173_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31547,18 +32034,18 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 623)) // token='except' + (_keyword = _PyPegen_expect_token(p, 632)) // token='except' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except'")); } { // 'finally' @@ -31566,18 +32053,18 @@ _tmp_171_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_171[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'")); + D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 620)) // token='finally' + (_keyword = _PyPegen_expect_token(p, 628)) // token='finally' ) { - D(fprintf(stderr, "%*c+ _tmp_171[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'")); + D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'")); _res = _keyword; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_171[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'finally'")); } _res = NULL; @@ -31586,9 +32073,9 @@ _tmp_171_rule(Parser *p) return _res; } -// _tmp_172: 'as' NAME +// _tmp_174: 'as' NAME static void * -_tmp_172_rule(Parser *p) +_tmp_174_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31602,21 +32089,21 @@ _tmp_172_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_172[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; expr_ty name_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_172[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); _res = _PyPegen_dummy_name(p, _keyword, name_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_172[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; @@ -31625,9 +32112,9 @@ _tmp_172_rule(Parser *p) return _res; } -// _tmp_173: 'as' NAME +// _tmp_175: 'as' NAME static void * -_tmp_173_rule(Parser *p) +_tmp_175_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31641,21 +32128,21 @@ _tmp_173_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; expr_ty name_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); _res = _PyPegen_dummy_name(p, _keyword, name_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_173[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; @@ -31664,9 +32151,9 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: 'as' NAME +// _tmp_176: 'as' NAME static void * -_tmp_174_rule(Parser *p) +_tmp_176_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31680,21 +32167,21 @@ _tmp_174_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); Token * _keyword; expr_ty name_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); _res = _PyPegen_dummy_name(p, _keyword, name_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; @@ -31703,9 +32190,181 @@ _tmp_174_rule(Parser *p) return _res; } -// _tmp_175: positional_patterns ',' +// _tmp_177: 'as' NAME static void * -_tmp_175_rule(Parser *p) +_tmp_177_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_178: NEWLINE | ':' +static void * +_tmp_178_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // NEWLINE + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_178[%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_178[%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_178[%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_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_179: 'as' NAME +static void * +_tmp_179_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_180: 'as' NAME +static void * +_tmp_180_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_181: positional_patterns ',' +static void * +_tmp_181_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31719,7 +32378,7 @@ _tmp_175_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); Token * _literal; asdl_pattern_seq* positional_patterns_var; if ( @@ -31728,12 +32387,12 @@ _tmp_175_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','")); } _res = NULL; @@ -31742,9 +32401,9 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: '->' expression +// _tmp_182: '->' expression static void * -_tmp_176_rule(Parser *p) +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31758,7 +32417,7 @@ _tmp_176_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty expression_var; if ( @@ -31767,12 +32426,12 @@ _tmp_176_rule(Parser *p) (expression_var = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = _PyPegen_dummy_name(p, _literal, expression_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -31781,9 +32440,9 @@ _tmp_176_rule(Parser *p) return _res; } -// _tmp_177: '(' arguments? ')' +// _tmp_183: '(' arguments? ')' static void * -_tmp_177_rule(Parser *p) +_tmp_183_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31797,7 +32456,7 @@ _tmp_177_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_177[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -31810,12 +32469,12 @@ _tmp_177_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_177[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_177[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -31824,9 +32483,9 @@ _tmp_177_rule(Parser *p) return _res; } -// _loop0_179: ',' double_starred_kvpair +// _loop0_185: ',' double_starred_kvpair static asdl_seq * -_loop0_179_rule(Parser *p) +_loop0_185_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31850,7 +32509,7 @@ _loop0_179_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -31881,7 +32540,7 @@ _loop0_179_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_179[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_185[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -31894,14 +32553,14 @@ _loop0_179_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_179_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_185_type, _seq); D(p->level--); return _seq; } -// _gather_178: double_starred_kvpair _loop0_179 +// _gather_184: double_starred_kvpair _loop0_185 static asdl_seq * -_gather_178_rule(Parser *p) +_gather_184_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31910,27 +32569,27 @@ _gather_178_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_179 + { // double_starred_kvpair _loop0_185 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179")); + D(fprintf(stderr, "%*c> _gather_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_185")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_179_rule(p)) // _loop0_179 + (seq = _loop0_185_rule(p)) // _loop0_185 ) { - D(fprintf(stderr, "%*c+ _gather_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_179")); + D(fprintf(stderr, "%*c+ _gather_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_185")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_178[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_179")); + D(fprintf(stderr, "%*c%s _gather_184[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_185")); } _res = NULL; done: @@ -31938,9 +32597,9 @@ _gather_178_rule(Parser *p) return _res; } -// _tmp_180: '}' | ',' +// _tmp_186: '}' | ',' static void * -_tmp_180_rule(Parser *p) +_tmp_186_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -31954,18 +32613,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); } { // ',' @@ -31973,18 +32632,18 @@ _tmp_180_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_180[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_180[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_180[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); } _res = NULL; @@ -31993,9 +32652,9 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: star_targets '=' +// _tmp_187: star_targets '=' static void * -_tmp_181_rule(Parser *p) +_tmp_187_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32009,7 +32668,7 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -32018,7 +32677,7 @@ _tmp_181_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32028,7 +32687,7 @@ _tmp_181_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -32037,9 +32696,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: '.' | '...' +// _tmp_188: '.' | '...' static void * -_tmp_182_rule(Parser *p) +_tmp_188_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32053,18 +32712,18 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -32072,18 +32731,18 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -32092,9 +32751,9 @@ _tmp_182_rule(Parser *p) return _res; } -// _tmp_183: '.' | '...' +// _tmp_189: '.' | '...' static void * -_tmp_183_rule(Parser *p) +_tmp_189_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32108,18 +32767,18 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -32127,18 +32786,18 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -32147,9 +32806,9 @@ _tmp_183_rule(Parser *p) return _res; } -// _tmp_184: '@' named_expression NEWLINE +// _tmp_190: '@' named_expression NEWLINE static void * -_tmp_184_rule(Parser *p) +_tmp_190_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32163,7 +32822,7 @@ _tmp_184_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -32175,7 +32834,7 @@ _tmp_184_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32185,7 +32844,7 @@ _tmp_184_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -32194,9 +32853,9 @@ _tmp_184_rule(Parser *p) return _res; } -// _tmp_185: ',' expression +// _tmp_191: ',' expression static void * -_tmp_185_rule(Parser *p) +_tmp_191_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32210,7 +32869,7 @@ _tmp_185_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -32219,7 +32878,7 @@ _tmp_185_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32229,7 +32888,7 @@ _tmp_185_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_185[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -32238,9 +32897,9 @@ _tmp_185_rule(Parser *p) return _res; } -// _tmp_186: ',' star_expression +// _tmp_192: ',' star_expression static void * -_tmp_186_rule(Parser *p) +_tmp_192_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32254,7 +32913,7 @@ _tmp_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -32263,7 +32922,7 @@ _tmp_186_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32273,7 +32932,7 @@ _tmp_186_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -32282,9 +32941,9 @@ _tmp_186_rule(Parser *p) return _res; } -// _tmp_187: 'or' conjunction +// _tmp_193: 'or' conjunction static void * -_tmp_187_rule(Parser *p) +_tmp_193_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32298,16 +32957,16 @@ _tmp_187_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 571)) // token='or' + (_keyword = _PyPegen_expect_token(p, 574)) // token='or' && (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32317,7 +32976,7 @@ _tmp_187_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -32326,9 +32985,9 @@ _tmp_187_rule(Parser *p) return _res; } -// _tmp_188: 'and' inversion +// _tmp_194: 'and' inversion static void * -_tmp_188_rule(Parser *p) +_tmp_194_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32342,16 +33001,16 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 572)) // token='and' + (_keyword = _PyPegen_expect_token(p, 575)) // token='and' && (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32361,7 +33020,7 @@ _tmp_188_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -32370,9 +33029,9 @@ _tmp_188_rule(Parser *p) return _res; } -// _tmp_189: 'if' disjunction +// _tmp_195: 'if' disjunction static void * -_tmp_189_rule(Parser *p) +_tmp_195_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32386,16 +33045,16 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32405,7 +33064,7 @@ _tmp_189_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -32414,9 +33073,9 @@ _tmp_189_rule(Parser *p) return _res; } -// _tmp_190: 'if' disjunction +// _tmp_196: 'if' disjunction static void * -_tmp_190_rule(Parser *p) +_tmp_196_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32430,16 +33089,16 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 627)) // token='if' + (_keyword = _PyPegen_expect_token(p, 637)) // token='if' && (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32449,7 +33108,7 @@ _tmp_190_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -32458,9 +33117,9 @@ _tmp_190_rule(Parser *p) return _res; } -// _tmp_191: starred_expression | (assignment_expression | expression !':=') !'=' +// _tmp_197: starred_expression | (assignment_expression | expression !':=') !'=' static void * -_tmp_191_rule(Parser *p) +_tmp_197_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32474,18 +33133,18 @@ _tmp_191_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); expr_ty starred_expression_var; if ( (starred_expression_var = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); _res = starred_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // (assignment_expression | expression !':=') !'=' @@ -32493,20 +33152,20 @@ _tmp_191_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); - void *_tmp_202_var; + D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); + void *_tmp_208_var; if ( - (_tmp_202_var = _tmp_202_rule(p)) // assignment_expression | expression !':=' + (_tmp_208_var = _tmp_208_rule(p)) // assignment_expression | expression !':=' && _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); - _res = _tmp_202_var; + D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); + _res = _tmp_208_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='")); } _res = NULL; @@ -32515,9 +33174,9 @@ _tmp_191_rule(Parser *p) return _res; } -// _tmp_192: ',' star_target +// _tmp_198: ',' star_target static void * -_tmp_192_rule(Parser *p) +_tmp_198_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32531,7 +33190,7 @@ _tmp_192_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -32540,7 +33199,7 @@ _tmp_192_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32550,7 +33209,7 @@ _tmp_192_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -32559,9 +33218,9 @@ _tmp_192_rule(Parser *p) return _res; } -// _tmp_193: ',' star_target +// _tmp_199: ',' star_target static void * -_tmp_193_rule(Parser *p) +_tmp_199_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32575,7 +33234,7 @@ _tmp_193_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -32584,7 +33243,7 @@ _tmp_193_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32594,7 +33253,7 @@ _tmp_193_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -32603,9 +33262,9 @@ _tmp_193_rule(Parser *p) return _res; } -// _tmp_194: star_targets '=' +// _tmp_200: star_targets '=' static void * -_tmp_194_rule(Parser *p) +_tmp_200_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32619,7 +33278,7 @@ _tmp_194_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -32628,12 +33287,12 @@ _tmp_194_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -32642,9 +33301,9 @@ _tmp_194_rule(Parser *p) return _res; } -// _tmp_195: star_targets '=' +// _tmp_201: star_targets '=' static void * -_tmp_195_rule(Parser *p) +_tmp_201_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32658,7 +33317,7 @@ _tmp_195_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -32667,12 +33326,12 @@ _tmp_195_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -32681,9 +33340,9 @@ _tmp_195_rule(Parser *p) return _res; } -// _tmp_196: ')' | '**' +// _tmp_202: ')' | '**' static void * -_tmp_196_rule(Parser *p) +_tmp_202_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32697,18 +33356,18 @@ _tmp_196_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -32716,18 +33375,18 @@ _tmp_196_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -32736,9 +33395,9 @@ _tmp_196_rule(Parser *p) return _res; } -// _tmp_197: ':' | '**' +// _tmp_203: ':' | '**' static void * -_tmp_197_rule(Parser *p) +_tmp_203_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32752,18 +33411,18 @@ _tmp_197_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -32771,18 +33430,18 @@ _tmp_197_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -32791,9 +33450,9 @@ _tmp_197_rule(Parser *p) return _res; } -// _tmp_198: expression ['as' star_target] +// _tmp_204: expression ['as' star_target] static void * -_tmp_198_rule(Parser *p) +_tmp_204_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32807,22 +33466,22 @@ _tmp_198_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_203_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_209_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); _res = _PyPegen_dummy_name(p, expression_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -32831,9 +33490,9 @@ _tmp_198_rule(Parser *p) return _res; } -// _tmp_199: expressions ['as' star_target] +// _tmp_205: expressions ['as' star_target] static void * -_tmp_199_rule(Parser *p) +_tmp_205_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32847,22 +33506,22 @@ _tmp_199_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expressions_var; if ( (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_204_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_210_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -32871,9 +33530,9 @@ _tmp_199_rule(Parser *p) return _res; } -// _tmp_200: expression ['as' star_target] +// _tmp_206: expression ['as' star_target] static void * -_tmp_200_rule(Parser *p) +_tmp_206_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32887,22 +33546,22 @@ _tmp_200_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_205_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_211_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); _res = _PyPegen_dummy_name(p, expression_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -32911,9 +33570,9 @@ _tmp_200_rule(Parser *p) return _res; } -// _tmp_201: expressions ['as' star_target] +// _tmp_207: expressions ['as' star_target] static void * -_tmp_201_rule(Parser *p) +_tmp_207_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32927,22 +33586,22 @@ _tmp_201_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_207[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expressions_var; if ( (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_206_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_212_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_207[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_207[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -32951,9 +33610,9 @@ _tmp_201_rule(Parser *p) return _res; } -// _tmp_202: assignment_expression | expression !':=' +// _tmp_208: assignment_expression | expression !':=' static void * -_tmp_202_rule(Parser *p) +_tmp_208_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32967,18 +33626,18 @@ _tmp_202_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c> _tmp_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); expr_ty assignment_expression_var; if ( (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression ) { - D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c+ _tmp_208[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); _res = assignment_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_208[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression")); } { // expression !':=' @@ -32986,7 +33645,7 @@ _tmp_202_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c> _tmp_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression @@ -32994,12 +33653,12 @@ _tmp_202_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c+ _tmp_208[%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_202[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_208[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); } _res = NULL; @@ -33008,9 +33667,9 @@ _tmp_202_rule(Parser *p) return _res; } -// _tmp_203: 'as' star_target +// _tmp_209: 'as' star_target static void * -_tmp_203_rule(Parser *p) +_tmp_209_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33024,21 +33683,21 @@ _tmp_203_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_209[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33047,9 +33706,9 @@ _tmp_203_rule(Parser *p) return _res; } -// _tmp_204: 'as' star_target +// _tmp_210: 'as' star_target static void * -_tmp_204_rule(Parser *p) +_tmp_210_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33063,21 +33722,21 @@ _tmp_204_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_210[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_210[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33086,9 +33745,9 @@ _tmp_204_rule(Parser *p) return _res; } -// _tmp_205: 'as' star_target +// _tmp_211: 'as' star_target static void * -_tmp_205_rule(Parser *p) +_tmp_211_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33102,21 +33761,21 @@ _tmp_205_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_211[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_211[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_211[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33125,9 +33784,9 @@ _tmp_205_rule(Parser *p) return _res; } -// _tmp_206: 'as' star_target +// _tmp_212: 'as' star_target static void * -_tmp_206_rule(Parser *p) +_tmp_212_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33141,21 +33800,21 @@ _tmp_206_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_212[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 625)) // token='as' + (_keyword = _PyPegen_expect_token(p, 635)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_212[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_212[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; diff --git a/Python/Python-ast.c b/Python/Python-ast.c index ce6e6a93ea70f0..f2dd52272aec61 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -243,6 +243,7 @@ void _PyAST_Fini(PyInterpreterState *interp) Py_CLEAR(state->right); Py_CLEAR(state->simple); Py_CLEAR(state->slice); + Py_CLEAR(state->star); Py_CLEAR(state->step); Py_CLEAR(state->stmt_type); Py_CLEAR(state->subject); @@ -341,6 +342,7 @@ static int init_identifiers(struct ast_state *state) if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 0; if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return 0; if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return 0; + if ((state->star = PyUnicode_InternFromString("star")) == NULL) return 0; if ((state->step = PyUnicode_InternFromString("step")) == NULL) return 0; if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return 0; if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return 0; @@ -485,6 +487,7 @@ static const char * const Try_fields[]={ "handlers", "orelse", "finalbody", + "star", }; static const char * const Assert_fields[]={ "test", @@ -1138,7 +1141,7 @@ init_types(struct ast_state *state) " | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" " | Match(expr subject, match_case* cases)\n" " | Raise(expr? exc, expr? cause)\n" - " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" + " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star)\n" " | Assert(expr test, expr? msg)\n" " | Import(alias* names)\n" " | ImportFrom(identifier? module, alias* names, int? level)\n" @@ -1251,8 +1254,8 @@ init_types(struct ast_state *state) return 0; if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1) return 0; - state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4, - "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)"); + state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 5, + "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star)"); if (!state->Try_type) return 0; state->Assert_type = make_type(state, "Assert", state->stmt_type, Assert_fields, 2, @@ -2360,8 +2363,9 @@ _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, - asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int - col_offset, int end_lineno, int end_col_offset, PyArena *arena) + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int star, int + lineno, int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2372,6 +2376,7 @@ _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, p->v.Try.handlers = handlers; p->v.Try.orelse = orelse; p->v.Try.finalbody = finalbody; + p->v.Try.star = star; p->lineno = lineno; p->col_offset = col_offset; p->end_lineno = end_lineno; @@ -4048,6 +4053,11 @@ ast2obj_stmt(struct ast_state *state, void* _o) if (PyObject_SetAttr(result, state->finalbody, value) == -1) goto failed; Py_DECREF(value); + value = ast2obj_int(state, o->v.Try.star); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->star, value) == -1) + goto failed; + Py_DECREF(value); break; case Assert_kind: tp = (PyTypeObject *)state->Assert_type; @@ -7323,6 +7333,7 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_excepthandler_seq* handlers; asdl_stmt_seq* orelse; asdl_stmt_seq* finalbody; + int star; if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { return 1; @@ -7472,7 +7483,24 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno, + if (_PyObject_LookupAttr(obj, state->star, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"star\" missing from Try"); + return 1; + } + else { + int res; + if (Py_EnterRecursiveCall(" while traversing 'Try' node")) { + goto failed; + } + res = obj2ast_int(state, tmp, &star, arena); + Py_LeaveRecursiveCall(); + if (res != 0) goto failed; + Py_CLEAR(tmp); + } + *out = _PyAST_Try(body, handlers, orelse, finalbody, star, lineno, col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; diff --git a/Python/ceval.c b/Python/ceval.c index bf4e22dc6fec46..78cc0c6f644165 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -36,6 +36,7 @@ #include "structmember.h" // struct PyMemberDef, T_OFFSET_EX #include +#include #ifdef Py_DEBUG /* For debugging the interpreter: */ @@ -93,6 +94,8 @@ static int import_all_from(PyThreadState *, PyObject *, PyObject *); static void format_exc_check_arg(PyThreadState *, PyObject *, const char *, PyObject *); static void format_exc_unbound(PyThreadState *tstate, PyCodeObject *co, int oparg); static int check_args_iterable(PyThreadState *, PyObject *func, PyObject *vararg); +static int check_except_type_valid(PyThreadState *tstate, PyObject* right); +static int check_except_star_type_valid(PyThreadState *tstate, PyObject* right); static void format_kwargs_error(PyThreadState *, PyObject *func, PyObject *kwargs); static void format_awaitable_error(PyThreadState *, PyTypeObject *, int, int); static int get_exception_handler(PyCodeObject *, int, int*, int*, int*); @@ -1063,6 +1066,11 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); +static PyObject* do_reraise_star(PyObject *excs, PyObject *orig); +static int exception_group_match( + PyObject *exc_type, PyObject* exc_value, PyObject *match_type, + PyObject **match, PyObject **rest); + static int unpack_iterable(PyThreadState *, PyObject *, int, int, PyObject **); #ifdef Py_DEBUG @@ -2497,6 +2505,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr type = exc_info->exc_type; value = exc_info->exc_value; traceback = exc_info->exc_traceback; + exc_info->exc_type = POP(); exc_info->exc_value = POP(); exc_info->exc_traceback = POP(); @@ -2561,6 +2570,35 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr goto exception_unwind; } + TARGET(PREP_RERAISE_STAR) { + PyObject *excs = POP(); + assert(PyList_Check(excs)); + PyObject *orig = POP(); + + PyObject *val = do_reraise_star(excs, orig); + Py_DECREF(excs); + Py_DECREF(orig); + + if (val == NULL) { + goto error; + } + + if (val != Py_None) { + PyObject *tb = PyException_GetTraceback(val); + PUSH(tb ? tb : Py_NewRef(Py_None)); + PUSH(val); + PUSH(Py_NewRef(Py_TYPE(val))); + } + else { + // nothing to reraise + Py_DECREF(val); + PUSH(Py_NewRef(Py_None)); + PUSH(Py_NewRef(Py_None)); + PUSH(Py_NewRef(Py_None)); + } + DISPATCH(); + } + TARGET(END_ASYNC_FOR) { PyObject *exc = POP(); PyObject *val = POP(); @@ -3560,33 +3598,92 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr DISPATCH(); } - TARGET(JUMP_IF_NOT_EXC_MATCH) { - const char *cannot_catch_msg = "catching classes that do not " - "inherit from BaseException is not " - "allowed"; - PyObject *right = POP(); - PyObject *left = TOP(); - if (PyTuple_Check(right)) { - Py_ssize_t i, length; - length = PyTuple_GET_SIZE(right); - for (i = 0; i < length; i++) { - PyObject *exc = PyTuple_GET_ITEM(right, i); - if (!PyExceptionClass_Check(exc)) { - _PyErr_SetString(tstate, PyExc_TypeError, - cannot_catch_msg); - Py_DECREF(right); - goto error; - } - } + TARGET(JUMP_IF_NOT_EG_MATCH) { + PyObject *match_type = POP(); + PyObject *exc_type = TOP(); + PyObject *exc_value = SECOND(); + if (!check_except_star_type_valid(tstate, match_type)) { + Py_DECREF(match_type); + goto error; + } + + PyObject *match = NULL, *rest = NULL; + int res = exception_group_match( + exc_type, exc_value, match_type, &match, &rest); + Py_DECREF(match_type); + if (res == -1) { + goto error; + } + + if (match == NULL || rest == NULL) { + Py_XDECREF(match); + Py_XDECREF(rest); + goto error; + } + + if (match == Py_None) { + Py_XDECREF(match); + Py_XDECREF(rest); + /* no match - jump to target */ + JUMPTO(oparg); } else { - if (!PyExceptionClass_Check(right)) { - _PyErr_SetString(tstate, PyExc_TypeError, - cannot_catch_msg); - Py_DECREF(right); - goto error; + + /* Total or partial match - update the stack from + * [tb, val, exc] + * to + * [tb, rest, exc, tb, match, exc] + * (rest can be Py_None) + */ + + + PyObject *type = TOP(); + PyObject *val = SECOND(); + PyObject *tb = THIRD(); + + if (rest != Py_None) { + /* tb remains the same */ + SET_TOP(Py_NewRef(Py_TYPE(rest))); + SET_SECOND(Py_NewRef(rest)); + SET_THIRD(Py_NewRef(tb)); + } + else { + SET_TOP(Py_NewRef(Py_None)); + SET_SECOND(Py_NewRef(Py_None)); + SET_THIRD(Py_NewRef(Py_None)); } + /* Push match */ + + PUSH(Py_NewRef(tb)); + PUSH(Py_NewRef(match)); + PUSH(Py_NewRef(Py_TYPE(match))); + + // set exc_info to the current match + PyErr_SetExcInfo( + Py_NewRef(Py_TYPE(match)), + Py_NewRef(match), + Py_NewRef(tb)); + + Py_DECREF(tb); + Py_DECREF(val); + Py_DECREF(type); + + Py_DECREF(match); + Py_DECREF(rest); } + + DISPATCH(); + } + + TARGET(JUMP_IF_NOT_EXC_MATCH) { + PyObject *right = POP(); + PyObject *left = TOP(); + if (!check_except_type_valid(tstate, right)) { + Py_DECREF(left); + Py_DECREF(right); + goto error; + } + int res = PyErr_GivenExceptionMatches(left, right); Py_DECREF(right); if (res > 0) { @@ -3703,7 +3800,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr } else if (err == 0) ; - else + else goto error; DISPATCH(); } @@ -5926,6 +6023,207 @@ do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause) return 0; } +/* Logic for matching an exception in an except* clause (too + complicated for inlining). +*/ + +static int +exception_group_match( + PyObject *exc_type, PyObject* exc_value, PyObject *match_type, + PyObject **match, PyObject **rest) +{ + if (exc_type == Py_None) { + assert(exc_value == Py_None); + *match = Py_NewRef(Py_None); + *rest = Py_NewRef(Py_None); + return 0; + } + assert(PyExceptionClass_Check(exc_type)); + assert(PyExceptionInstance_Check(exc_value)); + + int res = PyErr_GivenExceptionMatches(exc_type, match_type); + if (res == -1) { + return -1; + } + if (res > 0) { + /* Full match of exc itself */ + bool is_eg = _PyBaseExceptionGroup_Check(exc_value); + if (is_eg) { + *match = Py_NewRef(exc_value); + } + else { + /* naked exception - wrap it */ + PyObject *excs = PyTuple_Pack(1, exc_value); + if (excs == NULL) { + return -1; + } + PyObject *wrapped = _PyExc_CreateExceptionGroup("", excs); + Py_DECREF(excs); + if (wrapped == NULL) { + return -1; + } + *match = wrapped; + } + *rest = Py_NewRef(Py_None); + return 0; + } + + /* exc_value does not match match_type. + * Check for partial match if it's an exception group. + */ + if (_PyBaseExceptionGroup_Check(exc_value)) { + PyObject *pair = PyObject_CallMethod( + exc_value, "split", "(O)", match_type); + if (pair == NULL) { + return -1; + } + assert(PyTuple_CheckExact(pair)); + assert(PyTuple_GET_SIZE(pair) == 2); + *match = Py_NewRef(PyTuple_GET_ITEM(pair, 0)); + *rest = Py_NewRef(PyTuple_GET_ITEM(pair, 1)); + Py_DECREF(pair); + return 0; + } + /* no match */ + *match = Py_NewRef(Py_None); + *rest = Py_NewRef(Py_None); + return 0; +} + +/* Logic for the final raise/reraise of a try-except* contruct + (too complicated for inlining). +*/ + +static bool +is_same_exception_metadata(PyObject *exc1, PyObject *exc2) +{ + assert(PyExceptionInstance_Check(exc1)); + assert(PyExceptionInstance_Check(exc2)); + + PyObject *tb1 = PyException_GetTraceback(exc1); + PyObject *ctx1 = PyException_GetContext(exc1); + PyObject *cause1 = PyException_GetCause(exc1); + PyObject *tb2 = PyException_GetTraceback(exc2); + PyObject *ctx2 = PyException_GetContext(exc2); + PyObject *cause2 = PyException_GetCause(exc2); + + bool result = ((tb1 == tb2) && + (ctx1 == ctx2) && + (cause1 == cause2)); + + Py_XDECREF(tb1); + Py_XDECREF(ctx1); + Py_XDECREF(cause1); + Py_XDECREF(tb2); + Py_XDECREF(ctx2); + Py_XDECREF(cause2); + return result; +} + +/* + excs: a list of exceptions to raise/reraise + orig: the original except that was caught + + Calculates an exception group to raise. It contains + all exceptions in excs, where those that were reraised + have same nesting structure as in orig, and those that + were raised (if any) are added as siblings in a new EG. + + Returns NULL and sets an exception on failure. +*/ +static PyObject* +do_reraise_star(PyObject *excs, PyObject *orig) +{ + assert(PyList_Check(excs)); + assert(PyExceptionInstance_Check(orig)); + + Py_ssize_t numexcs = PyList_Size(excs); + if (numexcs == -1) { + return NULL; + } + + if (numexcs == 0) { + return Py_NewRef(Py_None); + } + + if (!_PyBaseExceptionGroup_Check(orig)) { + /* a naked exception was caught and wrapped. Only one except* clause + * could have executed,so there is at most one exception to raise. + */ + + /* TODO: when I finish the compiler work the None might not be there anymore. */ + assert(numexcs == 1 || (numexcs == 2 && PyList_GET_ITEM(excs, 1) == Py_None)); + + PyObject *e = PyList_GET_ITEM(excs, 0); + assert(e != NULL); + return Py_NewRef(e); + } + + + PyObject *raised_list = PyList_New(0); + if (raised_list == NULL) { + return NULL; + } + PyObject* reraised_list = PyList_New(0); + if (reraised_list == NULL) { + Py_DECREF(raised_list); + return NULL; + } + + /* Now we are holding refs to raised_list and reraised_list */ + + PyObject *result = NULL; + + /* Split excs into raised and reraised by comparing metadata with orig */ + for (Py_ssize_t i = 0; i < numexcs; i++) { + PyObject *e = PyList_GET_ITEM(excs, i); + assert(e != NULL); + if (e == Py_None) { + continue; + } + bool is_reraise = is_same_exception_metadata(e, orig); + PyObject *append_list = is_reraise ? reraised_list : raised_list; + if (PyList_Append(append_list, e) == -1) { + goto done; + } + } + + PyObject *reraised_eg = _PyExc_ExceptionGroupProjection(orig, reraised_list); + if (reraised_eg == NULL) { + goto done; + } + + if (reraised_eg != Py_None) { + assert(is_same_exception_metadata(reraised_eg, orig)); + } + + Py_ssize_t num_raised = PyList_GET_SIZE(raised_list); + if (num_raised == 0) { + result = reraised_eg; + } else if (num_raised > 0) { + int res = 0; + if (reraised_eg != Py_None) { + res = PyList_Append(raised_list, reraised_eg); + } + Py_DECREF(reraised_eg); + if (res == -1) { + goto done; + } + result = _PyExc_CreateExceptionGroup("", raised_list); + if (result == NULL) { + goto done; + } + } else { + Py_DECREF(reraised_eg); + goto done; + } + +done: + Py_XDECREF(raised_list); + Py_XDECREF(reraised_list); + return result; +} + /* Iterate v argcnt times and store the results on the stack (via decreasing sp). Return 1 for success, 0 if error. @@ -6819,6 +7117,71 @@ import_all_from(PyThreadState *tstate, PyObject *locals, PyObject *v) return err; } +#define CANNOT_CATCH_MSG "catching classes that do not inherit from "\ + "BaseException is not allowed" + + #define CANNOT_EXCEPT_STAR_EG "catching ExceptionGroup with except* "\ + "is not allowed. Use except instead." + + static int + check_except_type_valid(PyThreadState *tstate, PyObject* right) { + if (PyTuple_Check(right)) { + Py_ssize_t i, length; + length = PyTuple_GET_SIZE(right); + for (i = 0; i < length; i++) { + PyObject *exc = PyTuple_GET_ITEM(right, i); + if (!PyExceptionClass_Check(exc)) { + _PyErr_SetString(tstate, PyExc_TypeError, + CANNOT_CATCH_MSG); + return 0; + } + } + } + else { + if (!PyExceptionClass_Check(right)) { + _PyErr_SetString(tstate, PyExc_TypeError, + CANNOT_CATCH_MSG); + return 0; + } + } + return 1; + } + +static int +check_except_star_type_valid(PyThreadState *tstate, PyObject* right) { + if (!check_except_type_valid(tstate, right)) { + return 0; + } + // reject except *ExceptionGroup + int res = 0; + if (PyTuple_Check(right)) { + Py_ssize_t i, length; + length = PyTuple_GET_SIZE(right); + for (i = 0; i < length; i++) { + PyObject *exc = PyTuple_GET_ITEM(right, i); + res = PyObject_IsSubclass(exc, PyExc_BaseExceptionGroup); + if (res == -1) { + return 0; + } + if (res == 1) { + break; + } + } + } + else { + res = PyObject_IsSubclass(right, PyExc_BaseExceptionGroup); + if (res == -1) { + return 0; + } + } + if (res == 1) { + _PyErr_SetString(tstate, PyExc_TypeError, + CANNOT_EXCEPT_STAR_EG); + return 0; + } + return 1; +} + static int check_args_iterable(PyThreadState *tstate, PyObject *func, PyObject *args) { diff --git a/Python/compile.c b/Python/compile.c index 1ae4b6575a7f4c..3d2cec9bca728c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1094,6 +1094,8 @@ stack_effect(int opcode, int oparg, int jump) return -1; case JUMP_IF_NOT_EXC_MATCH: return -1; + case JUMP_IF_NOT_EG_MATCH: + return jump > 0 ? -1 : 2; case IMPORT_NAME: return -1; case IMPORT_FROM: @@ -1131,6 +1133,8 @@ stack_effect(int opcode, int oparg, int jump) * if an exception be raised. */ return jump ? -1 + 4 : 0; + case PREP_RERAISE_STAR: + return 1; case RERAISE: return -3; case PUSH_EXC_INFO: @@ -3217,7 +3221,9 @@ static int compiler_try_except(struct compiler *c, stmt_ty s) { basicblock *body, *orelse, *except, *end, *cleanup; + basicblock *reraise_star = NULL; /* for except* */ Py_ssize_t i, n; + int is_except_star = s->v.Try.star; body = compiler_new_block(c); except = compiler_new_block(c); @@ -3226,6 +3232,13 @@ compiler_try_except(struct compiler *c, stmt_ty s) cleanup = compiler_new_block(c); if (body == NULL || except == NULL || orelse == NULL || end == NULL || cleanup == NULL) return 0; + + if (is_except_star) { + reraise_star = compiler_new_block(c); + if (reraise_star == NULL) + return 0; + } + ADDOP_JUMP(c, SETUP_FINALLY, except); compiler_use_next_block(c, body); if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL)) @@ -3248,17 +3261,47 @@ compiler_try_except(struct compiler *c, stmt_ty s) s->v.Try.handlers, i); SET_LOC(c, handler); if (!handler->v.ExceptHandler.type && i < n-1) { + assert(!is_except_star); return compiler_error(c, "default 'except:' must be last"); } except = compiler_new_block(c); if (except == NULL) return 0; + if (is_except_star) { + if (i == 0) { + /* Push the original EG into the stack */ + /* + [tb, val, exc] DUP_TOP_TWO + [tb, val, exc, val, exc] POP_TOP + [tb, val, exc, val] ROT_FOUR + [val, tb, val, exc] + */ + ADDOP(c, DUP_TOP_TWO); + ADDOP(c, POP_TOP); + ADDOP(c, ROT_FOUR); + + /* create empty list for exceptions raised/reraise in the except* blocks */ + /* + [val, tb, val, exc] BUILD_LIST + [val, tb, val, exc, []] ROT_FOUR + [val, [], tb, val, exc] + */ + ADDOP_I(c, BUILD_LIST, 0); + ADDOP(c, ROT_FOUR); + } + } if (handler->v.ExceptHandler.type) { VISIT(c, expr, handler->v.ExceptHandler.type); - ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except); + if (!is_except_star) { + ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except); + } + else { + ADDOP_JUMP(c, JUMP_IF_NOT_EG_MATCH, except); + } + NEXT_BLOCK(c); } - ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); // exc_type if (handler->v.ExceptHandler.name) { basicblock *cleanup_end, *cleanup_body; @@ -3269,7 +3312,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) } compiler_nameop(c, handler->v.ExceptHandler.name, Store); - ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); // tb /* try: @@ -3295,11 +3338,18 @@ compiler_try_except(struct compiler *c, stmt_ty s) UNSET_LOC(c); ADDOP(c, POP_BLOCK); ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT); + if (!is_except_star) { + ADDOP(c, POP_EXCEPT); + } ADDOP_LOAD_CONST(c, Py_None); compiler_nameop(c, handler->v.ExceptHandler.name, Store); compiler_nameop(c, handler->v.ExceptHandler.name, Del); - ADDOP_JUMP(c, JUMP_FORWARD, end); + if (!is_except_star) { + ADDOP_JUMP(c, JUMP_FORWARD, end); + } + else { + ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + } /* except: */ compiler_use_next_block(c, cleanup_end); @@ -3311,17 +3361,37 @@ compiler_try_except(struct compiler *c, stmt_ty s) compiler_nameop(c, handler->v.ExceptHandler.name, Store); compiler_nameop(c, handler->v.ExceptHandler.name, Del); - ADDOP_I(c, RERAISE, 1); + if (!is_except_star) { + ADDOP_I(c, RERAISE, 1); + } + else { + /* add exception raised to the res list */ + ADDOP(c, POP_TOP); // type + ADDOP_I(c, LIST_APPEND, 6); // exc + ADDOP(c, POP_TOP); // tb + ADDOP(c, POP_TOP); // lasti + + ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + } } else { - basicblock *cleanup_body; + basicblock *cleanup_end, *cleanup_body; cleanup_body = compiler_new_block(c); if (!cleanup_body) return 0; + if (is_except_star) { + cleanup_end = compiler_new_block(c); + if (!cleanup_end) + return 0; + } - ADDOP(c, POP_TOP); - ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); // exc_val + ADDOP(c, POP_TOP); // tb + + if (is_except_star) { + ADDOP_JUMP(c, SETUP_CLEANUP, cleanup_end); + } compiler_use_next_block(c, cleanup_body); if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, NULL)) return 0; @@ -3329,19 +3399,71 @@ compiler_try_except(struct compiler *c, stmt_ty s) compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body); UNSET_LOC(c); ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT); - ADDOP_JUMP(c, JUMP_FORWARD, end); + if (!is_except_star) { + ADDOP(c, POP_EXCEPT); + ADDOP_JUMP(c, JUMP_FORWARD, end); + } + else { + ADDOP(c, POP_BLOCK); + ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + } + + if (is_except_star) { + /* except: */ + compiler_use_next_block(c, cleanup_end); + /* add exception raised to the res list */ + ADDOP(c, POP_TOP); // type + ADDOP_I(c, LIST_APPEND, 6); // exc + ADDOP(c, POP_TOP); // tb + ADDOP(c, POP_TOP); // lasti + + ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + } } + compiler_use_next_block(c, except); + if (is_except_star) { + if (i == n - 1) { + /* Add exc to the list (if not None it's the unhandled part of the EG) */ + ADDOP(c, POP_TOP); + ADDOP_I(c, LIST_APPEND, 2); + ADDOP(c, POP_TOP); + ADDOP_JUMP(c, JUMP_FORWARD, reraise_star); + } + } } /* Mark as artificial */ UNSET_LOC(c); compiler_pop_fblock(c, EXCEPTION_HANDLER, NULL); - ADDOP_I(c, RERAISE, 0); + if (!is_except_star) { + ADDOP_I(c, RERAISE, 0); + } + else { + basicblock *reraise; + reraise = compiler_new_block(c); + if (!reraise) + return 0; + + compiler_use_next_block(c, reraise_star); + ADDOP(c, PREP_RERAISE_STAR); + ADDOP(c, DUP_TOP); + ADDOP_JUMP(c, POP_JUMP_IF_TRUE, reraise); + NEXT_BLOCK(c); + + /* Nothing to reraise - pop it */ + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_EXCEPT); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, reraise); + ADDOP_I(c, RERAISE, 0); + } compiler_use_next_block(c, cleanup); ADDOP(c, POP_EXCEPT_AND_RERAISE); compiler_use_next_block(c, orelse); VISIT_SEQ(c, stmt, s->v.Try.orelse); + ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, end); return 1; } @@ -6656,9 +6778,11 @@ stackdepth(struct compiler *c) int depth = b->b_startdepth; assert(depth >= 0); basicblock *next = b->b_next; +//fprintf(stderr, " >> b->b_startdepth = %d\n", b->b_startdepth); for (int i = 0; i < b->b_iused; i++) { struct instr *instr = &b->b_instr[i]; int effect = stack_effect(instr->i_opcode, instr->i_oparg, 0); +//fprintf(stderr, "[%d] instr->i_opcode=%d, effect = %d\n", i, instr->i_opcode, effect); if (effect == PY_INVALID_STACK_EFFECT) { PyErr_Format(PyExc_SystemError, "compiler stack_effect(opcode=%d, arg=%i) failed", diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index a57617e022e1db..172041529a1edd 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -87,7 +87,7 @@ static void *opcode_targets[256] = { &&TARGET_SETUP_ANNOTATIONS, &&TARGET_YIELD_VALUE, &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_PREP_RERAISE_STAR, &&TARGET_POP_EXCEPT, &&TARGET_STORE_NAME, &&TARGET_DELETE_NAME, @@ -126,7 +126,7 @@ static void *opcode_targets[256] = { &&TARGET_LOAD_FAST, &&TARGET_STORE_FAST, &&TARGET_DELETE_FAST, - &&_unknown_opcode, + &&TARGET_JUMP_IF_NOT_EG_MATCH, &&_unknown_opcode, &&TARGET_GEN_START, &&TARGET_RAISE_VARARGS, From cad9126f346a6ece7b31a4cd933cf6ceb66ec1ae Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 17 Nov 2021 19:14:55 +0000 Subject: [PATCH 02/37] fold invalid_except_star_stmt into invalid_except_stmt. Add custom message for mixed except and except*. Add tests for custom errors --- Grammar/python.gram | 12 +- Lib/test/test_syntax.py | 78 ++ Parser/parser.c | 1739 +++++++++++++++++++++------------------ 3 files changed, 1022 insertions(+), 807 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 426721107a5e5e..952e90e195f46b 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -419,7 +419,7 @@ except_star_block[excepthandler_ty]: | invalid_except_star_stmt_indent | 'except' '*' e=expression t=['as' z=NAME { z }] ':' b=block { _PyAST_ExceptHandler(e, (t) ? ((expr_ty) t)->v.Name.id : NULL, b, EXTRA) } - | invalid_except_star_stmt + | invalid_except_stmt finally_block[asdl_stmt_seq*]: | invalid_finally_stmt | 'finally' &&':' a=block { a } @@ -1194,15 +1194,13 @@ invalid_try_stmt: | a='try' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'try' statement on line %d", a->lineno) } | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR("expected 'except' or 'finally' block") } + | 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* { + RAISE_SYNTAX_ERROR("cannot have both 'except' and 'except*' on the same 'try'") } invalid_except_stmt: - | 'except' a=expression ',' expressions ['as' NAME ] ':' { + | 'except' '*'? a=expression ',' expressions ['as' NAME ] ':' { RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") } - | a='except' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } + | a='except' '*'? expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } | a='except' NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } -invalid_except_star_stmt: - | 'except' '*' a=expression ',' expressions ['as' NAME ] ':' { - RAISE_SYNTAX_ERROR_STARTING_FROM(a, "multiple exception types must be parenthesized") } - | a='except' '*' expression ['as' NAME ] NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR("expected one or more exception types") } invalid_finally_stmt: | a='finally' ':' NEWLINE !INDENT { diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index f41df8ca49aa6f..bb5f16f83aada5 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -917,6 +917,26 @@ Traceback (most recent call last): SyntaxError: expected 'except' or 'finally' block +Custom error message for try block mixing except and except* + + >>> try: + ... pass + ... except TypeError: + ... pass + ... except* ValueError: + ... pass + Traceback (most recent call last): + SyntaxError: cannot have both 'except' and 'except*' on the same 'try' + + >>> try: + ... pass + ... except* TypeError: + ... pass + ... except ValueError: + ... pass + Traceback (most recent call last): + SyntaxError: cannot have both 'except' and 'except*' on the same 'try' + Ensure that early = are not matched by the parser as invalid comparisons >>> f(2, 4, x=34); 1 $ 2 Traceback (most recent call last): @@ -1030,6 +1050,13 @@ Traceback (most recent call last): IndentationError: expected an indented block after 'except' statement on line 3 + >>> try: + ... something() + ... except* A: + ... pass + Traceback (most recent call last): + IndentationError: expected an indented block after 'except*' statement on line 3 + >>> try: ... something() ... except A: @@ -1039,6 +1066,15 @@ Traceback (most recent call last): IndentationError: expected an indented block after 'finally' statement on line 5 + >>> try: + ... something() + ... except* A: + ... pass + ... finally: + ... pass + Traceback (most recent call last): + IndentationError: expected an indented block after 'finally' statement on line 5 + >>> with A: ... pass Traceback (most recent call last): @@ -1142,6 +1178,48 @@ SyntaxError: multiple exception types must be parenthesized + >>> try: + ... pass + ... except* A, B: + ... pass + Traceback (most recent call last): + SyntaxError: multiple exception types must be parenthesized + + >>> try: + ... pass + ... except* A, B, C: + ... pass + Traceback (most recent call last): + SyntaxError: multiple exception types must be parenthesized + + >>> try: + ... pass + ... except* A, B, C as blech: + ... pass + Traceback (most recent call last): + SyntaxError: multiple exception types must be parenthesized + + >>> try: + ... pass + ... except* A, B, C as blech: + ... pass + ... finally: + ... pass + Traceback (most recent call last): + SyntaxError: multiple exception types must be parenthesized + +Custom exception for 'except*' without an exception type + + >>> try: + ... pass + ... except* A as a: + ... pass + ... except*: + ... pass + Traceback (most recent call last): + SyntaxError: expected one or more exception types + + >>> f(a=23, a=234) Traceback (most recent call last): ... diff --git a/Parser/parser.c b/Parser/parser.c index fabd3a33c3e664..e0e9aaf6b93457 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -11,18 +11,18 @@ static KeywordToken *reserved_keywords[] = { (KeywordToken[]) {{NULL, -1}}, (KeywordToken[]) {{NULL, -1}}, (KeywordToken[]) { - {"if", 637}, - {"as", 635}, - {"in", 644}, + {"if", 634}, + {"as", 632}, + {"in", 641}, {"or", 574}, {"is", 582}, {NULL, -1}, }, (KeywordToken[]) { {"del", 603}, - {"def", 645}, - {"for", 643}, - {"try", 615}, + {"def", 642}, + {"for", 640}, + {"try", 618}, {"and", 575}, {"not", 581}, {NULL, -1}, @@ -31,8 +31,8 @@ static KeywordToken *reserved_keywords[] = { {"from", 572}, {"pass", 504}, {"with", 612}, - {"elif", 639}, - {"else", 640}, + {"elif", 636}, + {"else", 637}, {"None", 601}, {"True", 600}, {NULL, -1}, @@ -41,8 +41,8 @@ static KeywordToken *reserved_keywords[] = { {"raise", 522}, {"yield", 573}, {"break", 508}, - {"class", 646}, - {"while", 642}, + {"class", 643}, + {"while", 639}, {"False", 602}, {NULL, -1}, }, @@ -51,12 +51,12 @@ static KeywordToken *reserved_keywords[] = { {"import", 531}, {"assert", 526}, {"global", 523}, - {"except", 632}, + {"except", 629}, {"lambda", 586}, {NULL, -1}, }, (KeywordToken[]) { - {"finally", 628}, + {"finally", 625}, {NULL, -1}, }, (KeywordToken[]) { @@ -277,236 +277,238 @@ static char *soft_keywords[] = { #define invalid_with_stmt_indent_type 1203 #define invalid_try_stmt_type 1204 #define invalid_except_stmt_type 1205 -#define invalid_except_star_stmt_type 1206 -#define invalid_finally_stmt_type 1207 -#define invalid_except_stmt_indent_type 1208 -#define invalid_except_star_stmt_indent_type 1209 -#define invalid_match_stmt_type 1210 -#define invalid_case_block_type 1211 -#define invalid_as_pattern_type 1212 -#define invalid_class_pattern_type 1213 -#define invalid_class_argument_pattern_type 1214 -#define invalid_if_stmt_type 1215 -#define invalid_elif_stmt_type 1216 -#define invalid_else_stmt_type 1217 -#define invalid_while_stmt_type 1218 -#define invalid_for_stmt_type 1219 -#define invalid_def_raw_type 1220 -#define invalid_class_def_raw_type 1221 -#define invalid_double_starred_kvpairs_type 1222 -#define invalid_kvpair_type 1223 -#define _loop0_1_type 1224 -#define _loop0_2_type 1225 -#define _loop1_3_type 1226 -#define _loop0_5_type 1227 -#define _gather_4_type 1228 -#define _tmp_6_type 1229 -#define _tmp_7_type 1230 -#define _tmp_8_type 1231 -#define _tmp_9_type 1232 -#define _tmp_10_type 1233 -#define _tmp_11_type 1234 -#define _tmp_12_type 1235 -#define _tmp_13_type 1236 -#define _loop1_14_type 1237 -#define _tmp_15_type 1238 -#define _tmp_16_type 1239 -#define _tmp_17_type 1240 -#define _loop0_19_type 1241 -#define _gather_18_type 1242 -#define _loop0_21_type 1243 -#define _gather_20_type 1244 -#define _tmp_22_type 1245 -#define _tmp_23_type 1246 -#define _loop0_24_type 1247 -#define _loop1_25_type 1248 -#define _loop0_27_type 1249 -#define _gather_26_type 1250 -#define _tmp_28_type 1251 -#define _loop0_30_type 1252 -#define _gather_29_type 1253 -#define _tmp_31_type 1254 -#define _loop1_32_type 1255 -#define _tmp_33_type 1256 -#define _tmp_34_type 1257 -#define _tmp_35_type 1258 -#define _loop0_36_type 1259 -#define _loop0_37_type 1260 -#define _loop0_38_type 1261 -#define _loop1_39_type 1262 -#define _loop0_40_type 1263 -#define _loop1_41_type 1264 -#define _loop1_42_type 1265 -#define _loop1_43_type 1266 -#define _loop0_44_type 1267 -#define _loop1_45_type 1268 -#define _loop0_46_type 1269 -#define _loop1_47_type 1270 -#define _loop0_48_type 1271 -#define _loop1_49_type 1272 -#define _loop0_51_type 1273 -#define _gather_50_type 1274 -#define _loop0_53_type 1275 -#define _gather_52_type 1276 -#define _loop0_55_type 1277 -#define _gather_54_type 1278 -#define _loop0_57_type 1279 -#define _gather_56_type 1280 -#define _tmp_58_type 1281 -#define _loop1_59_type 1282 -#define _loop1_60_type 1283 -#define _tmp_61_type 1284 -#define _tmp_62_type 1285 -#define _loop1_63_type 1286 -#define _loop0_65_type 1287 -#define _gather_64_type 1288 -#define _tmp_66_type 1289 -#define _tmp_67_type 1290 -#define _tmp_68_type 1291 -#define _tmp_69_type 1292 -#define _loop0_71_type 1293 -#define _gather_70_type 1294 -#define _loop0_73_type 1295 -#define _gather_72_type 1296 -#define _tmp_74_type 1297 -#define _loop0_76_type 1298 -#define _gather_75_type 1299 -#define _loop0_78_type 1300 -#define _gather_77_type 1301 -#define _loop1_79_type 1302 -#define _loop1_80_type 1303 -#define _loop0_82_type 1304 -#define _gather_81_type 1305 -#define _loop1_83_type 1306 -#define _loop1_84_type 1307 -#define _loop1_85_type 1308 -#define _tmp_86_type 1309 -#define _loop0_88_type 1310 -#define _gather_87_type 1311 -#define _tmp_89_type 1312 -#define _tmp_90_type 1313 -#define _tmp_91_type 1314 -#define _tmp_92_type 1315 -#define _tmp_93_type 1316 -#define _loop0_94_type 1317 -#define _loop0_95_type 1318 -#define _loop0_96_type 1319 -#define _loop1_97_type 1320 -#define _loop0_98_type 1321 -#define _loop1_99_type 1322 -#define _loop1_100_type 1323 -#define _loop1_101_type 1324 -#define _loop0_102_type 1325 -#define _loop1_103_type 1326 -#define _loop0_104_type 1327 -#define _loop1_105_type 1328 -#define _loop0_106_type 1329 -#define _loop1_107_type 1330 -#define _loop1_108_type 1331 -#define _tmp_109_type 1332 -#define _loop0_111_type 1333 -#define _gather_110_type 1334 -#define _loop1_112_type 1335 -#define _loop0_113_type 1336 -#define _loop0_114_type 1337 -#define _tmp_115_type 1338 -#define _loop0_117_type 1339 -#define _gather_116_type 1340 -#define _tmp_118_type 1341 -#define _loop0_120_type 1342 -#define _gather_119_type 1343 -#define _loop0_122_type 1344 -#define _gather_121_type 1345 -#define _loop0_124_type 1346 -#define _gather_123_type 1347 -#define _loop0_126_type 1348 -#define _gather_125_type 1349 -#define _loop0_127_type 1350 -#define _loop0_129_type 1351 -#define _gather_128_type 1352 -#define _loop1_130_type 1353 -#define _tmp_131_type 1354 -#define _loop0_133_type 1355 -#define _gather_132_type 1356 -#define _loop0_135_type 1357 -#define _gather_134_type 1358 -#define _loop0_137_type 1359 -#define _gather_136_type 1360 -#define _loop0_139_type 1361 -#define _gather_138_type 1362 -#define _loop0_141_type 1363 -#define _gather_140_type 1364 -#define _tmp_142_type 1365 -#define _tmp_143_type 1366 -#define _tmp_144_type 1367 -#define _tmp_145_type 1368 -#define _tmp_146_type 1369 -#define _tmp_147_type 1370 -#define _tmp_148_type 1371 -#define _tmp_149_type 1372 -#define _tmp_150_type 1373 -#define _loop0_151_type 1374 -#define _loop0_152_type 1375 -#define _loop0_153_type 1376 -#define _tmp_154_type 1377 -#define _tmp_155_type 1378 -#define _tmp_156_type 1379 -#define _tmp_157_type 1380 -#define _loop0_158_type 1381 -#define _loop1_159_type 1382 -#define _loop0_160_type 1383 -#define _loop1_161_type 1384 -#define _tmp_162_type 1385 -#define _tmp_163_type 1386 -#define _tmp_164_type 1387 -#define _loop0_166_type 1388 -#define _gather_165_type 1389 -#define _loop0_168_type 1390 -#define _gather_167_type 1391 -#define _loop0_170_type 1392 -#define _gather_169_type 1393 -#define _loop0_172_type 1394 -#define _gather_171_type 1395 -#define _tmp_173_type 1396 -#define _tmp_174_type 1397 -#define _tmp_175_type 1398 -#define _tmp_176_type 1399 -#define _tmp_177_type 1400 -#define _tmp_178_type 1401 -#define _tmp_179_type 1402 -#define _tmp_180_type 1403 -#define _tmp_181_type 1404 -#define _tmp_182_type 1405 -#define _tmp_183_type 1406 -#define _loop0_185_type 1407 -#define _gather_184_type 1408 -#define _tmp_186_type 1409 -#define _tmp_187_type 1410 -#define _tmp_188_type 1411 -#define _tmp_189_type 1412 -#define _tmp_190_type 1413 -#define _tmp_191_type 1414 -#define _tmp_192_type 1415 -#define _tmp_193_type 1416 -#define _tmp_194_type 1417 -#define _tmp_195_type 1418 -#define _tmp_196_type 1419 -#define _tmp_197_type 1420 -#define _tmp_198_type 1421 -#define _tmp_199_type 1422 -#define _tmp_200_type 1423 -#define _tmp_201_type 1424 -#define _tmp_202_type 1425 -#define _tmp_203_type 1426 -#define _tmp_204_type 1427 -#define _tmp_205_type 1428 -#define _tmp_206_type 1429 -#define _tmp_207_type 1430 -#define _tmp_208_type 1431 -#define _tmp_209_type 1432 -#define _tmp_210_type 1433 -#define _tmp_211_type 1434 -#define _tmp_212_type 1435 +#define invalid_finally_stmt_type 1206 +#define invalid_except_stmt_indent_type 1207 +#define invalid_except_star_stmt_indent_type 1208 +#define invalid_match_stmt_type 1209 +#define invalid_case_block_type 1210 +#define invalid_as_pattern_type 1211 +#define invalid_class_pattern_type 1212 +#define invalid_class_argument_pattern_type 1213 +#define invalid_if_stmt_type 1214 +#define invalid_elif_stmt_type 1215 +#define invalid_else_stmt_type 1216 +#define invalid_while_stmt_type 1217 +#define invalid_for_stmt_type 1218 +#define invalid_def_raw_type 1219 +#define invalid_class_def_raw_type 1220 +#define invalid_double_starred_kvpairs_type 1221 +#define invalid_kvpair_type 1222 +#define _loop0_1_type 1223 +#define _loop0_2_type 1224 +#define _loop1_3_type 1225 +#define _loop0_5_type 1226 +#define _gather_4_type 1227 +#define _tmp_6_type 1228 +#define _tmp_7_type 1229 +#define _tmp_8_type 1230 +#define _tmp_9_type 1231 +#define _tmp_10_type 1232 +#define _tmp_11_type 1233 +#define _tmp_12_type 1234 +#define _tmp_13_type 1235 +#define _loop1_14_type 1236 +#define _tmp_15_type 1237 +#define _tmp_16_type 1238 +#define _tmp_17_type 1239 +#define _loop0_19_type 1240 +#define _gather_18_type 1241 +#define _loop0_21_type 1242 +#define _gather_20_type 1243 +#define _tmp_22_type 1244 +#define _tmp_23_type 1245 +#define _loop0_24_type 1246 +#define _loop1_25_type 1247 +#define _loop0_27_type 1248 +#define _gather_26_type 1249 +#define _tmp_28_type 1250 +#define _loop0_30_type 1251 +#define _gather_29_type 1252 +#define _tmp_31_type 1253 +#define _loop1_32_type 1254 +#define _tmp_33_type 1255 +#define _tmp_34_type 1256 +#define _tmp_35_type 1257 +#define _loop0_36_type 1258 +#define _loop0_37_type 1259 +#define _loop0_38_type 1260 +#define _loop1_39_type 1261 +#define _loop0_40_type 1262 +#define _loop1_41_type 1263 +#define _loop1_42_type 1264 +#define _loop1_43_type 1265 +#define _loop0_44_type 1266 +#define _loop1_45_type 1267 +#define _loop0_46_type 1268 +#define _loop1_47_type 1269 +#define _loop0_48_type 1270 +#define _loop1_49_type 1271 +#define _loop0_51_type 1272 +#define _gather_50_type 1273 +#define _loop0_53_type 1274 +#define _gather_52_type 1275 +#define _loop0_55_type 1276 +#define _gather_54_type 1277 +#define _loop0_57_type 1278 +#define _gather_56_type 1279 +#define _tmp_58_type 1280 +#define _loop1_59_type 1281 +#define _loop1_60_type 1282 +#define _tmp_61_type 1283 +#define _tmp_62_type 1284 +#define _loop1_63_type 1285 +#define _loop0_65_type 1286 +#define _gather_64_type 1287 +#define _tmp_66_type 1288 +#define _tmp_67_type 1289 +#define _tmp_68_type 1290 +#define _tmp_69_type 1291 +#define _loop0_71_type 1292 +#define _gather_70_type 1293 +#define _loop0_73_type 1294 +#define _gather_72_type 1295 +#define _tmp_74_type 1296 +#define _loop0_76_type 1297 +#define _gather_75_type 1298 +#define _loop0_78_type 1299 +#define _gather_77_type 1300 +#define _loop1_79_type 1301 +#define _loop1_80_type 1302 +#define _loop0_82_type 1303 +#define _gather_81_type 1304 +#define _loop1_83_type 1305 +#define _loop1_84_type 1306 +#define _loop1_85_type 1307 +#define _tmp_86_type 1308 +#define _loop0_88_type 1309 +#define _gather_87_type 1310 +#define _tmp_89_type 1311 +#define _tmp_90_type 1312 +#define _tmp_91_type 1313 +#define _tmp_92_type 1314 +#define _tmp_93_type 1315 +#define _loop0_94_type 1316 +#define _loop0_95_type 1317 +#define _loop0_96_type 1318 +#define _loop1_97_type 1319 +#define _loop0_98_type 1320 +#define _loop1_99_type 1321 +#define _loop1_100_type 1322 +#define _loop1_101_type 1323 +#define _loop0_102_type 1324 +#define _loop1_103_type 1325 +#define _loop0_104_type 1326 +#define _loop1_105_type 1327 +#define _loop0_106_type 1328 +#define _loop1_107_type 1329 +#define _loop1_108_type 1330 +#define _tmp_109_type 1331 +#define _loop0_111_type 1332 +#define _gather_110_type 1333 +#define _loop1_112_type 1334 +#define _loop0_113_type 1335 +#define _loop0_114_type 1336 +#define _tmp_115_type 1337 +#define _loop0_117_type 1338 +#define _gather_116_type 1339 +#define _tmp_118_type 1340 +#define _loop0_120_type 1341 +#define _gather_119_type 1342 +#define _loop0_122_type 1343 +#define _gather_121_type 1344 +#define _loop0_124_type 1345 +#define _gather_123_type 1346 +#define _loop0_126_type 1347 +#define _gather_125_type 1348 +#define _loop0_127_type 1349 +#define _loop0_129_type 1350 +#define _gather_128_type 1351 +#define _loop1_130_type 1352 +#define _tmp_131_type 1353 +#define _loop0_133_type 1354 +#define _gather_132_type 1355 +#define _loop0_135_type 1356 +#define _gather_134_type 1357 +#define _loop0_137_type 1358 +#define _gather_136_type 1359 +#define _loop0_139_type 1360 +#define _gather_138_type 1361 +#define _loop0_141_type 1362 +#define _gather_140_type 1363 +#define _tmp_142_type 1364 +#define _tmp_143_type 1365 +#define _tmp_144_type 1366 +#define _tmp_145_type 1367 +#define _tmp_146_type 1368 +#define _tmp_147_type 1369 +#define _tmp_148_type 1370 +#define _tmp_149_type 1371 +#define _tmp_150_type 1372 +#define _loop0_151_type 1373 +#define _loop0_152_type 1374 +#define _loop0_153_type 1375 +#define _tmp_154_type 1376 +#define _tmp_155_type 1377 +#define _tmp_156_type 1378 +#define _tmp_157_type 1379 +#define _loop0_158_type 1380 +#define _loop1_159_type 1381 +#define _loop0_160_type 1382 +#define _loop1_161_type 1383 +#define _tmp_162_type 1384 +#define _tmp_163_type 1385 +#define _tmp_164_type 1386 +#define _loop0_166_type 1387 +#define _gather_165_type 1388 +#define _loop0_168_type 1389 +#define _gather_167_type 1390 +#define _loop0_170_type 1391 +#define _gather_169_type 1392 +#define _loop0_172_type 1393 +#define _gather_171_type 1394 +#define _tmp_173_type 1395 +#define _loop0_174_type 1396 +#define _tmp_175_type 1397 +#define _loop0_176_type 1398 +#define _tmp_177_type 1399 +#define _tmp_178_type 1400 +#define _tmp_179_type 1401 +#define _tmp_180_type 1402 +#define _tmp_181_type 1403 +#define _tmp_182_type 1404 +#define _tmp_183_type 1405 +#define _tmp_184_type 1406 +#define _loop0_186_type 1407 +#define _gather_185_type 1408 +#define _tmp_187_type 1409 +#define _tmp_188_type 1410 +#define _tmp_189_type 1411 +#define _tmp_190_type 1412 +#define _tmp_191_type 1413 +#define _tmp_192_type 1414 +#define _tmp_193_type 1415 +#define _tmp_194_type 1416 +#define _tmp_195_type 1417 +#define _tmp_196_type 1418 +#define _tmp_197_type 1419 +#define _tmp_198_type 1420 +#define _tmp_199_type 1421 +#define _tmp_200_type 1422 +#define _tmp_201_type 1423 +#define _tmp_202_type 1424 +#define _tmp_203_type 1425 +#define _tmp_204_type 1426 +#define _tmp_205_type 1427 +#define _tmp_206_type 1428 +#define _tmp_207_type 1429 +#define _tmp_208_type 1430 +#define _tmp_209_type 1431 +#define _tmp_210_type 1432 +#define _tmp_211_type 1433 +#define _tmp_212_type 1434 +#define _tmp_213_type 1435 +#define _tmp_214_type 1436 +#define _tmp_215_type 1437 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -714,7 +716,6 @@ static void *invalid_with_stmt_rule(Parser *p); static void *invalid_with_stmt_indent_rule(Parser *p); static void *invalid_try_stmt_rule(Parser *p); static void *invalid_except_stmt_rule(Parser *p); -static void *invalid_except_star_stmt_rule(Parser *p); static void *invalid_finally_stmt_rule(Parser *p); static void *invalid_except_stmt_indent_rule(Parser *p); static void *invalid_except_star_stmt_indent_rule(Parser *p); @@ -905,9 +906,9 @@ static asdl_seq *_gather_169_rule(Parser *p); static asdl_seq *_loop0_172_rule(Parser *p); static asdl_seq *_gather_171_rule(Parser *p); static void *_tmp_173_rule(Parser *p); -static void *_tmp_174_rule(Parser *p); +static asdl_seq *_loop0_174_rule(Parser *p); static void *_tmp_175_rule(Parser *p); -static void *_tmp_176_rule(Parser *p); +static asdl_seq *_loop0_176_rule(Parser *p); static void *_tmp_177_rule(Parser *p); static void *_tmp_178_rule(Parser *p); static void *_tmp_179_rule(Parser *p); @@ -915,9 +916,9 @@ static void *_tmp_180_rule(Parser *p); static void *_tmp_181_rule(Parser *p); static void *_tmp_182_rule(Parser *p); static void *_tmp_183_rule(Parser *p); -static asdl_seq *_loop0_185_rule(Parser *p); -static asdl_seq *_gather_184_rule(Parser *p); -static void *_tmp_186_rule(Parser *p); +static void *_tmp_184_rule(Parser *p); +static asdl_seq *_loop0_186_rule(Parser *p); +static asdl_seq *_gather_185_rule(Parser *p); static void *_tmp_187_rule(Parser *p); static void *_tmp_188_rule(Parser *p); static void *_tmp_189_rule(Parser *p); @@ -944,6 +945,9 @@ static void *_tmp_209_rule(Parser *p); static void *_tmp_210_rule(Parser *p); static void *_tmp_211_rule(Parser *p); static void *_tmp_212_rule(Parser *p); +static void *_tmp_213_rule(Parser *p); +static void *_tmp_214_rule(Parser *p); +static void *_tmp_215_rule(Parser *p); // file: statements? $ @@ -1896,7 +1900,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'if' if_stmt")); stmt_ty if_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 637) // token='if' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 634) // token='if' && (if_stmt_var = if_stmt_rule(p)) // if_stmt ) @@ -1980,7 +1984,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'try' try_stmt")); stmt_ty try_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 615) // token='try' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 618) // token='try' && (try_stmt_var = try_stmt_rule(p)) // try_stmt ) @@ -2001,7 +2005,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); stmt_ty while_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 642) // token='while' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 639) // token='while' && (while_stmt_var = while_stmt_rule(p)) // while_stmt ) @@ -4071,7 +4075,7 @@ class_def_raw_rule(Parser *p) void *b; asdl_stmt_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 646)) // token='class' + (_keyword = _PyPegen_expect_token(p, 643)) // token='class' && (a = _PyPegen_name_token(p)) // NAME && @@ -4231,7 +4235,7 @@ function_def_raw_rule(Parser *p) void *params; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 645)) // token='def' + (_keyword = _PyPegen_expect_token(p, 642)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -4291,7 +4295,7 @@ function_def_raw_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 645)) // token='def' + (_keyword = _PyPegen_expect_token(p, 642)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -5339,7 +5343,7 @@ if_stmt_rule(Parser *p) asdl_stmt_seq* b; stmt_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (a = named_expression_rule(p)) // named_expression && @@ -5384,7 +5388,7 @@ if_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (a = named_expression_rule(p)) // named_expression && @@ -5477,7 +5481,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; stmt_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 636)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -5522,7 +5526,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 636)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -5601,7 +5605,7 @@ else_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 640)) // token='else' + (_keyword = _PyPegen_expect_token(p, 637)) // token='else' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -5678,7 +5682,7 @@ while_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 642)) // token='while' + (_keyword = _PyPegen_expect_token(p, 639)) // token='while' && (a = named_expression_rule(p)) // named_expression && @@ -5776,11 +5780,11 @@ for_stmt_rule(Parser *p) expr_ty t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 641)) // token='in' && (_cut_var = 1) && @@ -5840,11 +5844,11 @@ for_stmt_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 641)) // token='in' && (_cut_var = 1) && @@ -6206,7 +6210,7 @@ with_item_rule(Parser *p) if ( (e = expression_rule(p)) // expression && - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (t = star_target_rule(p)) // star_target && @@ -6329,7 +6333,7 @@ try_stmt_rule(Parser *p) asdl_stmt_seq* b; asdl_stmt_seq* f; if ( - (_keyword = _PyPegen_expect_token(p, 615)) // token='try' + (_keyword = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6373,7 +6377,7 @@ try_stmt_rule(Parser *p) asdl_excepthandler_seq* ex; void *f; if ( - (_keyword = _PyPegen_expect_token(p, 615)) // token='try' + (_keyword = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6421,7 +6425,7 @@ try_stmt_rule(Parser *p) asdl_excepthandler_seq* ex; void *f; if ( - (_keyword = _PyPegen_expect_token(p, 615)) // token='try' + (_keyword = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6517,7 +6521,7 @@ except_block_rule(Parser *p) expr_ty e; void *t; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + (_keyword = _PyPegen_expect_token(p, 629)) // token='except' && (e = expression_rule(p)) // expression && @@ -6560,7 +6564,7 @@ except_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + (_keyword = _PyPegen_expect_token(p, 629)) // token='except' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -6617,7 +6621,7 @@ except_block_rule(Parser *p) // except_star_block: // | invalid_except_star_stmt_indent // | 'except' '*' expression ['as' NAME] ':' block -// | invalid_except_star_stmt +// | invalid_except_stmt static excepthandler_ty except_star_block_rule(Parser *p) { @@ -6669,7 +6673,7 @@ except_star_block_rule(Parser *p) expr_ty e; void *t; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + (_keyword = _PyPegen_expect_token(p, 629)) // token='except' && (_literal = _PyPegen_expect_token(p, 16)) // token='*' && @@ -6704,24 +6708,24 @@ except_star_block_rule(Parser *p) D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] ':' block")); } - if (p->call_invalid_rules) { // invalid_except_star_stmt + if (p->call_invalid_rules) { // invalid_except_stmt if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); - void *invalid_except_star_stmt_var; + D(fprintf(stderr, "%*c> except_star_block[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt")); + void *invalid_except_stmt_var; if ( - (invalid_except_star_stmt_var = invalid_except_star_stmt_rule(p)) // invalid_except_star_stmt + (invalid_except_stmt_var = invalid_except_stmt_rule(p)) // invalid_except_stmt ) { - D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_star_stmt")); - _res = invalid_except_star_stmt_var; + D(fprintf(stderr, "%*c+ except_star_block[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "invalid_except_stmt")); + _res = invalid_except_stmt_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s except_star_block[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_star_stmt")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "invalid_except_stmt")); } _res = NULL; done: @@ -6769,7 +6773,7 @@ finally_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* a; if ( - (_keyword = _PyPegen_expect_token(p, 628)) // token='finally' + (_keyword = _PyPegen_expect_token(p, 625)) // token='finally' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -7069,7 +7073,7 @@ guard_rule(Parser *p) Token * _keyword; expr_ty guard; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (guard = named_expression_rule(p)) // named_expression ) @@ -7258,7 +7262,7 @@ as_pattern_rule(Parser *p) if ( (pattern = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (target = pattern_capture_target_rule(p)) // pattern_capture_target ) @@ -9960,11 +9964,11 @@ expression_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 640)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 637)) // token='else' && (c = expression_rule(p)) // expression ) @@ -11464,7 +11468,7 @@ notin_bitwise_or_rule(Parser *p) if ( (_keyword = _PyPegen_expect_token(p, 581)) // token='not' && - (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 641)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -11508,7 +11512,7 @@ in_bitwise_or_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword = _PyPegen_expect_token(p, 641)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -15142,11 +15146,11 @@ for_if_clause_rule(Parser *p) if ( (async_var = _PyPegen_expect_token(p, ASYNC)) // token='ASYNC' && - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 641)) // token='in' && (_cut_var = 1) && @@ -15185,11 +15189,11 @@ for_if_clause_rule(Parser *p) expr_ty b; asdl_expr_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 641)) // token='in' && (_cut_var = 1) && @@ -18299,11 +18303,11 @@ expression_without_invalid_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 640)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 637)) // token='else' && (c = expression_rule(p)) // expression ) @@ -18494,7 +18498,7 @@ invalid_expression_rule(Parser *p) if ( (a = disjunction_rule(p)) // disjunction && - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (b = disjunction_rule(p)) // disjunction && @@ -19600,7 +19604,7 @@ invalid_with_item_rule(Parser *p) if ( (expression_var = expression_rule(p)) // expression && - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (a = expression_rule(p)) // expression && @@ -19650,7 +19654,7 @@ invalid_for_target_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' && (a = star_expressions_rule(p)) // star_expressions ) @@ -19995,7 +19999,10 @@ invalid_with_stmt_indent_rule(Parser *p) return _res; } -// invalid_try_stmt: 'try' ':' NEWLINE !INDENT | 'try' ':' block !('except' | 'finally') +// invalid_try_stmt: +// | 'try' ':' NEWLINE !INDENT +// | 'try' ':' block !('except' | 'finally') +// | 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* static void * invalid_try_stmt_rule(Parser *p) { @@ -20016,7 +20023,7 @@ invalid_try_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 615)) // token='try' + (a = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20048,7 +20055,7 @@ invalid_try_stmt_rule(Parser *p) Token * _literal; asdl_stmt_seq* block_var; if ( - (_keyword = _PyPegen_expect_token(p, 615)) // token='try' + (_keyword = _PyPegen_expect_token(p, 618)) // token='try' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20070,6 +20077,42 @@ invalid_try_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')")); } + { // 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + Token * _keyword; + Token * _literal; + asdl_seq * _loop0_174_var; + asdl_seq * _loop0_176_var; + void *_tmp_175_var; + if ( + (_keyword = _PyPegen_expect_token(p, 618)) // token='try' + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (_loop0_174_var = _loop0_174_rule(p)) // block* + && + (_tmp_175_var = _tmp_175_rule(p)) // (except_block except_star_block) | (except_star_block except_block) + && + (_loop0_176_var = _loop0_176_rule(p)) // block* + ) + { + D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + _res = RAISE_SYNTAX_ERROR ( "cannot have both 'except' and 'except*' on the same 'try'" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + D(p->level--); + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + } _res = NULL; done: D(p->level--); @@ -20077,9 +20120,10 @@ invalid_try_stmt_rule(Parser *p) } // invalid_except_stmt: -// | 'except' expression ',' expressions ['as' NAME] ':' -// | 'except' expression ['as' NAME] NEWLINE +// | 'except' '*'? expression ',' expressions ['as' NAME] ':' +// | 'except' '*'? expression ['as' NAME] NEWLINE // | 'except' NEWLINE +// | 'except' '*' (NEWLINE | ':') static void * invalid_except_stmt_rule(Parser *p) { @@ -20090,21 +20134,25 @@ invalid_except_stmt_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'except' expression ',' expressions ['as' NAME] ':' + { // 'except' '*'? expression ',' expressions ['as' NAME] ':' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'")); Token * _keyword; Token * _literal; Token * _literal_1; void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings + void *_opt_var_1; + UNUSED(_opt_var_1); // Silence compiler warnings expr_ty a; expr_ty expressions_var; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + (_keyword = _PyPegen_expect_token(p, 629)) // token='except' + && + (_opt_var = _PyPegen_expect_token(p, 16), !p->error_indicator) // '*'? && (a = expression_rule(p)) // expression && @@ -20112,12 +20160,12 @@ invalid_except_stmt_rule(Parser *p) && (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_174_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var_1 = _tmp_177_rule(p), !p->error_indicator) // ['as' NAME] && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'")); _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20128,30 +20176,34 @@ invalid_except_stmt_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ',' expressions ['as' NAME] ':'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*'? expression ',' expressions ['as' NAME] ':'")); } - { // 'except' expression ['as' NAME] NEWLINE + { // 'except' '*'? expression ['as' NAME] NEWLINE if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); + D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings + void *_opt_var_1; + UNUSED(_opt_var_1); // Silence compiler warnings Token * a; expr_ty expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' + && + (_opt_var = _PyPegen_expect_token(p, 16), !p->error_indicator) // '*'? && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_175_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var_1 = _tmp_178_rule(p), !p->error_indicator) // ['as' NAME] && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); + D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE")); _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20162,7 +20214,7 @@ invalid_except_stmt_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' expression ['as' NAME] NEWLINE")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*'? expression ['as' NAME] NEWLINE")); } { // 'except' NEWLINE if (p->error_indicator) { @@ -20173,7 +20225,7 @@ invalid_except_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' && (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) @@ -20191,124 +20243,24 @@ invalid_except_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' NEWLINE")); } - _res = NULL; - done: - D(p->level--); - return _res; -} - -// invalid_except_star_stmt: -// | 'except' '*' expression ',' expressions ['as' NAME] ':' -// | 'except' '*' expression ['as' NAME] NEWLINE -// | 'except' '*' (NEWLINE | ':') -static void * -invalid_except_star_stmt_rule(Parser *p) -{ - D(p->level++); - if (p->error_indicator) { - D(p->level--); - return NULL; - } - void * _res = NULL; - int _mark = p->mark; - { // 'except' '*' expression ',' expressions ['as' NAME] ':' - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); - Token * _keyword; - Token * _literal; - Token * _literal_1; - Token * _literal_2; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - expr_ty a; - expr_ty expressions_var; - if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' - && - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (a = expression_rule(p)) // expression - && - (_literal_1 = _PyPegen_expect_token(p, 12)) // token=',' - && - (expressions_var = expressions_rule(p)) // expressions - && - (_opt_var = _tmp_176_rule(p), !p->error_indicator) // ['as' NAME] - && - (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' - ) - { - D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); - _res = RAISE_SYNTAX_ERROR_STARTING_FROM ( a , "multiple exception types must be parenthesized" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ',' expressions ['as' NAME] ':'")); - } - { // 'except' '*' expression ['as' NAME] NEWLINE - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); - Token * _literal; - void *_opt_var; - UNUSED(_opt_var); // Silence compiler warnings - Token * a; - expr_ty expression_var; - Token * newline_var; - if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' - && - (_literal = _PyPegen_expect_token(p, 16)) // token='*' - && - (expression_var = expression_rule(p)) // expression - && - (_opt_var = _tmp_177_rule(p), !p->error_indicator) // ['as' NAME] - && - (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' - ) - { - D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); - _res = RAISE_SYNTAX_ERROR ( "expected ':'" ); - if (_res == NULL && PyErr_Occurred()) { - p->error_indicator = 1; - D(p->level--); - return NULL; - } - goto done; - } - p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' expression ['as' NAME] NEWLINE")); - } { // 'except' '*' (NEWLINE | ':') if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_except_star_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); + D(fprintf(stderr, "%*c> invalid_except_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); Token * _literal; - void *_tmp_178_var; + void *_tmp_179_var; Token * a; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' && (_literal = _PyPegen_expect_token(p, 16)) // token='*' && - (_tmp_178_var = _tmp_178_rule(p)) // NEWLINE | ':' + (_tmp_179_var = _tmp_179_rule(p)) // NEWLINE | ':' ) { - D(fprintf(stderr, "%*c+ invalid_except_star_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); + D(fprintf(stderr, "%*c+ invalid_except_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except' '*' (NEWLINE | ':')")); _res = RAISE_SYNTAX_ERROR ( "expected one or more exception types" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20318,7 +20270,7 @@ invalid_except_star_stmt_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s invalid_except_star_stmt[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s invalid_except_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'except' '*' (NEWLINE | ':')")); } _res = NULL; @@ -20348,7 +20300,7 @@ invalid_finally_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 628)) // token='finally' + (a = _PyPegen_expect_token(p, 625)) // token='finally' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20402,11 +20354,11 @@ invalid_except_stmt_indent_rule(Parser *p) expr_ty expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_179_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var = _tmp_180_rule(p), !p->error_indicator) // ['as' NAME] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20438,7 +20390,7 @@ invalid_except_stmt_indent_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20492,13 +20444,13 @@ invalid_except_star_stmt_indent_rule(Parser *p) expr_ty expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 632)) // token='except' + (a = _PyPegen_expect_token(p, 629)) // token='except' && (_literal = _PyPegen_expect_token(p, 16)) // token='*' && (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_180_rule(p), !p->error_indicator) // ['as' NAME] + (_opt_var = _tmp_181_rule(p), !p->error_indicator) // ['as' NAME] && (_literal_1 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -20723,7 +20675,7 @@ invalid_as_pattern_rule(Parser *p) if ( (or_pattern_var = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (a = _PyPegen_expect_soft_keyword(p, "_")) // soft_keyword='"_"' ) @@ -20753,7 +20705,7 @@ invalid_as_pattern_rule(Parser *p) if ( (or_pattern_var = or_pattern_rule(p)) // or_pattern && - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && _PyPegen_lookahead_with_name(0, _PyPegen_name_token, p) && @@ -20850,7 +20802,7 @@ invalid_class_argument_pattern_rule(Parser *p) asdl_pattern_seq* a; asdl_seq* keyword_patterns_var; if ( - (_opt_var = _tmp_181_rule(p), !p->error_indicator) // [positional_patterns ','] + (_opt_var = _tmp_182_rule(p), !p->error_indicator) // [positional_patterns ','] && (keyword_patterns_var = keyword_patterns_rule(p)) // keyword_patterns && @@ -20901,7 +20853,7 @@ invalid_if_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -20932,7 +20884,7 @@ invalid_if_stmt_rule(Parser *p) expr_ty a_1; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 637)) // token='if' + (a = _PyPegen_expect_token(p, 634)) // token='if' && (a_1 = named_expression_rule(p)) // named_expression && @@ -20985,7 +20937,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 639)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 636)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -21016,7 +20968,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 639)) // token='elif' + (a = _PyPegen_expect_token(p, 636)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -21067,7 +21019,7 @@ invalid_else_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 640)) // token='else' + (a = _PyPegen_expect_token(p, 637)) // token='else' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -21118,7 +21070,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 642)) // token='while' + (_keyword = _PyPegen_expect_token(p, 639)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -21149,7 +21101,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 642)) // token='while' + (a = _PyPegen_expect_token(p, 639)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -21207,11 +21159,11 @@ invalid_for_stmt_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 643)) // token='for' + (a = _PyPegen_expect_token(p, 640)) // token='for' && (star_targets_var = star_targets_rule(p)) // star_targets && - (_keyword = _PyPegen_expect_token(p, 644)) // token='in' + (_keyword = _PyPegen_expect_token(p, 641)) // token='in' && (star_expressions_var = star_expressions_rule(p)) // star_expressions && @@ -21274,7 +21226,7 @@ invalid_def_raw_rule(Parser *p) if ( (_opt_var = _PyPegen_expect_token(p, ASYNC), !p->error_indicator) // ASYNC? && - (a = _PyPegen_expect_token(p, 645)) // token='def' + (a = _PyPegen_expect_token(p, 642)) // token='def' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -21284,7 +21236,7 @@ invalid_def_raw_rule(Parser *p) && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' && - (_opt_var_2 = _tmp_182_rule(p), !p->error_indicator) // ['->' expression] + (_opt_var_2 = _tmp_183_rule(p), !p->error_indicator) // ['->' expression] && (_literal_2 = _PyPegen_expect_token(p, 11)) // token=':' && @@ -21336,11 +21288,11 @@ invalid_class_def_raw_rule(Parser *p) expr_ty name_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 646)) // token='class' + (a = _PyPegen_expect_token(p, 643)) // token='class' && (name_var = _PyPegen_name_token(p)) // NAME && - (_opt_var = _tmp_183_rule(p), !p->error_indicator) // ['(' arguments? ')'] + (_opt_var = _tmp_184_rule(p), !p->error_indicator) // ['(' arguments? ')'] && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -21388,11 +21340,11 @@ invalid_double_starred_kvpairs_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> invalid_double_starred_kvpairs[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - asdl_seq * _gather_184_var; + asdl_seq * _gather_185_var; Token * _literal; void *invalid_kvpair_var; if ( - (_gather_184_var = _gather_184_rule(p)) // ','.double_starred_kvpair+ + (_gather_185_var = _gather_185_rule(p)) // ','.double_starred_kvpair+ && (_literal = _PyPegen_expect_token(p, 12)) // token=',' && @@ -21400,7 +21352,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','.double_starred_kvpair+ ',' invalid_kvpair")); - _res = _PyPegen_dummy_name(p, _gather_184_var, _literal, invalid_kvpair_var); + _res = _PyPegen_dummy_name(p, _gather_185_var, _literal, invalid_kvpair_var); goto done; } p->mark = _mark; @@ -21453,7 +21405,7 @@ invalid_double_starred_kvpairs_rule(Parser *p) && (a = _PyPegen_expect_token(p, 11)) // token=':' && - _PyPegen_lookahead(1, _tmp_186_rule, p) + _PyPegen_lookahead(1, _tmp_187_rule, p) ) { D(fprintf(stderr, "%*c+ invalid_double_starred_kvpairs[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ':' &('}' | ',')")); @@ -21969,7 +21921,7 @@ _tmp_7_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 645)) // token='def' + (_keyword = _PyPegen_expect_token(p, 642)) // token='def' ) { D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); @@ -22043,7 +21995,7 @@ _tmp_8_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 646)) // token='class' + (_keyword = _PyPegen_expect_token(p, 643)) // token='class' ) { D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); @@ -22153,7 +22105,7 @@ _tmp_10_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_10[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 643)) // token='for' + (_keyword = _PyPegen_expect_token(p, 640)) // token='for' ) { D(fprintf(stderr, "%*c+ _tmp_10[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); @@ -22370,12 +22322,12 @@ _loop1_14_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_14[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_187_var; + void *_tmp_188_var; while ( - (_tmp_187_var = _tmp_187_rule(p)) // star_targets '=' + (_tmp_188_var = _tmp_188_rule(p)) // star_targets '=' ) { - _res = _tmp_187_var; + _res = _tmp_188_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22922,12 +22874,12 @@ _loop0_24_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_24[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_188_var; + void *_tmp_189_var; while ( - (_tmp_188_var = _tmp_188_rule(p)) // '.' | '...' + (_tmp_189_var = _tmp_189_rule(p)) // '.' | '...' ) { - _res = _tmp_188_var; + _res = _tmp_189_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -22988,12 +22940,12 @@ _loop1_25_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_25[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('.' | '...')")); - void *_tmp_189_var; + void *_tmp_190_var; while ( - (_tmp_189_var = _tmp_189_rule(p)) // '.' | '...' + (_tmp_190_var = _tmp_190_rule(p)) // '.' | '...' ) { - _res = _tmp_189_var; + _res = _tmp_190_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -23166,7 +23118,7 @@ _tmp_28_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -23324,7 +23276,7 @@ _tmp_31_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -23375,12 +23327,12 @@ _loop1_32_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_32[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('@' named_expression NEWLINE)")); - void *_tmp_190_var; + void *_tmp_191_var; while ( - (_tmp_190_var = _tmp_190_rule(p)) // '@' named_expression NEWLINE + (_tmp_191_var = _tmp_191_rule(p)) // '@' named_expression NEWLINE ) { - _res = _tmp_190_var; + _res = _tmp_191_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -25205,7 +25157,7 @@ _tmp_61_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -25249,7 +25201,7 @@ _tmp_62_rule(Parser *p) Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (z = _PyPegen_name_token(p)) // NAME ) @@ -26254,12 +26206,12 @@ _loop1_79_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_79[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' expression)")); - void *_tmp_191_var; + void *_tmp_192_var; while ( - (_tmp_191_var = _tmp_191_rule(p)) // ',' expression + (_tmp_192_var = _tmp_192_rule(p)) // ',' expression ) { - _res = _tmp_191_var; + _res = _tmp_192_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26325,12 +26277,12 @@ _loop1_80_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_80[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_expression)")); - void *_tmp_192_var; + void *_tmp_193_var; while ( - (_tmp_192_var = _tmp_192_rule(p)) // ',' star_expression + (_tmp_193_var = _tmp_193_rule(p)) // ',' star_expression ) { - _res = _tmp_192_var; + _res = _tmp_193_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26510,12 +26462,12 @@ _loop1_83_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_83[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('or' conjunction)")); - void *_tmp_193_var; + void *_tmp_194_var; while ( - (_tmp_193_var = _tmp_193_rule(p)) // 'or' conjunction + (_tmp_194_var = _tmp_194_rule(p)) // 'or' conjunction ) { - _res = _tmp_193_var; + _res = _tmp_194_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -26581,12 +26533,12 @@ _loop1_84_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_84[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('and' inversion)")); - void *_tmp_194_var; + void *_tmp_195_var; while ( - (_tmp_194_var = _tmp_194_rule(p)) // 'and' inversion + (_tmp_195_var = _tmp_195_rule(p)) // 'and' inversion ) { - _res = _tmp_194_var; + _res = _tmp_195_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28461,12 +28413,12 @@ _loop0_113_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_195_var; + void *_tmp_196_var; while ( - (_tmp_195_var = _tmp_195_rule(p)) // 'if' disjunction + (_tmp_196_var = _tmp_196_rule(p)) // 'if' disjunction ) { - _res = _tmp_195_var; + _res = _tmp_196_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28527,12 +28479,12 @@ _loop0_114_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_114[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "('if' disjunction)")); - void *_tmp_196_var; + void *_tmp_197_var; while ( - (_tmp_196_var = _tmp_196_rule(p)) // 'if' disjunction + (_tmp_197_var = _tmp_197_rule(p)) // 'if' disjunction ) { - _res = _tmp_196_var; + _res = _tmp_197_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -28655,7 +28607,7 @@ _loop0_117_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_197_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' + (elem = _tmp_198_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' ) { _res = elem; @@ -28719,7 +28671,7 @@ _gather_116_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_197_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' + (elem = _tmp_198_rule(p)) // starred_expression | (assignment_expression | expression !':=') !'=' && (seq = _loop0_117_rule(p)) // _loop0_117 ) @@ -29265,12 +29217,12 @@ _loop0_127_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_127[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_198_var; + void *_tmp_199_var; while ( - (_tmp_198_var = _tmp_198_rule(p)) // ',' star_target + (_tmp_199_var = _tmp_199_rule(p)) // ',' star_target ) { - _res = _tmp_198_var; + _res = _tmp_199_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -29445,12 +29397,12 @@ _loop1_130_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop1_130[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(',' star_target)")); - void *_tmp_199_var; + void *_tmp_200_var; while ( - (_tmp_199_var = _tmp_199_rule(p)) // ',' star_target + (_tmp_200_var = _tmp_200_rule(p)) // ',' star_target ) { - _res = _tmp_199_var; + _res = _tmp_200_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -30384,7 +30336,7 @@ _tmp_147_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_147[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 640)) // token='else' + (_keyword = _PyPegen_expect_token(p, 637)) // token='else' ) { D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'")); @@ -30754,12 +30706,12 @@ _loop0_152_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_152[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_200_var; + void *_tmp_201_var; while ( - (_tmp_200_var = _tmp_200_rule(p)) // star_targets '=' + (_tmp_201_var = _tmp_201_rule(p)) // star_targets '=' ) { - _res = _tmp_200_var; + _res = _tmp_201_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -30820,12 +30772,12 @@ _loop0_153_rule(Parser *p) return NULL; } D(fprintf(stderr, "%*c> _loop0_153[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(star_targets '=')")); - void *_tmp_201_var; + void *_tmp_202_var; while ( - (_tmp_201_var = _tmp_201_rule(p)) // star_targets '=' + (_tmp_202_var = _tmp_202_rule(p)) // star_targets '=' ) { - _res = _tmp_201_var; + _res = _tmp_202_var; if (_n == _children_capacity) { _children_capacity *= 2; void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *)); @@ -31409,15 +31361,15 @@ _tmp_162_rule(Parser *p) } D(fprintf(stderr, "%*c> _tmp_162[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); Token * _literal; - void *_tmp_202_var; + void *_tmp_203_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_202_var = _tmp_202_rule(p)) // ')' | '**' + (_tmp_203_var = _tmp_203_rule(p)) // ')' | '**' ) { D(fprintf(stderr, "%*c+ _tmp_162[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (')' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_202_var); + _res = _PyPegen_dummy_name(p, _literal, _tmp_203_var); goto done; } p->mark = _mark; @@ -31467,15 +31419,15 @@ _tmp_163_rule(Parser *p) } D(fprintf(stderr, "%*c> _tmp_163[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); Token * _literal; - void *_tmp_203_var; + void *_tmp_204_var; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (_tmp_203_var = _tmp_203_rule(p)) // ':' | '**' + (_tmp_204_var = _tmp_204_rule(p)) // ':' | '**' ) { D(fprintf(stderr, "%*c+ _tmp_163[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' (':' | '**')")); - _res = _PyPegen_dummy_name(p, _literal, _tmp_203_var); + _res = _PyPegen_dummy_name(p, _literal, _tmp_204_var); goto done; } p->mark = _mark; @@ -31594,7 +31546,7 @@ _loop0_166_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_204_rule(p)) // expression ['as' star_target] + (elem = _tmp_205_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -31657,7 +31609,7 @@ _gather_165_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_204_rule(p)) // expression ['as' star_target] + (elem = _tmp_205_rule(p)) // expression ['as' star_target] && (seq = _loop0_166_rule(p)) // _loop0_166 ) @@ -31708,7 +31660,7 @@ _loop0_168_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_205_rule(p)) // expressions ['as' star_target] + (elem = _tmp_206_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -31771,7 +31723,7 @@ _gather_167_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_205_rule(p)) // expressions ['as' star_target] + (elem = _tmp_206_rule(p)) // expressions ['as' star_target] && (seq = _loop0_168_rule(p)) // _loop0_168 ) @@ -31822,7 +31774,7 @@ _loop0_170_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_206_rule(p)) // expression ['as' star_target] + (elem = _tmp_207_rule(p)) // expression ['as' star_target] ) { _res = elem; @@ -31885,7 +31837,7 @@ _gather_169_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_206_rule(p)) // expression ['as' star_target] + (elem = _tmp_207_rule(p)) // expression ['as' star_target] && (seq = _loop0_170_rule(p)) // _loop0_170 ) @@ -31936,7 +31888,7 @@ _loop0_172_rule(Parser *p) while ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' && - (elem = _tmp_207_rule(p)) // expressions ['as' star_target] + (elem = _tmp_208_rule(p)) // expressions ['as' star_target] ) { _res = elem; @@ -31999,7 +31951,7 @@ _gather_171_rule(Parser *p) void *elem; asdl_seq * seq; if ( - (elem = _tmp_207_rule(p)) // expressions ['as' star_target] + (elem = _tmp_208_rule(p)) // expressions ['as' star_target] && (seq = _loop0_172_rule(p)) // _loop0_172 ) @@ -32037,7 +31989,7 @@ _tmp_173_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'except'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 632)) // token='except' + (_keyword = _PyPegen_expect_token(p, 629)) // token='except' ) { D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'except'")); @@ -32056,7 +32008,7 @@ _tmp_173_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_173[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'finally'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 628)) // token='finally' + (_keyword = _PyPegen_expect_token(p, 625)) // token='finally' ) { D(fprintf(stderr, "%*c+ _tmp_173[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'finally'")); @@ -32073,46 +32025,73 @@ _tmp_173_rule(Parser *p) return _res; } -// _tmp_174: 'as' NAME -static void * -_tmp_174_rule(Parser *p) +// _loop0_174: block +static asdl_seq * +_loop0_174_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; + { // block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty name_var; - if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' - && - (name_var = _PyPegen_name_token(p)) // NAME + D(fprintf(stderr, "%*c> _loop0_174[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block")); + asdl_stmt_seq* block_var; + while ( + (block_var = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ _tmp_174[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = _PyPegen_dummy_name(p, _keyword, name_var); - goto done; + _res = 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 _tmp_174[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _loop0_174[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block")); } - _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_174_type, _seq); D(p->level--); - return _res; + return _seq; } -// _tmp_175: 'as' NAME +// _tmp_175: (except_block except_star_block) | (except_star_block except_block) static void * _tmp_175_rule(Parser *p) { @@ -32123,27 +32102,43 @@ _tmp_175_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'as' NAME + { // (except_block except_star_block) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty name_var; + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_block except_star_block)")); + void *_tmp_209_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' - && - (name_var = _PyPegen_name_token(p)) // NAME + (_tmp_209_var = _tmp_209_rule(p)) // except_block except_star_block ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = _PyPegen_dummy_name(p, _keyword, name_var); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_block except_star_block)")); + _res = _tmp_209_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_block except_star_block)")); + } + { // (except_star_block except_block) + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_star_block except_block)")); + void *_tmp_210_var; + if ( + (_tmp_210_var = _tmp_210_rule(p)) // except_star_block except_block + ) + { + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_star_block except_block)")); + _res = _tmp_210_var; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_star_block except_block)")); } _res = NULL; done: @@ -32151,43 +32146,70 @@ _tmp_175_rule(Parser *p) return _res; } -// _tmp_176: 'as' NAME -static void * -_tmp_176_rule(Parser *p) +// _loop0_176: block +static asdl_seq * +_loop0_176_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; + { // block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty name_var; - if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' - && - (name_var = _PyPegen_name_token(p)) // NAME + D(fprintf(stderr, "%*c> _loop0_176[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "block")); + asdl_stmt_seq* block_var; + while ( + (block_var = block_rule(p)) // block ) { - D(fprintf(stderr, "%*c+ _tmp_176[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = _PyPegen_dummy_name(p, _keyword, name_var); - goto done; + _res = 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 _tmp_176[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + D(fprintf(stderr, "%*c%s _loop0_176[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "block")); } - _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_176_type, _seq); D(p->level--); - return _res; + return _seq; } // _tmp_177: 'as' NAME @@ -32210,7 +32232,7 @@ _tmp_177_rule(Parser *p) Token * _keyword; expr_ty name_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (name_var = _PyPegen_name_token(p)) // NAME ) @@ -32229,7 +32251,7 @@ _tmp_177_rule(Parser *p) return _res; } -// _tmp_178: NEWLINE | ':' +// _tmp_178: 'as' NAME static void * _tmp_178_rule(Parser *p) { @@ -32240,43 +32262,27 @@ _tmp_178_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // NEWLINE - if (p->error_indicator) { - D(p->level--); - return NULL; - } - D(fprintf(stderr, "%*c> _tmp_178[%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_178[%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_178[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); - } - { // ':' + { // 'as' NAME if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); - Token * _literal; + D(fprintf(stderr, "%*c> _tmp_178[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; if ( - (_literal = _PyPegen_expect_token(p, 11)) // token=':' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME ) { - D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); - _res = _literal; + D(fprintf(stderr, "%*c+ _tmp_178[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_178[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); } _res = NULL; done: @@ -32284,7 +32290,7 @@ _tmp_178_rule(Parser *p) return _res; } -// _tmp_179: 'as' NAME +// _tmp_179: NEWLINE | ':' static void * _tmp_179_rule(Parser *p) { @@ -32295,27 +32301,43 @@ _tmp_179_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // 'as' NAME + { // NEWLINE if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - Token * _keyword; - expr_ty name_var; + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "NEWLINE")); + Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' - && - (name_var = _PyPegen_name_token(p)) // NAME + (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); - _res = _PyPegen_dummy_name(p, _keyword, name_var); + D(fprintf(stderr, "%*c+ _tmp_179[%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_179[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "NEWLINE")); + } + { // ':' + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_179[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + Token * _literal; + if ( + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + ) + { + D(fprintf(stderr, "%*c+ _tmp_179[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + _res = _literal; + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_179[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } _res = NULL; done: @@ -32343,7 +32365,7 @@ _tmp_180_rule(Parser *p) Token * _keyword; expr_ty name_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (name_var = _PyPegen_name_token(p)) // NAME ) @@ -32362,9 +32384,48 @@ _tmp_180_rule(Parser *p) return _res; } -// _tmp_181: positional_patterns ',' +// _tmp_181: 'as' NAME static void * _tmp_181_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // 'as' NAME + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + Token * _keyword; + expr_ty name_var; + if ( + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' + && + (name_var = _PyPegen_name_token(p)) // NAME + ) + { + D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' NAME")); + _res = _PyPegen_dummy_name(p, _keyword, name_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' NAME")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_182: positional_patterns ',' +static void * +_tmp_182_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32378,7 +32439,7 @@ _tmp_181_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_181[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); + D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); Token * _literal; asdl_pattern_seq* positional_patterns_var; if ( @@ -32387,12 +32448,12 @@ _tmp_181_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_181[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); + D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "positional_patterns ','")); _res = _PyPegen_dummy_name(p, positional_patterns_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_181[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "positional_patterns ','")); } _res = NULL; @@ -32401,9 +32462,9 @@ _tmp_181_rule(Parser *p) return _res; } -// _tmp_182: '->' expression +// _tmp_183: '->' expression static void * -_tmp_182_rule(Parser *p) +_tmp_183_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32417,7 +32478,7 @@ _tmp_182_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_182[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'->' expression")); Token * _literal; expr_ty expression_var; if ( @@ -32426,12 +32487,12 @@ _tmp_182_rule(Parser *p) (expression_var = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_182[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); + D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'->' expression")); _res = _PyPegen_dummy_name(p, _literal, expression_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_182[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'->' expression")); } _res = NULL; @@ -32440,9 +32501,9 @@ _tmp_182_rule(Parser *p) return _res; } -// _tmp_183: '(' arguments? ')' +// _tmp_184: '(' arguments? ')' static void * -_tmp_183_rule(Parser *p) +_tmp_184_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32456,7 +32517,7 @@ _tmp_183_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_183[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c> _tmp_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); Token * _literal; Token * _literal_1; void *_opt_var; @@ -32469,12 +32530,12 @@ _tmp_183_rule(Parser *p) (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_183[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); + D(fprintf(stderr, "%*c+ _tmp_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' arguments? ')'")); _res = _PyPegen_dummy_name(p, _literal, _opt_var, _literal_1); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_183[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_184[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' arguments? ')'")); } _res = NULL; @@ -32483,9 +32544,9 @@ _tmp_183_rule(Parser *p) return _res; } -// _loop0_185: ',' double_starred_kvpair +// _loop0_186: ',' double_starred_kvpair static asdl_seq * -_loop0_185_rule(Parser *p) +_loop0_186_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32509,7 +32570,7 @@ _loop0_185_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _loop0_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); + D(fprintf(stderr, "%*c> _loop0_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' double_starred_kvpair")); Token * _literal; KeyValuePair* elem; while ( @@ -32540,7 +32601,7 @@ _loop0_185_rule(Parser *p) _mark = p->mark; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _loop0_185[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _loop0_186[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' double_starred_kvpair")); } asdl_seq *_seq = (asdl_seq*)_Py_asdl_generic_seq_new(_n, p->arena); @@ -32553,14 +32614,14 @@ _loop0_185_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_185_type, _seq); + _PyPegen_insert_memo(p, _start_mark, _loop0_186_type, _seq); D(p->level--); return _seq; } -// _gather_184: double_starred_kvpair _loop0_185 +// _gather_185: double_starred_kvpair _loop0_186 static asdl_seq * -_gather_184_rule(Parser *p) +_gather_185_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32569,27 +32630,27 @@ _gather_184_rule(Parser *p) } asdl_seq * _res = NULL; int _mark = p->mark; - { // double_starred_kvpair _loop0_185 + { // double_starred_kvpair _loop0_186 if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _gather_184[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_185")); + D(fprintf(stderr, "%*c> _gather_185[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_186")); KeyValuePair* elem; asdl_seq * seq; if ( (elem = double_starred_kvpair_rule(p)) // double_starred_kvpair && - (seq = _loop0_185_rule(p)) // _loop0_185 + (seq = _loop0_186_rule(p)) // _loop0_186 ) { - D(fprintf(stderr, "%*c+ _gather_184[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_185")); + D(fprintf(stderr, "%*c+ _gather_185[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "double_starred_kvpair _loop0_186")); _res = _PyPegen_seq_insert_in_front(p, elem, seq); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _gather_184[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_185")); + D(fprintf(stderr, "%*c%s _gather_185[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "double_starred_kvpair _loop0_186")); } _res = NULL; done: @@ -32597,9 +32658,9 @@ _gather_184_rule(Parser *p) return _res; } -// _tmp_186: '}' | ',' +// _tmp_187: '}' | ',' static void * -_tmp_186_rule(Parser *p) +_tmp_187_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32613,18 +32674,18 @@ _tmp_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'}'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 26)) // token='}' ) { - D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); + D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'}'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'}'")); } { // ',' @@ -32632,18 +32693,18 @@ _tmp_186_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_186[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "','")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 12)) // token=',' ) { - D(fprintf(stderr, "%*c+ _tmp_186[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); + D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "','")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_186[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "','")); } _res = NULL; @@ -32652,9 +32713,9 @@ _tmp_186_rule(Parser *p) return _res; } -// _tmp_187: star_targets '=' +// _tmp_188: star_targets '=' static void * -_tmp_187_rule(Parser *p) +_tmp_188_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32668,7 +32729,7 @@ _tmp_187_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_187[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty z; if ( @@ -32677,7 +32738,7 @@ _tmp_187_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_187[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32687,7 +32748,7 @@ _tmp_187_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_187[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -32696,9 +32757,9 @@ _tmp_187_rule(Parser *p) return _res; } -// _tmp_188: '.' | '...' +// _tmp_189: '.' | '...' static void * -_tmp_188_rule(Parser *p) +_tmp_189_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32712,18 +32773,18 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -32731,18 +32792,18 @@ _tmp_188_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_188[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_188[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_188[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -32751,9 +32812,9 @@ _tmp_188_rule(Parser *p) return _res; } -// _tmp_189: '.' | '...' +// _tmp_190: '.' | '...' static void * -_tmp_189_rule(Parser *p) +_tmp_190_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32767,18 +32828,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'.'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 23)) // token='.' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); + D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'.'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'.'")); } { // '...' @@ -32786,18 +32847,18 @@ _tmp_189_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_189[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'...'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 52)) // token='...' ) { - D(fprintf(stderr, "%*c+ _tmp_189[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); + D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'...'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_189[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'...'")); } _res = NULL; @@ -32806,9 +32867,9 @@ _tmp_189_rule(Parser *p) return _res; } -// _tmp_190: '@' named_expression NEWLINE +// _tmp_191: '@' named_expression NEWLINE static void * -_tmp_190_rule(Parser *p) +_tmp_191_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32822,7 +32883,7 @@ _tmp_190_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_190[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); Token * _literal; expr_ty f; Token * newline_var; @@ -32834,7 +32895,7 @@ _tmp_190_rule(Parser *p) (newline_var = _PyPegen_expect_token(p, NEWLINE)) // token='NEWLINE' ) { - D(fprintf(stderr, "%*c+ _tmp_190[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); + D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'@' named_expression NEWLINE")); _res = f; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32844,7 +32905,7 @@ _tmp_190_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_190[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'@' named_expression NEWLINE")); } _res = NULL; @@ -32853,9 +32914,9 @@ _tmp_190_rule(Parser *p) return _res; } -// _tmp_191: ',' expression +// _tmp_192: ',' expression static void * -_tmp_191_rule(Parser *p) +_tmp_192_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32869,7 +32930,7 @@ _tmp_191_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_191[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' expression")); Token * _literal; expr_ty c; if ( @@ -32878,7 +32939,7 @@ _tmp_191_rule(Parser *p) (c = expression_rule(p)) // expression ) { - D(fprintf(stderr, "%*c+ _tmp_191[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); + D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32888,7 +32949,7 @@ _tmp_191_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_191[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' expression")); } _res = NULL; @@ -32897,9 +32958,9 @@ _tmp_191_rule(Parser *p) return _res; } -// _tmp_192: ',' star_expression +// _tmp_193: ',' star_expression static void * -_tmp_192_rule(Parser *p) +_tmp_193_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32913,7 +32974,7 @@ _tmp_192_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_192[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_expression")); Token * _literal; expr_ty c; if ( @@ -32922,7 +32983,7 @@ _tmp_192_rule(Parser *p) (c = star_expression_rule(p)) // star_expression ) { - D(fprintf(stderr, "%*c+ _tmp_192[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); + D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_expression")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32932,7 +32993,7 @@ _tmp_192_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_192[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_expression")); } _res = NULL; @@ -32941,9 +33002,9 @@ _tmp_192_rule(Parser *p) return _res; } -// _tmp_193: 'or' conjunction +// _tmp_194: 'or' conjunction static void * -_tmp_193_rule(Parser *p) +_tmp_194_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -32957,7 +33018,7 @@ _tmp_193_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_193[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); Token * _keyword; expr_ty c; if ( @@ -32966,7 +33027,7 @@ _tmp_193_rule(Parser *p) (c = conjunction_rule(p)) // conjunction ) { - D(fprintf(stderr, "%*c+ _tmp_193[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); + D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'or' conjunction")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -32976,7 +33037,7 @@ _tmp_193_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_193[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'or' conjunction")); } _res = NULL; @@ -32985,9 +33046,9 @@ _tmp_193_rule(Parser *p) return _res; } -// _tmp_194: 'and' inversion +// _tmp_195: 'and' inversion static void * -_tmp_194_rule(Parser *p) +_tmp_195_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33001,7 +33062,7 @@ _tmp_194_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_194[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'and' inversion")); Token * _keyword; expr_ty c; if ( @@ -33010,7 +33071,7 @@ _tmp_194_rule(Parser *p) (c = inversion_rule(p)) // inversion ) { - D(fprintf(stderr, "%*c+ _tmp_194[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); + D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'and' inversion")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -33020,7 +33081,7 @@ _tmp_194_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_194[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'and' inversion")); } _res = NULL; @@ -33029,9 +33090,9 @@ _tmp_194_rule(Parser *p) return _res; } -// _tmp_195: 'if' disjunction +// _tmp_196: 'if' disjunction static void * -_tmp_195_rule(Parser *p) +_tmp_196_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33045,16 +33106,16 @@ _tmp_195_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_195[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_195[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -33064,7 +33125,7 @@ _tmp_195_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_195[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -33073,9 +33134,9 @@ _tmp_195_rule(Parser *p) return _res; } -// _tmp_196: 'if' disjunction +// _tmp_197: 'if' disjunction static void * -_tmp_196_rule(Parser *p) +_tmp_197_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33089,16 +33150,16 @@ _tmp_196_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_196[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); Token * _keyword; expr_ty z; if ( - (_keyword = _PyPegen_expect_token(p, 637)) // token='if' + (_keyword = _PyPegen_expect_token(p, 634)) // token='if' && (z = disjunction_rule(p)) // disjunction ) { - D(fprintf(stderr, "%*c+ _tmp_196[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); + D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction")); _res = z; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -33108,7 +33169,7 @@ _tmp_196_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_196[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'if' disjunction")); } _res = NULL; @@ -33117,9 +33178,9 @@ _tmp_196_rule(Parser *p) return _res; } -// _tmp_197: starred_expression | (assignment_expression | expression !':=') !'=' +// _tmp_198: starred_expression | (assignment_expression | expression !':=') !'=' static void * -_tmp_197_rule(Parser *p) +_tmp_198_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33133,18 +33194,18 @@ _tmp_197_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "starred_expression")); expr_ty starred_expression_var; if ( (starred_expression_var = starred_expression_rule(p)) // starred_expression ) { - D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); + D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "starred_expression")); _res = starred_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "starred_expression")); } { // (assignment_expression | expression !':=') !'=' @@ -33152,20 +33213,20 @@ _tmp_197_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_197[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); - void *_tmp_208_var; + D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); + void *_tmp_211_var; if ( - (_tmp_208_var = _tmp_208_rule(p)) // assignment_expression | expression !':=' + (_tmp_211_var = _tmp_211_rule(p)) // assignment_expression | expression !':=' && _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 22) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_197[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); - _res = _tmp_208_var; + D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(assignment_expression | expression !':=') !'='")); + _res = _tmp_211_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_197[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(assignment_expression | expression !':=') !'='")); } _res = NULL; @@ -33174,9 +33235,9 @@ _tmp_197_rule(Parser *p) return _res; } -// _tmp_198: ',' star_target +// _tmp_199: ',' star_target static void * -_tmp_198_rule(Parser *p) +_tmp_199_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33190,7 +33251,7 @@ _tmp_198_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_198[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -33199,7 +33260,7 @@ _tmp_198_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_198[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -33209,7 +33270,7 @@ _tmp_198_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_198[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -33218,9 +33279,9 @@ _tmp_198_rule(Parser *p) return _res; } -// _tmp_199: ',' star_target +// _tmp_200: ',' star_target static void * -_tmp_199_rule(Parser *p) +_tmp_200_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33234,7 +33295,7 @@ _tmp_199_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_199[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "',' star_target")); Token * _literal; expr_ty c; if ( @@ -33243,7 +33304,7 @@ _tmp_199_rule(Parser *p) (c = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_199[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); + D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "',' star_target")); _res = c; if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -33253,7 +33314,7 @@ _tmp_199_rule(Parser *p) goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_199[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "',' star_target")); } _res = NULL; @@ -33262,9 +33323,9 @@ _tmp_199_rule(Parser *p) return _res; } -// _tmp_200: star_targets '=' +// _tmp_201: star_targets '=' static void * -_tmp_200_rule(Parser *p) +_tmp_201_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33278,7 +33339,7 @@ _tmp_200_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_200[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -33287,12 +33348,12 @@ _tmp_200_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_200[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_200[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -33301,9 +33362,9 @@ _tmp_200_rule(Parser *p) return _res; } -// _tmp_201: star_targets '=' +// _tmp_202: star_targets '=' static void * -_tmp_201_rule(Parser *p) +_tmp_202_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33317,7 +33378,7 @@ _tmp_201_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_201[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "star_targets '='")); Token * _literal; expr_ty star_targets_var; if ( @@ -33326,12 +33387,12 @@ _tmp_201_rule(Parser *p) (_literal = _PyPegen_expect_token(p, 22)) // token='=' ) { - D(fprintf(stderr, "%*c+ _tmp_201[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); + D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "star_targets '='")); _res = _PyPegen_dummy_name(p, star_targets_var, _literal); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_201[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "star_targets '='")); } _res = NULL; @@ -33340,9 +33401,9 @@ _tmp_201_rule(Parser *p) return _res; } -// _tmp_202: ')' | '**' +// _tmp_203: ')' | '**' static void * -_tmp_202_rule(Parser *p) +_tmp_203_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33356,18 +33417,18 @@ _tmp_202_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "')'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); + D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "')'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "')'")); } { // '**' @@ -33375,18 +33436,18 @@ _tmp_202_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_202[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_202[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_202[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -33395,9 +33456,9 @@ _tmp_202_rule(Parser *p) return _res; } -// _tmp_203: ':' | '**' +// _tmp_204: ':' | '**' static void * -_tmp_203_rule(Parser *p) +_tmp_204_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33411,18 +33472,18 @@ _tmp_203_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "':'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 11)) // token=':' ) { - D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); + D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "':'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "':'")); } { // '**' @@ -33430,18 +33491,18 @@ _tmp_203_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_203[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'**'")); Token * _literal; if ( (_literal = _PyPegen_expect_token(p, 35)) // token='**' ) { - D(fprintf(stderr, "%*c+ _tmp_203[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); + D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'**'")); _res = _literal; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_203[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'**'")); } _res = NULL; @@ -33450,9 +33511,9 @@ _tmp_203_rule(Parser *p) return _res; } -// _tmp_204: expression ['as' star_target] +// _tmp_205: expression ['as' star_target] static void * -_tmp_204_rule(Parser *p) +_tmp_205_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33466,22 +33527,22 @@ _tmp_204_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_204[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_209_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_212_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_204[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); _res = _PyPegen_dummy_name(p, expression_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_204[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -33490,9 +33551,9 @@ _tmp_204_rule(Parser *p) return _res; } -// _tmp_205: expressions ['as' star_target] +// _tmp_206: expressions ['as' star_target] static void * -_tmp_205_rule(Parser *p) +_tmp_206_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33506,22 +33567,22 @@ _tmp_205_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_205[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expressions_var; if ( (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_210_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_213_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_205[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_205[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -33530,9 +33591,9 @@ _tmp_205_rule(Parser *p) return _res; } -// _tmp_206: expression ['as' star_target] +// _tmp_207: expression ['as' star_target] static void * -_tmp_206_rule(Parser *p) +_tmp_207_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33546,22 +33607,22 @@ _tmp_206_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_206[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_207[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression && - (_opt_var = _tmp_211_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_214_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_206[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_207[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression ['as' star_target]")); _res = _PyPegen_dummy_name(p, expression_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_206[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_207[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression ['as' star_target]")); } _res = NULL; @@ -33570,9 +33631,9 @@ _tmp_206_rule(Parser *p) return _res; } -// _tmp_207: expressions ['as' star_target] +// _tmp_208: expressions ['as' star_target] static void * -_tmp_207_rule(Parser *p) +_tmp_208_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33586,22 +33647,22 @@ _tmp_207_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_207[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c> _tmp_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); void *_opt_var; UNUSED(_opt_var); // Silence compiler warnings expr_ty expressions_var; if ( (expressions_var = expressions_rule(p)) // expressions && - (_opt_var = _tmp_212_rule(p), !p->error_indicator) // ['as' star_target] + (_opt_var = _tmp_215_rule(p), !p->error_indicator) // ['as' star_target] ) { - D(fprintf(stderr, "%*c+ _tmp_207[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); + D(fprintf(stderr, "%*c+ _tmp_208[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expressions ['as' star_target]")); _res = _PyPegen_dummy_name(p, expressions_var, _opt_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_207[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_208[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expressions ['as' star_target]")); } _res = NULL; @@ -33610,9 +33671,87 @@ _tmp_207_rule(Parser *p) return _res; } -// _tmp_208: assignment_expression | expression !':=' +// _tmp_209: except_block except_star_block static void * -_tmp_208_rule(Parser *p) +_tmp_209_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // except_block except_star_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block except_star_block")); + excepthandler_ty except_block_var; + excepthandler_ty except_star_block_var; + if ( + (except_block_var = except_block_rule(p)) // except_block + && + (except_star_block_var = except_star_block_rule(p)) // except_star_block + ) + { + D(fprintf(stderr, "%*c+ _tmp_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_block except_star_block")); + _res = _PyPegen_dummy_name(p, except_block_var, except_star_block_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_209[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block except_star_block")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_210: except_star_block except_block +static void * +_tmp_210_rule(Parser *p) +{ + D(p->level++); + if (p->error_indicator) { + D(p->level--); + return NULL; + } + void * _res = NULL; + int _mark = p->mark; + { // except_star_block except_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _tmp_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block except_block")); + excepthandler_ty except_block_var; + excepthandler_ty except_star_block_var; + if ( + (except_star_block_var = except_star_block_rule(p)) // except_star_block + && + (except_block_var = except_block_rule(p)) // except_block + ) + { + D(fprintf(stderr, "%*c+ _tmp_210[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_star_block except_block")); + _res = _PyPegen_dummy_name(p, except_star_block_var, except_block_var); + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s _tmp_210[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block except_block")); + } + _res = NULL; + done: + D(p->level--); + return _res; +} + +// _tmp_211: assignment_expression | expression !':=' +static void * +_tmp_211_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33626,18 +33765,18 @@ _tmp_208_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c> _tmp_211[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "assignment_expression")); expr_ty assignment_expression_var; if ( (assignment_expression_var = assignment_expression_rule(p)) // assignment_expression ) { - D(fprintf(stderr, "%*c+ _tmp_208[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); + D(fprintf(stderr, "%*c+ _tmp_211[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "assignment_expression")); _res = assignment_expression_var; goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_208[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_211[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "assignment_expression")); } { // expression !':=' @@ -33645,7 +33784,7 @@ _tmp_208_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_208[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c> _tmp_211[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression !':='")); expr_ty expression_var; if ( (expression_var = expression_rule(p)) // expression @@ -33653,12 +33792,12 @@ _tmp_208_rule(Parser *p) _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 53) // token=':=' ) { - D(fprintf(stderr, "%*c+ _tmp_208[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression !':='")); + D(fprintf(stderr, "%*c+ _tmp_211[%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_208[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_211[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression !':='")); } _res = NULL; @@ -33667,9 +33806,9 @@ _tmp_208_rule(Parser *p) return _res; } -// _tmp_209: 'as' star_target +// _tmp_212: 'as' star_target static void * -_tmp_209_rule(Parser *p) +_tmp_212_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33683,21 +33822,21 @@ _tmp_209_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_212[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_212[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_209[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_212[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33706,9 +33845,9 @@ _tmp_209_rule(Parser *p) return _res; } -// _tmp_210: 'as' star_target +// _tmp_213: 'as' star_target static void * -_tmp_210_rule(Parser *p) +_tmp_213_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33722,21 +33861,21 @@ _tmp_210_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_213[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_210[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_213[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_210[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_213[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33745,9 +33884,9 @@ _tmp_210_rule(Parser *p) return _res; } -// _tmp_211: 'as' star_target +// _tmp_214: 'as' star_target static void * -_tmp_211_rule(Parser *p) +_tmp_214_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33761,21 +33900,21 @@ _tmp_211_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_211[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_214[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_211[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_214[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_211[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_214[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; @@ -33784,9 +33923,9 @@ _tmp_211_rule(Parser *p) return _res; } -// _tmp_212: 'as' star_target +// _tmp_215: 'as' star_target static void * -_tmp_212_rule(Parser *p) +_tmp_215_rule(Parser *p) { D(p->level++); if (p->error_indicator) { @@ -33800,21 +33939,21 @@ _tmp_212_rule(Parser *p) D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_212[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c> _tmp_215[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'as' star_target")); Token * _keyword; expr_ty star_target_var; if ( - (_keyword = _PyPegen_expect_token(p, 635)) // token='as' + (_keyword = _PyPegen_expect_token(p, 632)) // token='as' && (star_target_var = star_target_rule(p)) // star_target ) { - D(fprintf(stderr, "%*c+ _tmp_212[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); + D(fprintf(stderr, "%*c+ _tmp_215[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'as' star_target")); _res = _PyPegen_dummy_name(p, _keyword, star_target_var); goto done; } p->mark = _mark; - D(fprintf(stderr, "%*c%s _tmp_212[%d-%d]: %s failed!\n", p->level, ' ', + D(fprintf(stderr, "%*c%s _tmp_215[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'as' star_target")); } _res = NULL; From 798aaa71eac221a198ddb46797979ffe66b20d72 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 17 Nov 2021 23:45:49 +0000 Subject: [PATCH 03/37] Erlend's first review --- Lib/test/test_except_star.py | 13 +++++++ Objects/exceptions.c | 32 ++++++---------- Python/ceval.c | 73 +++++++++++++++++------------------- 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/Lib/test/test_except_star.py b/Lib/test/test_except_star.py index c6fdd75a25813b..6c12dcf9ea2390 100644 --- a/Lib/test/test_except_star.py +++ b/Lib/test/test_except_star.py @@ -32,6 +32,19 @@ def test_except_star_ExceptionGroup_is_runtime_error_tuple(self): except* (TypeError, ExceptionGroup): pass + def test_except_star_invalid_exception_type(self): + with self.assertRaises(TypeError): + try: + raise ValueError + except* 42: + pass + + with self.assertRaises(TypeError): + try: + raise ValueError + except* (ValueError, 42): + pass + class ExceptStarTest(unittest.TestCase): def assertExceptionIsLike(self, exc, template): diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 292ccedaaf544d..7fd2f6e525b2d9 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -894,9 +894,7 @@ static int get_matcher_type(PyObject *value, _exceptiongroup_split_matcher_type *type) { - if (!value) { - goto error; - } + assert(value); if (PyFunction_Check(value)) { *type = EXCEPTION_GROUP_MATCH_BY_PREDICATE; @@ -909,7 +907,7 @@ get_matcher_type(PyObject *value, } if (PyTuple_CheckExact(value)) { - Py_ssize_t n = PyTuple_Size(value); + Py_ssize_t n = PyTuple_GET_SIZE(value); for (Py_ssize_t i=0; iexcs); - if (num_excs < 0) { - return -1; - } + Py_ssize_t num_excs = PyTuple_GET_SIZE(eg->excs); /* recursive calls */ for (Py_ssize_t i = 0; i < num_excs; i++) { PyObject *e = PyTuple_GET_ITEM(eg->excs, i); @@ -1182,16 +1177,12 @@ _PyExc_ExceptionGroupProjection(PyObject *eg, PyObject *keep) assert(_PyBaseExceptionGroup_Check(eg)); assert(PyList_CheckExact(keep)); - Py_ssize_t n = PyList_Size(keep); - if (n == -1) { - return NULL; - } - PyObject *leaves = PySet_New(NULL); if (!leaves) { return NULL; } + Py_ssize_t n = PyList_GET_SIZE(keep); for (Py_ssize_t i = 0; i < n; i++) { PyObject *e = PyList_GET_ITEM(keep, i); assert(e != NULL); @@ -1204,17 +1195,16 @@ _PyExc_ExceptionGroupProjection(PyObject *eg, PyObject *keep) _exceptiongroup_split_result split_result; bool construct_rest = false; - if (exceptiongroup_split_recursive( - eg, EXCEPTION_GROUP_MATCH_INSTANCES, leaves, - construct_rest, &split_result) == -1) { - Py_DECREF(leaves); + int err = exceptiongroup_split_recursive( + eg, EXCEPTION_GROUP_MATCH_INSTANCES, leaves, + construct_rest, &split_result); + Py_DECREF(leaves); + if (err == -1) { return NULL; } - Py_DECREF(leaves); - PyObject *result = Py_NewRef( - split_result.match ? split_result.match : Py_None); - Py_XDECREF(split_result.match); + PyObject *result = split_result.match ? + split_result.match : Py_NewRef(Py_None); assert(split_result.rest == NULL); return result; } diff --git a/Python/ceval.c b/Python/ceval.c index 78cc0c6f644165..2353e22f9e118c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2591,9 +2591,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr } else { // nothing to reraise - Py_DECREF(val); - PUSH(Py_NewRef(Py_None)); PUSH(Py_NewRef(Py_None)); + PUSH(val); PUSH(Py_NewRef(Py_None)); } DISPATCH(); @@ -3616,13 +3615,13 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr } if (match == NULL || rest == NULL) { - Py_XDECREF(match); - Py_XDECREF(rest); + assert(match == NULL); + assert(rest == NULL); goto error; } if (match == Py_None) { - Py_XDECREF(match); + Py_DECREF(match); Py_XDECREF(rest); /* no match - jump to target */ JUMPTO(oparg); @@ -6137,10 +6136,7 @@ do_reraise_star(PyObject *excs, PyObject *orig) assert(PyList_Check(excs)); assert(PyExceptionInstance_Check(orig)); - Py_ssize_t numexcs = PyList_Size(excs); - if (numexcs == -1) { - return NULL; - } + Py_ssize_t numexcs = PyList_GET_SIZE(excs); if (numexcs == 0) { return Py_NewRef(Py_None); @@ -6213,9 +6209,6 @@ do_reraise_star(PyObject *excs, PyObject *orig) if (result == NULL) { goto done; } - } else { - Py_DECREF(reraised_eg); - goto done; } done: @@ -7120,35 +7113,37 @@ import_all_from(PyThreadState *tstate, PyObject *locals, PyObject *v) #define CANNOT_CATCH_MSG "catching classes that do not inherit from "\ "BaseException is not allowed" - #define CANNOT_EXCEPT_STAR_EG "catching ExceptionGroup with except* "\ - "is not allowed. Use except instead." - - static int - check_except_type_valid(PyThreadState *tstate, PyObject* right) { - if (PyTuple_Check(right)) { - Py_ssize_t i, length; - length = PyTuple_GET_SIZE(right); - for (i = 0; i < length; i++) { - PyObject *exc = PyTuple_GET_ITEM(right, i); - if (!PyExceptionClass_Check(exc)) { - _PyErr_SetString(tstate, PyExc_TypeError, - CANNOT_CATCH_MSG); - return 0; - } - } - } - else { - if (!PyExceptionClass_Check(right)) { - _PyErr_SetString(tstate, PyExc_TypeError, - CANNOT_CATCH_MSG); - return 0; - } - } - return 1; - } +#define CANNOT_EXCEPT_STAR_EG "catching ExceptionGroup with except* "\ + "is not allowed. Use except instead." static int -check_except_star_type_valid(PyThreadState *tstate, PyObject* right) { +check_except_type_valid(PyThreadState *tstate, PyObject* right) +{ + if (PyTuple_Check(right)) { + Py_ssize_t i, length; + length = PyTuple_GET_SIZE(right); + for (i = 0; i < length; i++) { + PyObject *exc = PyTuple_GET_ITEM(right, i); + if (!PyExceptionClass_Check(exc)) { + _PyErr_SetString(tstate, PyExc_TypeError, + CANNOT_CATCH_MSG); + return 0; + } + } + } + else { + if (!PyExceptionClass_Check(right)) { + _PyErr_SetString(tstate, PyExc_TypeError, + CANNOT_CATCH_MSG); + return 0; + } + } + return 1; +} + +static int +check_except_star_type_valid(PyThreadState *tstate, PyObject* right) +{ if (!check_except_type_valid(tstate, right)) { return 0; } From f95272c6736d30901a8b4e909c64f12783f34932 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 18 Nov 2021 11:34:56 +0000 Subject: [PATCH 04/37] fix grammar rule for mixed except/except* --- Grammar/python.gram | 2 +- Lib/test/test_syntax.py | 22 +++++ Parser/parser.c | 212 +++++++++++++++++++++++++++++++++------- 3 files changed, 202 insertions(+), 34 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index 952e90e195f46b..991089de1e287c 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1194,7 +1194,7 @@ invalid_try_stmt: | a='try' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'try' statement on line %d", a->lineno) } | 'try' ':' block !('except' | 'finally') { RAISE_SYNTAX_ERROR("expected 'except' or 'finally' block") } - | 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* { + | 'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block* { RAISE_SYNTAX_ERROR("cannot have both 'except' and 'except*' on the same 'try'") } invalid_except_stmt: | 'except' '*'? a=expression ',' expressions ['as' NAME ] ':' { diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index bb5f16f83aada5..7c6ef9cfc64546 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -937,6 +937,28 @@ Traceback (most recent call last): SyntaxError: cannot have both 'except' and 'except*' on the same 'try' + >>> try: + ... pass + ... except TypeError: + ... pass + ... except TypeError: + ... pass + ... except* ValueError: + ... pass + Traceback (most recent call last): + SyntaxError: cannot have both 'except' and 'except*' on the same 'try' + + >>> try: + ... pass + ... except* TypeError: + ... pass + ... except* TypeError: + ... pass + ... except ValueError: + ... pass + Traceback (most recent call last): + SyntaxError: cannot have both 'except' and 'except*' on the same 'try' + Ensure that early = are not matched by the parser as invalid comparisons >>> f(2, 4, x=34); 1 $ 2 Traceback (most recent call last): diff --git a/Parser/parser.c b/Parser/parser.c index e0e9aaf6b93457..dc128b9dc80fc6 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -509,6 +509,8 @@ static char *soft_keywords[] = { #define _tmp_213_type 1435 #define _tmp_214_type 1436 #define _tmp_215_type 1437 +#define _loop1_216_type 1438 +#define _loop1_217_type 1439 static mod_ty file_rule(Parser *p); static mod_ty interactive_rule(Parser *p); @@ -948,6 +950,8 @@ static void *_tmp_212_rule(Parser *p); static void *_tmp_213_rule(Parser *p); static void *_tmp_214_rule(Parser *p); static void *_tmp_215_rule(Parser *p); +static asdl_seq *_loop1_216_rule(Parser *p); +static asdl_seq *_loop1_217_rule(Parser *p); // file: statements? $ @@ -20002,7 +20006,7 @@ invalid_with_stmt_indent_rule(Parser *p) // invalid_try_stmt: // | 'try' ':' NEWLINE !INDENT // | 'try' ':' block !('except' | 'finally') -// | 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* +// | 'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block* static void * invalid_try_stmt_rule(Parser *p) { @@ -20077,12 +20081,12 @@ invalid_try_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block !('except' | 'finally')")); } - { // 'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block* + { // 'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block* if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + D(fprintf(stderr, "%*c> invalid_try_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*")); Token * _keyword; Token * _literal; asdl_seq * _loop0_174_var; @@ -20095,12 +20099,12 @@ invalid_try_stmt_rule(Parser *p) && (_loop0_174_var = _loop0_174_rule(p)) // block* && - (_tmp_175_var = _tmp_175_rule(p)) // (except_block except_star_block) | (except_star_block except_block) + (_tmp_175_var = _tmp_175_rule(p)) // (except_block+ except_star_block) | (except_star_block+ except_block) && (_loop0_176_var = _loop0_176_rule(p)) // block* ) { - D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + D(fprintf(stderr, "%*c+ invalid_try_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*")); _res = RAISE_SYNTAX_ERROR ( "cannot have both 'except' and 'except*' on the same 'try'" ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; @@ -20111,7 +20115,7 @@ invalid_try_stmt_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s invalid_try_stmt[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* ((except_block except_star_block) | (except_star_block except_block)) block*")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'try' ':' block* ((except_block+ except_star_block) | (except_star_block+ except_block)) block*")); } _res = NULL; done: @@ -32091,7 +32095,7 @@ _loop0_174_rule(Parser *p) return _seq; } -// _tmp_175: (except_block except_star_block) | (except_star_block except_block) +// _tmp_175: (except_block+ except_star_block) | (except_star_block+ except_block) static void * _tmp_175_rule(Parser *p) { @@ -32102,43 +32106,43 @@ _tmp_175_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // (except_block except_star_block) + { // (except_block+ except_star_block) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_block except_star_block)")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_block+ except_star_block)")); void *_tmp_209_var; if ( - (_tmp_209_var = _tmp_209_rule(p)) // except_block except_star_block + (_tmp_209_var = _tmp_209_rule(p)) // except_block+ except_star_block ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_block except_star_block)")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_block+ except_star_block)")); _res = _tmp_209_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_block except_star_block)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_block+ except_star_block)")); } - { // (except_star_block except_block) + { // (except_star_block+ except_block) if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_star_block except_block)")); + D(fprintf(stderr, "%*c> _tmp_175[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "(except_star_block+ except_block)")); void *_tmp_210_var; if ( - (_tmp_210_var = _tmp_210_rule(p)) // except_star_block except_block + (_tmp_210_var = _tmp_210_rule(p)) // except_star_block+ except_block ) { - D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_star_block except_block)")); + D(fprintf(stderr, "%*c+ _tmp_175[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "(except_star_block+ except_block)")); _res = _tmp_210_var; goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_175[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_star_block except_block)")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "(except_star_block+ except_block)")); } _res = NULL; done: @@ -33671,7 +33675,7 @@ _tmp_208_rule(Parser *p) return _res; } -// _tmp_209: except_block except_star_block +// _tmp_209: except_block+ except_star_block static void * _tmp_209_rule(Parser *p) { @@ -33682,27 +33686,27 @@ _tmp_209_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // except_block except_star_block + { // except_block+ except_star_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block except_star_block")); - excepthandler_ty except_block_var; + D(fprintf(stderr, "%*c> _tmp_209[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block+ except_star_block")); + asdl_seq * _loop1_216_var; excepthandler_ty except_star_block_var; if ( - (except_block_var = except_block_rule(p)) // except_block + (_loop1_216_var = _loop1_216_rule(p)) // except_block+ && (except_star_block_var = except_star_block_rule(p)) // except_star_block ) { - D(fprintf(stderr, "%*c+ _tmp_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_block except_star_block")); - _res = _PyPegen_dummy_name(p, except_block_var, except_star_block_var); + D(fprintf(stderr, "%*c+ _tmp_209[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_block+ except_star_block")); + _res = _PyPegen_dummy_name(p, _loop1_216_var, except_star_block_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_209[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block except_star_block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_block+ except_star_block")); } _res = NULL; done: @@ -33710,7 +33714,7 @@ _tmp_209_rule(Parser *p) return _res; } -// _tmp_210: except_star_block except_block +// _tmp_210: except_star_block+ except_block static void * _tmp_210_rule(Parser *p) { @@ -33721,27 +33725,27 @@ _tmp_210_rule(Parser *p) } void * _res = NULL; int _mark = p->mark; - { // except_star_block except_block + { // except_star_block+ except_block if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> _tmp_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block except_block")); + D(fprintf(stderr, "%*c> _tmp_210[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block+ except_block")); + asdl_seq * _loop1_217_var; excepthandler_ty except_block_var; - excepthandler_ty except_star_block_var; if ( - (except_star_block_var = except_star_block_rule(p)) // except_star_block + (_loop1_217_var = _loop1_217_rule(p)) // except_star_block+ && (except_block_var = except_block_rule(p)) // except_block ) { - D(fprintf(stderr, "%*c+ _tmp_210[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_star_block except_block")); - _res = _PyPegen_dummy_name(p, except_star_block_var, except_block_var); + D(fprintf(stderr, "%*c+ _tmp_210[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "except_star_block+ except_block")); + _res = _PyPegen_dummy_name(p, _loop1_217_var, except_block_var); goto done; } p->mark = _mark; D(fprintf(stderr, "%*c%s _tmp_210[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block except_block")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_block+ except_block")); } _res = NULL; done: @@ -33962,6 +33966,148 @@ _tmp_215_rule(Parser *p) return _res; } +// _loop1_216: except_block +static asdl_seq * +_loop1_216_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; + { // except_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop1_216[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_block")); + excepthandler_ty except_block_var; + while ( + (except_block_var = except_block_rule(p)) // except_block + ) + { + _res = except_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_216[%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) { + 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_216_type, _seq); + D(p->level--); + return _seq; +} + +// _loop1_217: except_star_block +static asdl_seq * +_loop1_217_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; + { // except_star_block + if (p->error_indicator) { + D(p->level--); + return NULL; + } + D(fprintf(stderr, "%*c> _loop1_217[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "except_star_block")); + excepthandler_ty except_star_block_var; + while ( + (except_star_block_var = except_star_block_rule(p)) // except_star_block + ) + { + _res = except_star_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_217[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "except_star_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_217_type, _seq); + D(p->level--); + return _seq; +} + void * _PyPegen_parse(Parser *p) { From ca44878e0a149970e4c7ca1e00deea57eb074449 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 18 Nov 2021 12:03:13 +0000 Subject: [PATCH 05/37] fix doctest failure --- Doc/library/ast.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index e29b5e88d71d41..a05da001eaa116 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -1163,7 +1163,8 @@ Control flow value=Constant(value=Ellipsis))], finalbody=[ Expr( - value=Constant(value=Ellipsis))])], + value=Constant(value=Ellipsis))], + star=0)], type_ignores=[]) @@ -1197,7 +1198,8 @@ Control flow body=[ Pass()])], orelse=[], - finalbody=[])], + finalbody=[], + star=0)], type_ignores=[]) From adc834d62abedadc499c84453645a10b28546229 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Fri, 19 Nov 2021 13:16:09 +0000 Subject: [PATCH 06/37] remove duplication in except* handling --- Python/compile.c | 61 +++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 3d2cec9bca728c..49a26a7ed5abd3 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3254,7 +3254,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); /* Runtime will push a block here, so we need to account for that */ - if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, NULL)) + if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, "except handler")) return 0; for (i = 0; i < n; i++) { excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( @@ -3302,7 +3302,7 @@ compiler_try_except(struct compiler *c, stmt_ty s) NEXT_BLOCK(c); } ADDOP(c, POP_TOP); // exc_type - if (handler->v.ExceptHandler.name) { + if (handler->v.ExceptHandler.name || is_except_star) { basicblock *cleanup_end, *cleanup_body; cleanup_end = compiler_new_block(c); @@ -3311,7 +3311,12 @@ compiler_try_except(struct compiler *c, stmt_ty s) return 0; } - compiler_nameop(c, handler->v.ExceptHandler.name, Store); + if (handler->v.ExceptHandler.name) { + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + } + else { + ADDOP(c, POP_TOP); // val + } ADDOP(c, POP_TOP); // tb /* @@ -3341,14 +3346,16 @@ compiler_try_except(struct compiler *c, stmt_ty s) if (!is_except_star) { ADDOP(c, POP_EXCEPT); } - ADDOP_LOAD_CONST(c, Py_None); - compiler_nameop(c, handler->v.ExceptHandler.name, Store); - compiler_nameop(c, handler->v.ExceptHandler.name, Del); + if(handler->v.ExceptHandler.name) { + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); + } if (!is_except_star) { ADDOP_JUMP(c, JUMP_FORWARD, end); } else { - ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + ADDOP_JUMP(c, JUMP_FORWARD, except); } /* except: */ @@ -3357,9 +3364,11 @@ compiler_try_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); - ADDOP_LOAD_CONST(c, Py_None); - compiler_nameop(c, handler->v.ExceptHandler.name, Store); - compiler_nameop(c, handler->v.ExceptHandler.name, Del); + if(handler->v.ExceptHandler.name) { + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); + } if (!is_except_star) { ADDOP_I(c, RERAISE, 1); @@ -3375,23 +3384,15 @@ compiler_try_except(struct compiler *c, stmt_ty s) } } else { - basicblock *cleanup_end, *cleanup_body; + basicblock *cleanup_body; cleanup_body = compiler_new_block(c); if (!cleanup_body) return 0; - if (is_except_star) { - cleanup_end = compiler_new_block(c); - if (!cleanup_end) - return 0; - } ADDOP(c, POP_TOP); // exc_val ADDOP(c, POP_TOP); // tb - if (is_except_star) { - ADDOP_JUMP(c, SETUP_CLEANUP, cleanup_end); - } compiler_use_next_block(c, cleanup_body); if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, NULL)) return 0; @@ -3399,26 +3400,8 @@ compiler_try_except(struct compiler *c, stmt_ty s) compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body); UNSET_LOC(c); ADDOP(c, POP_BLOCK); - if (!is_except_star) { - ADDOP(c, POP_EXCEPT); - ADDOP_JUMP(c, JUMP_FORWARD, end); - } - else { - ADDOP(c, POP_BLOCK); - ADDOP_JUMP(c, JUMP_ABSOLUTE, except); - } - - if (is_except_star) { - /* except: */ - compiler_use_next_block(c, cleanup_end); - /* add exception raised to the res list */ - ADDOP(c, POP_TOP); // type - ADDOP_I(c, LIST_APPEND, 6); // exc - ADDOP(c, POP_TOP); // tb - ADDOP(c, POP_TOP); // lasti - - ADDOP_JUMP(c, JUMP_ABSOLUTE, except); - } + ADDOP(c, POP_EXCEPT); + ADDOP_JUMP(c, JUMP_FORWARD, end); } compiler_use_next_block(c, except); From e3fa2f75637587d2fd4e829e09a13866eb319234 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Fri, 19 Nov 2021 13:18:12 +0000 Subject: [PATCH 07/37] fix bug - move POP_BLOCK to the end in case of except* --- Lib/test/test_except_star.py | 42 ++++++++++++++++++++++++++++++++++-- Python/ceval.c | 5 +++++ Python/compile.c | 9 +++++--- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_except_star.py b/Lib/test/test_except_star.py index 6c12dcf9ea2390..4ef641722aca4c 100644 --- a/Lib/test/test_except_star.py +++ b/Lib/test/test_except_star.py @@ -85,6 +85,7 @@ def assertMetadataNotEqual(self, e1, e2): class TestExceptStarSplitSemantics(ExceptStarTest): def doSplitTestNamed(self, exc, T, match_template, rest_template): + initial_exc_info = sys.exc_info() exc_info = match = rest = None try: try: @@ -94,15 +95,17 @@ def doSplitTestNamed(self, exc, T, match_template, rest_template): match = e except BaseException as e: rest = e + if match_template: self.assertEqual(exc_info[1], match) else: self.assertIsNone(exc_info) self.assertExceptionIsLike(match, match_template) self.assertExceptionIsLike(rest, rest_template) - self.assertEqual(sys.exc_info(), (None, None, None)) + self.assertEqual(sys.exc_info(), initial_exc_info) def doSplitTestUnnamed(self, exc, T, match_template, rest_template): + initial_exc_info = sys.exc_info() exc_info = match = rest = None try: try: @@ -119,11 +122,27 @@ def doSplitTestUnnamed(self, exc, T, match_template, rest_template): if match_template: self.assertEqual(exc_info[0], type(match_template)) self.assertExceptionIsLike(rest, rest_template) - self.assertEqual(sys.exc_info(), (None, None, None)) + self.assertEqual(sys.exc_info(), initial_exc_info) + + def doSplitTestInExceptHandler(self, exc, T, match_template, rest_template): + try: + raise ExceptionGroup('eg', [TypeError(1), ValueError(2)]) + except Exception: + self.doSplitTestNamed(exc, T, match_template, rest_template) + self.doSplitTestUnnamed(exc, T, match_template, rest_template) + + def doSplitTestInExceptStarHandler(self, exc, T, match_template, rest_template): + try: + raise ExceptionGroup('eg', [TypeError(1), ValueError(2)]) + except* Exception: + self.doSplitTestNamed(exc, T, match_template, rest_template) + self.doSplitTestUnnamed(exc, T, match_template, rest_template) def doSplitTest(self, exc, T, match_template, rest_template): self.doSplitTestNamed(exc, T, match_template, rest_template) self.doSplitTestUnnamed(exc, T, match_template, rest_template) + self.doSplitTestInExceptHandler(exc, T, match_template, rest_template) + self.doSplitTestInExceptStarHandler(exc, T, match_template, rest_template) def test_no_match_single_type(self): self.doSplitTest( @@ -811,6 +830,25 @@ def derive(self, excs): self.assertEqual(teg.exceptions[0].code, 101) +class TestExceptStarCleanup(ExceptStarTest): + def test_exc_info_restored(self): + try: + try: + raise ValueError(42) + except: + try: + raise TypeError(int) + except* Exception: + pass + 1/0 + except Exception as e: + exc = e + + self.assertExceptionIsLike(exc, ZeroDivisionError('division by zero')) + self.assertExceptionIsLike(exc.__context__, ValueError(42)) + self.assertEqual(sys.exc_info(), (None, None, None)) + + if __name__ == '__main__': unittest.main() diff --git a/Python/ceval.c b/Python/ceval.c index 2353e22f9e118c..065c4c10a71942 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2583,6 +2583,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr goto error; } + PyObject *lasti_unused = PyLong_FromLong(0); + if (lasti_unused == NULL) { + goto error; + } + PUSH(lasti_unused); if (val != Py_None) { PyObject *tb = PyException_GetTraceback(val); PUSH(tb ? tb : Py_NewRef(Py_None)); diff --git a/Python/compile.c b/Python/compile.c index 49a26a7ed5abd3..5d674d578bea87 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1134,7 +1134,7 @@ stack_effect(int opcode, int oparg, int jump) return jump ? -1 + 4 : 0; case PREP_RERAISE_STAR: - return 1; + return 2; case RERAISE: return -3; case PUSH_EXC_INFO: @@ -3342,8 +3342,8 @@ compiler_try_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); ADDOP(c, POP_BLOCK); - ADDOP(c, POP_BLOCK); if (!is_except_star) { + ADDOP(c, POP_BLOCK); ADDOP(c, POP_EXCEPT); } if(handler->v.ExceptHandler.name) { @@ -3437,10 +3437,13 @@ compiler_try_except(struct compiler *c, stmt_ty s) ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_BLOCK); ADDOP(c, POP_EXCEPT); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, reraise); - ADDOP_I(c, RERAISE, 0); + ADDOP(c, POP_BLOCK); + ADDOP(c, POP_EXCEPT_AND_RERAISE); } compiler_use_next_block(c, cleanup); ADDOP(c, POP_EXCEPT_AND_RERAISE); From f9a626c3255f2f57ce02574bcd5236f0294ef7de Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sun, 21 Nov 2021 16:17:52 +0000 Subject: [PATCH 08/37] Use Py_NewRef(_PyLong_GetZero()); Co-authored-by: Erlend Egeberg Aasland --- Python/ceval.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index ad6c32259d1619..40bbd2145732c4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2739,10 +2739,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr goto error; } - PyObject *lasti_unused = PyLong_FromLong(0); - if (lasti_unused == NULL) { - goto error; - } + PyObject *lasti_unused = Py_NewRef(_PyLong_GetZero()); PUSH(lasti_unused); if (val != Py_None) { PyObject *tb = PyException_GetTraceback(val); From fdc948bf46ff468a2fc681d44bc856c9ef5c6cfd Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 00:13:45 +0000 Subject: [PATCH 09/37] Split AST node Try -> Try/TryStar. Separate try-except and try-except* cases in compiler --- Grammar/python.gram | 6 +- Include/internal/pycore_ast.h | 24 +- Include/internal/pycore_ast_state.h | 2 +- Lib/test/test_ast.py | 23 +- Parser/Python.asdl | 3 +- Parser/parser.c | 6 +- Python/Python-ast.c | 243 ++++++++++++++++-- Python/ast.c | 25 ++ Python/ast_opt.c | 6 + Python/compile.c | 378 +++++++++++++++++++--------- Python/symtable.c | 6 + 11 files changed, 558 insertions(+), 164 deletions(-) diff --git a/Grammar/python.gram b/Grammar/python.gram index d9bafbb993b1f7..9b60eb53d94a1c 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -401,9 +401,9 @@ with_item[withitem_ty]: try_stmt[stmt_ty]: | invalid_try_stmt - | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, 0, EXTRA) } - | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, 0, EXTRA) } - | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, 1, EXTRA) } + | '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) } + | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ el=[else_block] f=[finally_block] { _PyAST_TryStar(b, ex, el, f, EXTRA) } # Except statement diff --git a/Include/internal/pycore_ast.h b/Include/internal/pycore_ast.h index 156d2b36c65267..36277efe9c5ca5 100644 --- a/Include/internal/pycore_ast.h +++ b/Include/internal/pycore_ast.h @@ -179,9 +179,9 @@ enum _stmt_kind {FunctionDef_kind=1, AsyncFunctionDef_kind=2, ClassDef_kind=3, AugAssign_kind=7, AnnAssign_kind=8, For_kind=9, AsyncFor_kind=10, While_kind=11, If_kind=12, With_kind=13, AsyncWith_kind=14, Match_kind=15, Raise_kind=16, Try_kind=17, - Assert_kind=18, Import_kind=19, ImportFrom_kind=20, - Global_kind=21, Nonlocal_kind=22, Expr_kind=23, Pass_kind=24, - Break_kind=25, Continue_kind=26}; + TryStar_kind=18, Assert_kind=19, Import_kind=20, + ImportFrom_kind=21, Global_kind=22, Nonlocal_kind=23, + Expr_kind=24, Pass_kind=25, Break_kind=26, Continue_kind=27}; struct _stmt { enum _stmt_kind kind; union { @@ -293,9 +293,15 @@ struct _stmt { asdl_excepthandler_seq *handlers; asdl_stmt_seq *orelse; asdl_stmt_seq *finalbody; - int star; } Try; + struct { + asdl_stmt_seq *body; + asdl_excepthandler_seq *handlers; + asdl_stmt_seq *orelse; + asdl_stmt_seq *finalbody; + } TryStar; + struct { expr_ty test; expr_ty msg; @@ -686,9 +692,13 @@ stmt_ty _PyAST_Match(expr_ty subject, asdl_match_case_seq * cases, int lineno, stmt_ty _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, - asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int star, - int lineno, int col_offset, int end_lineno, int - end_col_offset, PyArena *arena); + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int + lineno, int col_offset, int end_lineno, int end_col_offset, + PyArena *arena); +stmt_ty _PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int + lineno, int col_offset, int end_lineno, int + end_col_offset, PyArena *arena); stmt_ty _PyAST_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, int end_lineno, int end_col_offset, PyArena *arena); stmt_ty _PyAST_Import(asdl_alias_seq * names, int lineno, int col_offset, int diff --git a/Include/internal/pycore_ast_state.h b/Include/internal/pycore_ast_state.h index 061e3f0516cd3b..da78bba3b69bdf 100644 --- a/Include/internal/pycore_ast_state.h +++ b/Include/internal/pycore_ast_state.h @@ -132,6 +132,7 @@ struct ast_state { PyObject *Sub_singleton; PyObject *Sub_type; PyObject *Subscript_type; + PyObject *TryStar_type; PyObject *Try_type; PyObject *Tuple_type; PyObject *TypeIgnore_type; @@ -229,7 +230,6 @@ struct ast_state { PyObject *right; PyObject *simple; PyObject *slice; - PyObject *star; PyObject *step; PyObject *stmt_type; PyObject *subject; diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 6747b16f715947..f1b0e4e448461e 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -86,6 +86,8 @@ def to_tuple(t): "try:\n pass\nexcept Exception:\n pass", # TryFinally "try:\n pass\nfinally:\n pass", + # TryStarExcept + "try:\n pass\nexcept* Exception:\n pass", # Assert "assert v", # Import @@ -1292,22 +1294,22 @@ def test_raise(self): def test_try(self): p = ast.Pass() - t = ast.Try([], [], [], [p], 0) + t = ast.Try([], [], [], [p]) self.stmt(t, "empty body on Try") - t = ast.Try([ast.Expr(ast.Name("x", ast.Store()))], [], [], [p], 0) + t = ast.Try([ast.Expr(ast.Name("x", ast.Store()))], [], [], [p]) self.stmt(t, "must have Load context") - t = ast.Try([p], [], [], [], 0) + t = ast.Try([p], [], [], []) self.stmt(t, "Try has neither except handlers nor finalbody") - t = ast.Try([p], [], [p], [p], 0) + t = ast.Try([p], [], [p], [p]) self.stmt(t, "Try has orelse but no except handlers") - t = ast.Try([p], [ast.ExceptHandler(None, "x", [])], [], [], 0) + t = ast.Try([p], [ast.ExceptHandler(None, "x", [])], [], []) self.stmt(t, "empty body on ExceptHandler") e = [ast.ExceptHandler(ast.Name("x", ast.Store()), "y", [p])] - self.stmt(ast.Try([p], e, [], [], 0), "must have Load context") + self.stmt(ast.Try([p], e, [], []), "must have Load context") e = [ast.ExceptHandler(None, "x", [p])] - t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store()))], [p], 0) + t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store()))], [p]) self.stmt(t, "must have Load context") - t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))], 0) + t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))]) self.stmt(t, "must have Load context") def test_assert(self): @@ -2314,8 +2316,9 @@ def main(): ('Module', [('With', (1, 0, 1, 17), [('withitem', ('Name', (1, 5, 1, 6), 'x', ('Load',)), ('Name', (1, 10, 1, 11), 'y', ('Store',)))], [('Pass', (1, 13, 1, 17))], None)], []), ('Module', [('With', (1, 0, 1, 25), [('withitem', ('Name', (1, 5, 1, 6), 'x', ('Load',)), ('Name', (1, 10, 1, 11), 'y', ('Store',))), ('withitem', ('Name', (1, 13, 1, 14), 'z', ('Load',)), ('Name', (1, 18, 1, 19), 'q', ('Store',)))], [('Pass', (1, 21, 1, 25))], None)], []), ('Module', [('Raise', (1, 0, 1, 25), ('Call', (1, 6, 1, 25), ('Name', (1, 6, 1, 15), 'Exception', ('Load',)), [('Constant', (1, 16, 1, 24), 'string', None)], []), None)], []), -('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 7, 3, 16), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [], 0)], []), -('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [], [], [('Pass', (4, 2, 4, 6))], 0)], []), +('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 7, 3, 16), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [])], []), +('Module', [('Try', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [], [], [('Pass', (4, 2, 4, 6))])], []), +('Module', [('TryStar', (1, 0, 4, 6), [('Pass', (2, 2, 2, 6))], [('ExceptHandler', (3, 0, 4, 6), ('Name', (3, 8, 3, 17), 'Exception', ('Load',)), None, [('Pass', (4, 2, 4, 6))])], [], [])], []), ('Module', [('Assert', (1, 0, 1, 8), ('Name', (1, 7, 1, 8), 'v', ('Load',)), None)], []), ('Module', [('Import', (1, 0, 1, 10), [('alias', (1, 7, 1, 10), 'sys', None)])], []), ('Module', [('ImportFrom', (1, 0, 1, 17), 'sys', [('alias', (1, 16, 1, 17), 'v', None)], 0)], []), diff --git a/Parser/Python.asdl b/Parser/Python.asdl index 8a4792d808b1ec..4a61bda701b473 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -39,7 +39,8 @@ module Python | Match(expr subject, match_case* cases) | Raise(expr? exc, expr? cause) - | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star) + | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) + | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) | Assert(expr test, expr? msg) | Import(alias* names) diff --git a/Parser/parser.c b/Parser/parser.c index d010c92f057849..c637f4aefb8f05 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -6366,7 +6366,7 @@ try_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_Try ( b , NULL , NULL , f , 0 , EXTRA ); + _res = _PyAST_Try ( b , NULL , NULL , f , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6414,7 +6414,7 @@ try_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_Try ( b , ex , el , f , 0 , EXTRA ); + _res = _PyAST_Try ( b , ex , el , f , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); @@ -6462,7 +6462,7 @@ try_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_Try ( b , ex , el , f , 1 , EXTRA ); + _res = _PyAST_TryStar ( b , ex , el , f , EXTRA ); if (_res == NULL && PyErr_Occurred()) { p->error_indicator = 1; D(p->level--); diff --git a/Python/Python-ast.c b/Python/Python-ast.c index f2dd52272aec61..167018482077d1 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -146,6 +146,7 @@ void _PyAST_Fini(PyInterpreterState *interp) Py_CLEAR(state->Sub_singleton); Py_CLEAR(state->Sub_type); Py_CLEAR(state->Subscript_type); + Py_CLEAR(state->TryStar_type); Py_CLEAR(state->Try_type); Py_CLEAR(state->Tuple_type); Py_CLEAR(state->TypeIgnore_type); @@ -243,7 +244,6 @@ void _PyAST_Fini(PyInterpreterState *interp) Py_CLEAR(state->right); Py_CLEAR(state->simple); Py_CLEAR(state->slice); - Py_CLEAR(state->star); Py_CLEAR(state->step); Py_CLEAR(state->stmt_type); Py_CLEAR(state->subject); @@ -342,7 +342,6 @@ static int init_identifiers(struct ast_state *state) if ((state->right = PyUnicode_InternFromString("right")) == NULL) return 0; if ((state->simple = PyUnicode_InternFromString("simple")) == NULL) return 0; if ((state->slice = PyUnicode_InternFromString("slice")) == NULL) return 0; - if ((state->star = PyUnicode_InternFromString("star")) == NULL) return 0; if ((state->step = PyUnicode_InternFromString("step")) == NULL) return 0; if ((state->subject = PyUnicode_InternFromString("subject")) == NULL) return 0; if ((state->tag = PyUnicode_InternFromString("tag")) == NULL) return 0; @@ -487,7 +486,12 @@ static const char * const Try_fields[]={ "handlers", "orelse", "finalbody", - "star", +}; +static const char * const TryStar_fields[]={ + "body", + "handlers", + "orelse", + "finalbody", }; static const char * const Assert_fields[]={ "test", @@ -1141,7 +1145,8 @@ init_types(struct ast_state *state) " | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" " | Match(expr subject, match_case* cases)\n" " | Raise(expr? exc, expr? cause)\n" - " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star)\n" + " | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" + " | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n" " | Assert(expr test, expr? msg)\n" " | Import(alias* names)\n" " | ImportFrom(identifier? module, alias* names, int? level)\n" @@ -1254,9 +1259,13 @@ init_types(struct ast_state *state) return 0; if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1) return 0; - state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 5, - "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody, int star)"); + state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4, + "Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)"); if (!state->Try_type) return 0; + state->TryStar_type = make_type(state, "TryStar", state->stmt_type, + TryStar_fields, 4, + "TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)"); + if (!state->TryStar_type) return 0; state->Assert_type = make_type(state, "Assert", state->stmt_type, Assert_fields, 2, "Assert(expr test, expr? msg)"); @@ -2363,9 +2372,8 @@ _PyAST_Raise(expr_ty exc, expr_ty cause, int lineno, int col_offset, int stmt_ty _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, - asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int star, int - lineno, int col_offset, int end_lineno, int end_col_offset, PyArena - *arena) + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, int + col_offset, int end_lineno, int end_col_offset, PyArena *arena) { stmt_ty p; p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); @@ -2376,7 +2384,28 @@ _PyAST_Try(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, p->v.Try.handlers = handlers; p->v.Try.orelse = orelse; p->v.Try.finalbody = finalbody; - p->v.Try.star = star; + p->lineno = lineno; + p->col_offset = col_offset; + p->end_lineno = end_lineno; + p->end_col_offset = end_col_offset; + return p; +} + +stmt_ty +_PyAST_TryStar(asdl_stmt_seq * body, asdl_excepthandler_seq * handlers, + asdl_stmt_seq * orelse, asdl_stmt_seq * finalbody, int lineno, + int col_offset, int end_lineno, int end_col_offset, PyArena + *arena) +{ + stmt_ty p; + p = (stmt_ty)_PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = TryStar_kind; + p->v.TryStar.body = body; + p->v.TryStar.handlers = handlers; + p->v.TryStar.orelse = orelse; + p->v.TryStar.finalbody = finalbody; p->lineno = lineno; p->col_offset = col_offset; p->end_lineno = end_lineno; @@ -4053,9 +4082,32 @@ ast2obj_stmt(struct ast_state *state, void* _o) if (PyObject_SetAttr(result, state->finalbody, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_int(state, o->v.Try.star); + break; + case TryStar_kind: + tp = (PyTypeObject *)state->TryStar_type; + result = PyType_GenericNew(tp, NULL, NULL); + if (!result) goto failed; + value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.body, ast2obj_stmt); if (!value) goto failed; - if (PyObject_SetAttr(result, state->star, value) == -1) + if (PyObject_SetAttr(result, state->body, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.handlers, + ast2obj_excepthandler); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->handlers, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.orelse, + ast2obj_stmt); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->orelse, value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_list(state, (asdl_seq*)o->v.TryStar.finalbody, + ast2obj_stmt); + if (!value) goto failed; + if (PyObject_SetAttr(result, state->finalbody, value) == -1) goto failed; Py_DECREF(value); break; @@ -7333,7 +7385,6 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* asdl_excepthandler_seq* handlers; asdl_stmt_seq* orelse; asdl_stmt_seq* finalbody; - int star; if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { return 1; @@ -7483,25 +7534,172 @@ obj2ast_stmt(struct ast_state *state, PyObject* obj, stmt_ty* out, PyArena* } Py_CLEAR(tmp); } - if (_PyObject_LookupAttr(obj, state->star, &tmp) < 0) { + *out = _PyAST_Try(body, handlers, orelse, finalbody, lineno, + col_offset, end_lineno, end_col_offset, arena); + if (*out == NULL) goto failed; + return 0; + } + tp = state->TryStar_type; + isinstance = PyObject_IsInstance(obj, tp); + if (isinstance == -1) { + return 1; + } + if (isinstance) { + asdl_stmt_seq* body; + asdl_excepthandler_seq* handlers; + asdl_stmt_seq* orelse; + asdl_stmt_seq* finalbody; + + if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) { return 1; } if (tmp == NULL) { - PyErr_SetString(PyExc_TypeError, "required field \"star\" missing from Try"); + PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryStar"); return 1; } else { int res; - if (Py_EnterRecursiveCall(" while traversing 'Try' node")) { + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "TryStar field \"body\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); goto failed; } - res = obj2ast_int(state, tmp, &star, arena); - Py_LeaveRecursiveCall(); - if (res != 0) goto failed; + len = PyList_GET_SIZE(tmp); + body = _Py_asdl_stmt_seq_new(len, arena); + if (body == NULL) goto failed; + for (i = 0; i < len; i++) { + stmt_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + if (Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { + goto failed; + } + res = obj2ast_stmt(state, tmp2, &val, arena); + Py_LeaveRecursiveCall(); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "TryStar field \"body\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(body, i, val); + } Py_CLEAR(tmp); } - *out = _PyAST_Try(body, handlers, orelse, finalbody, star, lineno, - col_offset, end_lineno, end_col_offset, arena); + if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from TryStar"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "TryStar field \"handlers\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + handlers = _Py_asdl_excepthandler_seq_new(len, arena); + if (handlers == NULL) goto failed; + for (i = 0; i < len; i++) { + excepthandler_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + if (Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { + goto failed; + } + res = obj2ast_excepthandler(state, tmp2, &val, arena); + Py_LeaveRecursiveCall(); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "TryStar field \"handlers\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(handlers, i, val); + } + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from TryStar"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "TryStar field \"orelse\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + orelse = _Py_asdl_stmt_seq_new(len, arena); + if (orelse == NULL) goto failed; + for (i = 0; i < len; i++) { + stmt_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + if (Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { + goto failed; + } + res = obj2ast_stmt(state, tmp2, &val, arena); + Py_LeaveRecursiveCall(); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "TryStar field \"orelse\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(orelse, i, val); + } + Py_CLEAR(tmp); + } + if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) { + return 1; + } + if (tmp == NULL) { + PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from TryStar"); + return 1; + } + else { + int res; + Py_ssize_t len; + Py_ssize_t i; + if (!PyList_Check(tmp)) { + PyErr_Format(PyExc_TypeError, "TryStar field \"finalbody\" must be a list, not a %.200s", _PyType_Name(Py_TYPE(tmp))); + goto failed; + } + len = PyList_GET_SIZE(tmp); + finalbody = _Py_asdl_stmt_seq_new(len, arena); + if (finalbody == NULL) goto failed; + for (i = 0; i < len; i++) { + stmt_ty val; + PyObject *tmp2 = PyList_GET_ITEM(tmp, i); + Py_INCREF(tmp2); + if (Py_EnterRecursiveCall(" while traversing 'TryStar' node")) { + goto failed; + } + res = obj2ast_stmt(state, tmp2, &val, arena); + Py_LeaveRecursiveCall(); + Py_DECREF(tmp2); + if (res != 0) goto failed; + if (len != PyList_GET_SIZE(tmp)) { + PyErr_SetString(PyExc_RuntimeError, "TryStar field \"finalbody\" changed size during iteration"); + goto failed; + } + asdl_seq_SET(finalbody, i, val); + } + Py_CLEAR(tmp); + } + *out = _PyAST_TryStar(body, handlers, orelse, finalbody, lineno, + col_offset, end_lineno, end_col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -11715,6 +11913,9 @@ astmodule_exec(PyObject *m) if (PyModule_AddObjectRef(m, "Try", state->Try_type) < 0) { return -1; } + if (PyModule_AddObjectRef(m, "TryStar", state->TryStar_type) < 0) { + return -1; + } if (PyModule_AddObjectRef(m, "Assert", state->Assert_type) < 0) { return -1; } diff --git a/Python/ast.c b/Python/ast.c index 0c3121d3ee7b66..607281e2685535 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -817,6 +817,31 @@ validate_stmt(struct validator *state, stmt_ty stmt) (!asdl_seq_LEN(stmt->v.Try.orelse) || validate_stmts(state, stmt->v.Try.orelse)); break; + case TryStar_kind: + if (!validate_body(state, stmt->v.TryStar.body, "TryStar")) + return 0; + if (!asdl_seq_LEN(stmt->v.TryStar.handlers) && + !asdl_seq_LEN(stmt->v.TryStar.finalbody)) { + PyErr_SetString(PyExc_ValueError, "TryStar has neither except handlers nor finalbody"); + return 0; + } + if (!asdl_seq_LEN(stmt->v.TryStar.handlers) && + asdl_seq_LEN(stmt->v.TryStar.orelse)) { + PyErr_SetString(PyExc_ValueError, "TryStar has orelse but no except handlers"); + return 0; + } + for (i = 0; i < asdl_seq_LEN(stmt->v.TryStar.handlers); i++) { + excepthandler_ty handler = asdl_seq_GET(stmt->v.TryStar.handlers, i); + if ((handler->v.ExceptHandler.type && + !validate_expr(state, handler->v.ExceptHandler.type, Load)) || + !validate_body(state, handler->v.ExceptHandler.body, "ExceptHandler")) + return 0; + } + ret = (!asdl_seq_LEN(stmt->v.TryStar.finalbody) || + validate_stmts(state, stmt->v.TryStar.finalbody)) && + (!asdl_seq_LEN(stmt->v.TryStar.orelse) || + validate_stmts(state, stmt->v.TryStar.orelse)); + break; case Assert_kind: ret = validate_expr(state, stmt->v.Assert.test, Load) && (!stmt->v.Assert.msg || validate_expr(state, stmt->v.Assert.msg, Load)); diff --git a/Python/ast_opt.c b/Python/ast_opt.c index 356f60e2d53992..a6283812601456 100644 --- a/Python/ast_opt.c +++ b/Python/ast_opt.c @@ -973,6 +973,12 @@ astfold_stmt(stmt_ty node_, PyArena *ctx_, _PyASTOptimizeState *state) CALL_SEQ(astfold_stmt, stmt, node_->v.Try.orelse); CALL_SEQ(astfold_stmt, stmt, node_->v.Try.finalbody); break; + case TryStar_kind: + CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.body); + CALL_SEQ(astfold_excepthandler, excepthandler, node_->v.TryStar.handlers); + CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.orelse); + CALL_SEQ(astfold_stmt, stmt, node_->v.TryStar.finalbody); + break; case Assert_kind: CALL(astfold_expr, expr_ty, node_->v.Assert.test); CALL_OPT(astfold_expr, expr_ty, node_->v.Assert.msg); diff --git a/Python/compile.c b/Python/compile.c index d4f5a3397a2b44..2748f2e43980bb 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1758,6 +1758,18 @@ find_ann(asdl_stmt_seq *stmts) find_ann(st->v.Try.finalbody) || find_ann(st->v.Try.orelse); break; + case TryStar_kind: + for (j = 0; j < asdl_seq_LEN(st->v.TryStar.handlers); j++) { + excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( + st->v.TryStar.handlers, j); + if (find_ann(handler->v.ExceptHandler.body)) { + return 1; + } + } + res = find_ann(st->v.TryStar.body) || + find_ann(st->v.TryStar.finalbody) || + find_ann(st->v.TryStar.orelse); + break; default: res = 0; } @@ -3188,6 +3200,52 @@ compiler_try_finally(struct compiler *c, stmt_ty s) return 1; } +static int +compiler_try_star_finally(struct compiler *c, stmt_ty s) +{ + basicblock *body, *end, *exit, *cleanup; + + body = compiler_new_block(c); + end = compiler_new_block(c); + exit = compiler_new_block(c); + cleanup = compiler_new_block(c); + if (body == NULL || end == NULL || exit == NULL || cleanup == NULL) { + return 0; + } + /* `try` block */ + ADDOP_JUMP(c, SETUP_FINALLY, end); + compiler_use_next_block(c, body); + if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.TryStar.finalbody)) + return 0; + if (s->v.TryStar.handlers && asdl_seq_LEN(s->v.TryStar.handlers)) { + if (!compiler_try_except(c, s)) + return 0; + } + else { + VISIT_SEQ(c, stmt, s->v.TryStar.body); + } + ADDOP_NOLINE(c, POP_BLOCK); + compiler_pop_fblock(c, FINALLY_TRY, body); + VISIT_SEQ(c, stmt, s->v.TryStar.finalbody); + ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, exit); + /* `finally` block */ + compiler_use_next_block(c, end); + + UNSET_LOC(c); + ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); + ADDOP(c, PUSH_EXC_INFO); + if (!compiler_push_fblock(c, FINALLY_END, end, NULL, NULL)) + return 0; + VISIT_SEQ(c, stmt, s->v.TryStar.finalbody); + compiler_pop_fblock(c, FINALLY_END, end); + ADDOP_I(c, RERAISE, 0); + compiler_use_next_block(c, cleanup); + ADDOP(c, POP_EXCEPT_AND_RERAISE); + compiler_use_next_block(c, exit); + return 1; +} + + /* Code generated for "try: S except E1 as V1: S1 except E2 as V2: S2 ...": (The contents of the value stack is shown in [], with the top @@ -3221,9 +3279,7 @@ static int compiler_try_except(struct compiler *c, stmt_ty s) { basicblock *body, *orelse, *except, *end, *cleanup; - basicblock *reraise_star = NULL; /* for except* */ Py_ssize_t i, n; - int is_except_star = s->v.Try.star; body = compiler_new_block(c); except = compiler_new_block(c); @@ -3232,13 +3288,6 @@ compiler_try_except(struct compiler *c, stmt_ty s) cleanup = compiler_new_block(c); if (body == NULL || except == NULL || orelse == NULL || end == NULL || cleanup == NULL) return 0; - - if (is_except_star) { - reraise_star = compiler_new_block(c); - if (reraise_star == NULL) - return 0; - } - ADDOP_JUMP(c, SETUP_FINALLY, except); compiler_use_next_block(c, body); if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL)) @@ -3254,55 +3303,25 @@ compiler_try_except(struct compiler *c, stmt_ty s) ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); /* Runtime will push a block here, so we need to account for that */ - if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, "except handler")) + if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, NULL)) return 0; for (i = 0; i < n; i++) { excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( s->v.Try.handlers, i); SET_LOC(c, handler); if (!handler->v.ExceptHandler.type && i < n-1) { - assert(!is_except_star); return compiler_error(c, "default 'except:' must be last"); } except = compiler_new_block(c); if (except == NULL) return 0; - if (is_except_star) { - if (i == 0) { - /* Push the original EG into the stack */ - /* - [tb, val, exc] DUP_TOP_TWO - [tb, val, exc, val, exc] POP_TOP - [tb, val, exc, val] ROT_FOUR - [val, tb, val, exc] - */ - ADDOP(c, DUP_TOP_TWO); - ADDOP(c, POP_TOP); - ADDOP(c, ROT_FOUR); - - /* create empty list for exceptions raised/reraise in the except* blocks */ - /* - [val, tb, val, exc] BUILD_LIST - [val, tb, val, exc, []] ROT_FOUR - [val, [], tb, val, exc] - */ - ADDOP_I(c, BUILD_LIST, 0); - ADDOP(c, ROT_FOUR); - } - } if (handler->v.ExceptHandler.type) { VISIT(c, expr, handler->v.ExceptHandler.type); - if (!is_except_star) { - ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except); - } - else { - ADDOP_JUMP(c, JUMP_IF_NOT_EG_MATCH, except); - } - + ADDOP_JUMP(c, JUMP_IF_NOT_EXC_MATCH, except); NEXT_BLOCK(c); } - ADDOP(c, POP_TOP); // exc_type - if (handler->v.ExceptHandler.name || is_except_star) { + ADDOP(c, POP_TOP); + if (handler->v.ExceptHandler.name) { basicblock *cleanup_end, *cleanup_body; cleanup_end = compiler_new_block(c); @@ -3311,13 +3330,8 @@ compiler_try_except(struct compiler *c, stmt_ty s) return 0; } - if (handler->v.ExceptHandler.name) { - compiler_nameop(c, handler->v.ExceptHandler.name, Store); - } - else { - ADDOP(c, POP_TOP); // val - } - ADDOP(c, POP_TOP); // tb + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + ADDOP(c, POP_TOP); /* try: @@ -3342,21 +3356,12 @@ compiler_try_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); ADDOP(c, POP_BLOCK); - if (!is_except_star) { - ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT); - } - if(handler->v.ExceptHandler.name) { - ADDOP_LOAD_CONST(c, Py_None); - compiler_nameop(c, handler->v.ExceptHandler.name, Store); - compiler_nameop(c, handler->v.ExceptHandler.name, Del); - } - if (!is_except_star) { - ADDOP_JUMP(c, JUMP_FORWARD, end); - } - else { - ADDOP_JUMP(c, JUMP_FORWARD, except); - } + ADDOP(c, POP_BLOCK); + ADDOP(c, POP_EXCEPT); + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); + ADDOP_JUMP(c, JUMP_FORWARD, end); /* except: */ compiler_use_next_block(c, cleanup_end); @@ -3364,24 +3369,11 @@ compiler_try_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); - if(handler->v.ExceptHandler.name) { - ADDOP_LOAD_CONST(c, Py_None); - compiler_nameop(c, handler->v.ExceptHandler.name, Store); - compiler_nameop(c, handler->v.ExceptHandler.name, Del); - } - - if (!is_except_star) { - ADDOP_I(c, RERAISE, 1); - } - else { - /* add exception raised to the res list */ - ADDOP(c, POP_TOP); // type - ADDOP_I(c, LIST_APPEND, 6); // exc - ADDOP(c, POP_TOP); // tb - ADDOP(c, POP_TOP); // lasti + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); - ADDOP_JUMP(c, JUMP_ABSOLUTE, except); - } + ADDOP_I(c, RERAISE, 1); } else { basicblock *cleanup_body; @@ -3390,9 +3382,8 @@ compiler_try_except(struct compiler *c, stmt_ty s) if (!cleanup_body) return 0; - ADDOP(c, POP_TOP); // exc_val - ADDOP(c, POP_TOP); // tb - + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); compiler_use_next_block(c, cleanup_body); if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, NULL)) return 0; @@ -3403,52 +3394,194 @@ compiler_try_except(struct compiler *c, stmt_ty s) ADDOP(c, POP_EXCEPT); ADDOP_JUMP(c, JUMP_FORWARD, end); } - compiler_use_next_block(c, except); - if (is_except_star) { - if (i == n - 1) { - /* Add exc to the list (if not None it's the unhandled part of the EG) */ - ADDOP(c, POP_TOP); - ADDOP_I(c, LIST_APPEND, 2); - ADDOP(c, POP_TOP); - ADDOP_JUMP(c, JUMP_FORWARD, reraise_star); - } - } } /* Mark as artificial */ UNSET_LOC(c); compiler_pop_fblock(c, EXCEPTION_HANDLER, NULL); - if (!is_except_star) { - ADDOP_I(c, RERAISE, 0); - } - else { - basicblock *reraise; - reraise = compiler_new_block(c); - if (!reraise) + ADDOP_I(c, RERAISE, 0); + compiler_use_next_block(c, cleanup); + ADDOP(c, POP_EXCEPT_AND_RERAISE); + compiler_use_next_block(c, orelse); + VISIT_SEQ(c, stmt, s->v.Try.orelse); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, end); + return 1; +} + +static int +compiler_try_star_except(struct compiler *c, stmt_ty s) +{ + basicblock *body, *orelse, *except, *end, *cleanup; + basicblock *reraise_star = NULL; /* for except* */ + Py_ssize_t i, n; + + body = compiler_new_block(c); + except = compiler_new_block(c); + orelse = compiler_new_block(c); + end = compiler_new_block(c); + cleanup = compiler_new_block(c); + if (body == NULL || except == NULL || orelse == NULL || end == NULL || cleanup == NULL) + return 0; + + reraise_star = compiler_new_block(c); + if (reraise_star == NULL) + return 0; + + ADDOP_JUMP(c, SETUP_FINALLY, except); + compiler_use_next_block(c, body); + if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL)) + return 0; + VISIT_SEQ(c, stmt, s->v.TryStar.body); + compiler_pop_fblock(c, TRY_EXCEPT, body); + ADDOP_NOLINE(c, POP_BLOCK); + ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, orelse); + n = asdl_seq_LEN(s->v.TryStar.handlers); + compiler_use_next_block(c, except); + + UNSET_LOC(c); + ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); + ADDOP(c, PUSH_EXC_INFO); + /* Runtime will push a block here, so we need to account for that */ + if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, "except handler")) + return 0; + for (i = 0; i < n; i++) { + excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( + s->v.TryStar.handlers, i); + SET_LOC(c, handler); + except = compiler_new_block(c); + if (except == NULL) return 0; + if (i == 0) { + /* Push the original EG into the stack */ + /* + [tb, val, exc] DUP_TOP_TWO + [tb, val, exc, val, exc] POP_TOP + [tb, val, exc, val] ROT_FOUR + [val, tb, val, exc] + */ + ADDOP(c, DUP_TOP_TWO); + ADDOP(c, POP_TOP); + ADDOP(c, ROT_FOUR); - compiler_use_next_block(c, reraise_star); - ADDOP(c, PREP_RERAISE_STAR); - ADDOP(c, DUP_TOP); - ADDOP_JUMP(c, POP_JUMP_IF_TRUE, reraise); - NEXT_BLOCK(c); + /* create empty list for exceptions raised/reraise in the except* blocks */ + /* + [val, tb, val, exc] BUILD_LIST + [val, tb, val, exc, []] ROT_FOUR + [val, [], tb, val, exc] + */ + ADDOP_I(c, BUILD_LIST, 0); + ADDOP(c, ROT_FOUR); + } + if (handler->v.ExceptHandler.type) { + VISIT(c, expr, handler->v.ExceptHandler.type); + ADDOP_JUMP(c, JUMP_IF_NOT_EG_MATCH, except); + NEXT_BLOCK(c); + } + ADDOP(c, POP_TOP); // exc_type + basicblock *cleanup_end, *cleanup_body; - /* Nothing to reraise - pop it */ - ADDOP(c, POP_TOP); - ADDOP(c, POP_TOP); - ADDOP(c, POP_TOP); - ADDOP(c, POP_TOP); - ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT); - ADDOP_JUMP(c, JUMP_FORWARD, end); - compiler_use_next_block(c, reraise); + cleanup_end = compiler_new_block(c); + cleanup_body = compiler_new_block(c); + if (cleanup_end == NULL || cleanup_body == NULL) { + return 0; + } + + if (handler->v.ExceptHandler.name) { + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + } + else { + ADDOP(c, POP_TOP); // val + } + ADDOP(c, POP_TOP); // tb + + /* + try: + # body + except type as name: + try: + # body + finally: + name = None # in case body contains "del name" + del name + */ + /* second try: */ + ADDOP_JUMP(c, SETUP_CLEANUP, cleanup_end); + compiler_use_next_block(c, cleanup_body); + if (!compiler_push_fblock(c, HANDLER_CLEANUP, cleanup_body, NULL, handler->v.ExceptHandler.name)) + return 0; + + /* second # body */ + VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body); + compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body); + /* name = None; del name; # Mark as artificial */ + UNSET_LOC(c); ADDOP(c, POP_BLOCK); - ADDOP(c, POP_EXCEPT_AND_RERAISE); + if(handler->v.ExceptHandler.name) { + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); + } + ADDOP_JUMP(c, JUMP_FORWARD, except); + + /* except: */ + compiler_use_next_block(c, cleanup_end); + + /* name = None; del name; # Mark as artificial */ + UNSET_LOC(c); + + if(handler->v.ExceptHandler.name) { + ADDOP_LOAD_CONST(c, Py_None); + compiler_nameop(c, handler->v.ExceptHandler.name, Store); + compiler_nameop(c, handler->v.ExceptHandler.name, Del); + } + + /* add exception raised to the res list */ + ADDOP(c, POP_TOP); // type + ADDOP_I(c, LIST_APPEND, 6); // exc + ADDOP(c, POP_TOP); // tb + ADDOP(c, POP_TOP); // lasti + + ADDOP_JUMP(c, JUMP_ABSOLUTE, except); + compiler_use_next_block(c, except); + + if (i == n - 1) { + /* Add exc to the list (if not None it's the unhandled part of the EG) */ + ADDOP(c, POP_TOP); + ADDOP_I(c, LIST_APPEND, 2); + ADDOP(c, POP_TOP); + ADDOP_JUMP(c, JUMP_FORWARD, reraise_star); + } } + /* Mark as artificial */ + UNSET_LOC(c); + compiler_pop_fblock(c, EXCEPTION_HANDLER, NULL); + basicblock *reraise; + reraise = compiler_new_block(c); + if (!reraise) + return 0; + + compiler_use_next_block(c, reraise_star); + ADDOP(c, PREP_RERAISE_STAR); + ADDOP(c, DUP_TOP); + ADDOP_JUMP(c, POP_JUMP_IF_TRUE, reraise); + NEXT_BLOCK(c); + + /* Nothing to reraise - pop it */ + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_TOP); + ADDOP(c, POP_BLOCK); + ADDOP(c, POP_EXCEPT); + ADDOP_JUMP(c, JUMP_FORWARD, end); + compiler_use_next_block(c, reraise); + ADDOP(c, POP_BLOCK); + ADDOP(c, POP_EXCEPT_AND_RERAISE); compiler_use_next_block(c, cleanup); ADDOP(c, POP_EXCEPT_AND_RERAISE); compiler_use_next_block(c, orelse); - VISIT_SEQ(c, stmt, s->v.Try.orelse); + VISIT_SEQ(c, stmt, s->v.TryStar.orelse); ADDOP_JUMP(c, JUMP_FORWARD, end); compiler_use_next_block(c, end); return 1; @@ -3462,6 +3595,13 @@ compiler_try(struct compiler *c, stmt_ty s) { return compiler_try_except(c, s); } +static int +compiler_try_star(struct compiler *c, stmt_ty s) { + if (s->v.TryStar.finalbody && asdl_seq_LEN(s->v.TryStar.finalbody)) + return compiler_try_star_finally(c, s); + else + return compiler_try_star_except(c, s); +} static int compiler_import_as(struct compiler *c, identifier name, identifier asname) @@ -3724,6 +3864,8 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s) break; case Try_kind: return compiler_try(c, s); + case TryStar_kind: + return compiler_try_star(c, s); case Assert_kind: return compiler_assert(c, s); case Import_kind: diff --git a/Python/symtable.c b/Python/symtable.c index dc5426cf3b4267..245889f67d44fb 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1339,6 +1339,12 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s) VISIT_SEQ(st, excepthandler, s->v.Try.handlers); VISIT_SEQ(st, stmt, s->v.Try.finalbody); break; + case TryStar_kind: + VISIT_SEQ(st, stmt, s->v.TryStar.body); + VISIT_SEQ(st, stmt, s->v.TryStar.orelse); + VISIT_SEQ(st, excepthandler, s->v.TryStar.handlers); + VISIT_SEQ(st, stmt, s->v.TryStar.finalbody); + break; case Assert_kind: VISIT(st, expr, s->v.Assert.test); if (s->v.Assert.msg) From 488f9fac854b99fe909130d0ba3494b67ee6c2fb Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 01:22:56 +0000 Subject: [PATCH 10/37] Revert doctest changes (not needed with TryStar) This reverts commit ca44878e0a149970e4c7ca1e00deea57eb074449. --- Doc/library/ast.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index a05da001eaa116..e29b5e88d71d41 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -1163,8 +1163,7 @@ Control flow value=Constant(value=Ellipsis))], finalbody=[ Expr( - value=Constant(value=Ellipsis))], - star=0)], + value=Constant(value=Ellipsis))])], type_ignores=[]) @@ -1198,8 +1197,7 @@ Control flow body=[ Pass()])], orelse=[], - finalbody=[], - star=0)], + finalbody=[])], type_ignores=[]) From 4eff693e01009cc3cf92af9409d5df4f3f27e519 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 11:43:37 +0000 Subject: [PATCH 11/37] a pesky little decref --- Python/ceval.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index 40bbd2145732c4..704b8a8e15eb18 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3834,7 +3834,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr PyObject *right = POP(); PyObject *left = TOP(); if (!check_except_type_valid(tstate, right)) { - Py_DECREF(left); Py_DECREF(right); goto error; } From 211d6da89158bc11897b24c7fabba9a27bff1d0a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 22 Nov 2021 13:05:33 +0000 Subject: [PATCH 12/37] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core and Builtins/2021-11-22-13-05-32.bpo-45292.pfEouJ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2021-11-22-13-05-32.bpo-45292.pfEouJ.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-11-22-13-05-32.bpo-45292.pfEouJ.rst b/Misc/NEWS.d/next/Core and Builtins/2021-11-22-13-05-32.bpo-45292.pfEouJ.rst new file mode 100644 index 00000000000000..2cc7f39d46480f --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2021-11-22-13-05-32.bpo-45292.pfEouJ.rst @@ -0,0 +1 @@ +Complete the :pep:`654` implementation: add ``except*``. \ No newline at end of file From 03dbf43999c83fb44cf7ad52964ce50ff9ae67fe Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 14:11:15 +0000 Subject: [PATCH 13/37] update unparse for TryStar --- Lib/ast.py | 21 +++++++++++++++++++-- Lib/test/test_unparse.py | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index 400d7c45146da8..ad8bca9992ef56 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -683,6 +683,7 @@ def __init__(self, *, _avoid_backslashes=False): self._type_ignores = {} self._indent = 0 self._avoid_backslashes = _avoid_backslashes + self._in_try_star = False def interleave(self, inter, f, seq): """Call f on each item in seq, calling inter() in between.""" @@ -953,7 +954,7 @@ def visit_Raise(self, node): self.write(" from ") self.traverse(node.cause) - def visit_Try(self, node): + def do_visit_try(self, node): self.fill("try") with self.block(): self.traverse(node.body) @@ -968,8 +969,24 @@ def visit_Try(self, node): with self.block(): self.traverse(node.finalbody) + def visit_Try(self, node): + try: + prev_in_try_star = self._in_try_star + self._in_try_star = False + self.do_visit_try(node) + finally: + self._in_try_star = prev_in_try_star + + def visit_TryStar(self, node): + try: + prev_in_try_star = self._in_try_star + self._in_try_star = True + self.do_visit_try(node) + finally: + self._in_try_star = prev_in_try_star + def visit_ExceptHandler(self, node): - self.fill("except") + self.fill("except*" if self._in_try_star else "except") if node.type: self.write(" ") self.traverse(node.type) diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index d8ba487328b393..f5be13aa94a64c 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -93,6 +93,19 @@ class Foo: pass suite5 """ +try_except_star_finally = """\ +try: + suite1 +except* ex1: + suite2 +except* ex2: + suite3 +else: + suite4 +finally: + suite5 +""" + with_simple = """\ with f(): suite1 @@ -304,6 +317,9 @@ def test_elifs(self): def test_try_except_finally(self): self.check_ast_roundtrip(try_except_finally) + def test_try_except_star_finally(self): + self.check_ast_roundtrip(try_except_star_finally) + def test_starred_assignment(self): self.check_ast_roundtrip("a, *b, c = seq") self.check_ast_roundtrip("a, (*b, c) = seq") From 704bc8fb2155420df7880fb8145fcc9d2f7c10a2 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 14:22:00 +0000 Subject: [PATCH 14/37] update ast doc with TryStar --- Doc/library/ast.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index e29b5e88d71d41..6486ed4f216967 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -1167,6 +1167,37 @@ Control flow type_ignores=[]) +.. class:: TryStar(body, handlers, orelse, finalbody) + + ``try`` blocks which are followed by ``except*`` clauses. The attributes are the + same as for :class:`Try` but the :class:`ExceptHandler` nodes in ``handlers`` + are interpreted as ``except*`` blocks rather then ``except``. + + .. doctest:: + + >>> print(ast.dump(ast.parse(""" + ... try: + ... ... + ... except* Exception: + ... ... + ... """), indent=4)) + Module( + body=[ + TryStar( + body=[ + Expr( + value=Constant(value=Ellipsis))], + handlers=[ + ExceptHandler( + type=Name(id='Exception', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))])], + orelse=[], + finalbody=[])], + type_ignores=[]) + + .. class:: ExceptHandler(type, name, body) A single ``except`` clause. ``type`` is the exception type it will match, From ff36e5dc58be3f6e3c2e176f0b9234aacc88cdb1 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 14:29:23 +0000 Subject: [PATCH 15/37] add try-star test in test_grammar --- Lib/test/test_grammar.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index b6c457465609af..a2460add4c9eed 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -1419,6 +1419,30 @@ def test_try(self): compile("try:\n pass\nexcept Exception as a.b:\n pass", "?", "exec") compile("try:\n pass\nexcept Exception as a[b]:\n pass", "?", "exec") + def test_try_star(self): + ### try_stmt: 'try': suite (except_star_clause : suite) + ['else' ':' suite] + ### except_star_clause: 'except*' expr ['as' NAME] + try: + 1/0 + except* ZeroDivisionError: + pass + else: + pass + try: 1/0 + except* EOFError: pass + except* ZeroDivisionError as msg: pass + else: pass + try: 1/0 + except* (EOFError, TypeError, ZeroDivisionError): pass + try: 1/0 + except* (EOFError, TypeError, ZeroDivisionError) as msg: pass + try: pass + finally: pass + with self.assertRaises(SyntaxError): + compile("try:\n pass\nexcept* Exception as a.b:\n pass", "?", "exec") + compile("try:\n pass\nexcept* Exception as a[b]:\n pass", "?", "exec") + compile("try:\n pass\nexcept*:\n pass", "?", "exec") + def test_suite(self): # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT if 1: pass From 73ee294719006467cc4a0c97b0f47d0070706bac Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 14:34:17 +0000 Subject: [PATCH 16/37] add test for invalid exception matcher (old except) --- Lib/test/test_exceptions.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index f7b39ac6f930f9..29b06ec853f55a 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -2403,6 +2403,21 @@ def test_incorrect_constructor(self): self.assertRaises(TypeError, SyntaxError, "bad bad", args) +class TestInvalidExceptionMatcher(unittest.TestCase): + def test_except_star_invalid_exception_type(self): + with self.assertRaises(TypeError): + try: + raise ValueError + except 42: + pass + + with self.assertRaises(TypeError): + try: + raise ValueError + except (ValueError, 42): + pass + + class PEP626Tests(unittest.TestCase): def lineno_after_raise(self, f, *expected): From 51e81780d9048eca9d47d82185c3ffd4a39db81a Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 18:13:26 +0000 Subject: [PATCH 17/37] break/ continue/return in except* block is SyntaxError --- Lib/test/test_except_star.py | 123 +++++++++++++++++++++++++++++++++++ Python/compile.c | 14 ++-- 2 files changed, 133 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_except_star.py b/Lib/test/test_except_star.py index 4ef641722aca4c..53f509d7a515a5 100644 --- a/Lib/test/test_except_star.py +++ b/Lib/test/test_except_star.py @@ -1,5 +1,6 @@ import sys import unittest +import textwrap class TestInvalidExceptStar(unittest.TestCase): def test_mixed_except_and_except_star_is_syntax_error(self): @@ -46,6 +47,128 @@ def test_except_star_invalid_exception_type(self): pass +class TestBreakContinueReturnInExceptStarBlock(unittest.TestCase): + MSG = (r"'break', 'continue' and 'return'" + r" cannot appear in an except\* block") + + def check_invalid(self, src): + with self.assertRaisesRegex(SyntaxError, self.MSG): + compile(textwrap.dedent(src), "", "exec") + + def test_break_in_except_star(self): + self.check_invalid( + """ + try: + raise ValueError + except* Exception as e: + break + """) + + self.check_invalid( + """ + for i in range(5): + try: + pass + except* Exception as e: + if i == 2: + break + """) + + self.check_invalid( + """ + for i in range(5): + try: + pass + except* Exception as e: + if i == 2: + break + finally: + return 0 + """) + + + def test_continue_in_except_star_block_invalid(self): + self.check_invalid( + """ + for i in range(5): + try: + raise ValueError + except* Exception as e: + continue + """) + + self.check_invalid( + """ + for i in range(5): + try: + pass + except* Exception as e: + if i == 2: + continue + """) + + self.check_invalid( + """ + for i in range(5): + try: + pass + except* Exception as e: + if i == 2: + continue + finally: + return 0 + """) + + def test_return_in_except_star_block_invalid(self): + self.check_invalid( + """ + def f(): + try: + raise ValueError + except* Exception as e: + return 42 + """) + + self.check_invalid( + """ + def f(): + try: + pass + except* Exception as e: + return 42 + finally: + finished = True + """) + + def test_break_continue_in_except_star_block_valid(self): + try: + raise ValueError(42) + except* Exception as e: + count = 0 + for i in range(5): + if i == 0: + continue + if i == 4: + break + count += 1 + + self.assertEqual(count, 3) + self.assertEqual(i, 4) + exc = e + self.assertIsInstance(exc, ExceptionGroup) + + def test_return_in_except_star_block_valid(self): + try: + raise ValueError(42) + except* Exception as e: + def f(x): + return 2*x + r = f(3) + exc = e + self.assertEqual(r, 6) + self.assertIsInstance(exc, ExceptionGroup) + + class ExceptStarTest(unittest.TestCase): def assertExceptionIsLike(self, exc, template): if exc is None and template is None: diff --git a/Python/compile.c b/Python/compile.c index 2748f2e43980bb..15aeccd5eef1df 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -175,7 +175,7 @@ compiler IR. enum fblocktype { WHILE_LOOP, FOR_LOOP, TRY_EXCEPT, FINALLY_TRY, FINALLY_END, WITH, ASYNC_WITH, HANDLER_CLEANUP, POP_VALUE, EXCEPTION_HANDLER, - ASYNC_COMPREHENSION_GENERATOR }; + EXCEPTION_GROUP_HANDLER, ASYNC_COMPREHENSION_GENERATOR }; struct fblockinfo { enum fblocktype fb_type; @@ -323,6 +323,7 @@ static int compiler_call_helper(struct compiler *c, int n, asdl_expr_seq *args, asdl_keyword_seq *keywords); static int compiler_try_except(struct compiler *, stmt_ty); +static int compiler_try_star_except(struct compiler *, stmt_ty); static int compiler_set_qualname(struct compiler *); static int compiler_sync_comprehension_generator( @@ -1831,6 +1832,7 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info, switch (info->fb_type) { case WHILE_LOOP: case EXCEPTION_HANDLER: + case EXCEPTION_GROUP_HANDLER: case ASYNC_COMPREHENSION_GENERATOR: return 1; @@ -1934,6 +1936,10 @@ compiler_unwind_fblock_stack(struct compiler *c, int preserve_tos, struct fblock return 1; } struct fblockinfo *top = &c->u->u_fblock[c->u->u_nfblocks-1]; + if (top->fb_type == EXCEPTION_GROUP_HANDLER) { + return compiler_error( + c, "'break', 'continue' and 'return' cannot appear in an except* block"); + } if (loop != NULL && (top->fb_type == WHILE_LOOP || top->fb_type == FOR_LOOP)) { *loop = top; return 1; @@ -3218,7 +3224,7 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s) if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.TryStar.finalbody)) return 0; if (s->v.TryStar.handlers && asdl_seq_LEN(s->v.TryStar.handlers)) { - if (!compiler_try_except(c, s)) + if (!compiler_try_star_except(c, s)) return 0; } else { @@ -3443,7 +3449,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); /* Runtime will push a block here, so we need to account for that */ - if (!compiler_push_fblock(c, EXCEPTION_HANDLER, NULL, NULL, "except handler")) + if (!compiler_push_fblock(c, EXCEPTION_GROUP_HANDLER, NULL, NULL, "except handler")) return 0; for (i = 0; i < n; i++) { excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( @@ -3555,7 +3561,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) } /* Mark as artificial */ UNSET_LOC(c); - compiler_pop_fblock(c, EXCEPTION_HANDLER, NULL); + compiler_pop_fblock(c, EXCEPTION_GROUP_HANDLER, NULL); basicblock *reraise; reraise = compiler_new_block(c); if (!reraise) From 50a212685b990388417b402e787f13f9e4b91fd6 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 22 Nov 2021 18:20:12 +0000 Subject: [PATCH 18/37] add stack stability tests for except* --- Lib/test/test_compile.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index f72c7ca68f363a..82c10929432870 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -1261,6 +1261,39 @@ def test_try_except_as(self): """ self.check_stack_size(snippet) + def test_try_except_star_qualified(self): + snippet = """ + try: + a + except* ImportError: + b + else: + c + """ + self.check_stack_size(snippet) + + def test_try_except_star_as(self): + snippet = """ + try: + a + except* ImportError as e: + b + else: + c + """ + self.check_stack_size(snippet) + + def test_try_except_star_finally(self): + snippet = """ + try: + a + except* A: + b + finally: + c + """ + self.check_stack_size(snippet) + def test_try_finally(self): snippet = """ try: From 4a7bf9f78001a82823b1087acc68f8c6f16d9631 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Tue, 23 Nov 2021 18:15:48 +0000 Subject: [PATCH 19/37] remove commented out debug prints --- Python/compile.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 15aeccd5eef1df..97291303df790f 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -6912,11 +6912,9 @@ stackdepth(struct compiler *c) int depth = b->b_startdepth; assert(depth >= 0); basicblock *next = b->b_next; -//fprintf(stderr, " >> b->b_startdepth = %d\n", b->b_startdepth); for (int i = 0; i < b->b_iused; i++) { struct instr *instr = &b->b_instr[i]; int effect = stack_effect(instr->i_opcode, instr->i_oparg, 0); -//fprintf(stderr, "[%d] instr->i_opcode=%d, effect = %d\n", i, instr->i_opcode, effect); if (effect == PY_INVALID_STACK_EFFECT) { PyErr_Format(PyExc_SystemError, "compiler stack_effect(opcode=%d, arg=%i) failed", From 3ad5d41177cb07267787749042fd0e9461966e89 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 24 Nov 2021 19:09:49 +0000 Subject: [PATCH 20/37] add trace tests for except* --- Lib/test/test_sys_settrace.py | 175 ++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index b565bef4c44239..dced216f280cc6 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -1169,6 +1169,181 @@ def func(): (5, 'line'), (5, 'return')]) + def test_try_except_star_no_exception(self): + + def func(): + try: + 2 + except* Exception: + 4 + else: + 6 + finally: + 8 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (6, 'line'), + (8, 'line'), + (8, 'return')]) + + def test_try_except_star_named_no_exception(self): + + def func(): + try: + 2 + except* Exception as e: + 4 + else: + 6 + finally: + 8 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (6, 'line'), + (8, 'line'), + (8, 'return')]) + + def test_try_except_star_exception_caught(self): + + def func(): + try: + raise ValueError(2) + except* ValueError: + 4 + else: + 6 + finally: + 8 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (2, 'exception'), + (3, 'line'), + (4, 'line'), + (8, 'line'), + (8, 'return')]) + + def test_try_except_star_named_exception_caught(self): + + def func(): + try: + raise ValueError(2) + except* ValueError as e: + 4 + else: + 6 + finally: + 8 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (2, 'exception'), + (3, 'line'), + (4, 'line'), + (8, 'line'), + (8, 'return')]) + + def test_try_except_star_exception_not_caught(self): + + def func(): + try: + try: + raise ValueError(3) + except* TypeError: + 5 + except ValueError: + 7 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (3, 'exception'), + (4, 'line'), + (6, 'line'), + (7, 'line'), + (7, 'return')]) + + def test_try_except_star_named_exception_not_caught(self): + + def func(): + try: + try: + raise ValueError(3) + except* TypeError as e: + 5 + except ValueError: + 7 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (3, 'exception'), + (4, 'line'), + (6, 'line'), + (7, 'line'), + (7, 'return')]) + + def test_try_except_star_nested(self): + + def func(): + try: + try: + raise ExceptionGroup( + 'eg', + [ValueError(5), TypeError('bad type')]) + except* TypeError as e: + 7 + except* OSError: + 9 + except* ValueError: + raise + except* ValueError: + try: + raise TypeError(14) + except* OSError: + 16 + except* TypeError as e: + 18 + return 0 + + self.run_and_compare(func, + [(0, 'call'), + (1, 'line'), + (2, 'line'), + (3, 'line'), + (4, 'line'), + (5, 'line'), + (3, 'line'), + (3, 'exception'), + (6, 'line'), + (7, 'line'), + (8, 'line'), + (10, 'line'), + (11, 'line'), + (12, 'line'), + (13, 'line'), + (14, 'line'), + (14, 'exception'), + (15, 'line'), + (17, 'line'), + (18, 'line'), + (19, 'line'), + (19, 'return')]) + class SkipLineEventsTraceTestCase(TraceTestCase): """Repeat the trace tests, but with per-line events skipped""" From 2813363dde90abea4ed0129a214b16b27ab753e3 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 24 Nov 2021 19:17:44 +0000 Subject: [PATCH 21/37] remove obsolete comment --- Python/ceval.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index f9102bd6b54cb1..0caa41e2bf113f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -6221,7 +6221,6 @@ do_reraise_star(PyObject *excs, PyObject *orig) * could have executed,so there is at most one exception to raise. */ - /* TODO: when I finish the compiler work the None might not be there anymore. */ assert(numexcs == 1 || (numexcs == 2 && PyList_GET_ITEM(excs, 1) == Py_None)); PyObject *e = PyList_GET_ITEM(excs, 0); From 7e548050efba4fab4370d897d35611c6554a4d1a Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Thu, 25 Nov 2021 09:59:06 +0000 Subject: [PATCH 22/37] formatting of comment Co-authored-by: Guido van Rossum --- Doc/library/dis.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index e219b4e92a53d8..fda86906acf3c1 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -885,7 +885,7 @@ All of the following opcodes use their arguments. .. opcode:: JUMP_IF_NOT_EG_MATCH (target) - Performs exception matching for except*. Applies ``split(TOS)`` on + Performs exception matching for ``except*``. Applies ``split(TOS)`` on the exception group representing TOS1. Jumps if no match is found. Pops one item from the stack. If a match was found, pops the 3 items representing From 5736f15f6790da97e3f7c9efd0e577f0f63bef48 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Thu, 25 Nov 2021 10:00:22 +0000 Subject: [PATCH 23/37] save step before try Co-authored-by: Guido van Rossum --- Lib/ast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ast.py b/Lib/ast.py index ad8bca9992ef56..d776c4408894dd 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -970,8 +970,8 @@ def do_visit_try(self, node): self.traverse(node.finalbody) def visit_Try(self, node): + prev_in_try_star = self._in_try_star try: - prev_in_try_star = self._in_try_star self._in_try_star = False self.do_visit_try(node) finally: From 82a4db3f18b2cca5beeda3cbea60b0650b1c64d9 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 25 Nov 2021 10:44:45 +0000 Subject: [PATCH 24/37] add diagram of stack contents durign except* --- Doc/library/dis.rst | 5 ++++- Python/compile.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index fda86906acf3c1..fbb77bf1d4a36e 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -889,7 +889,10 @@ All of the following opcodes use their arguments. the exception group representing TOS1. Jumps if no match is found. Pops one item from the stack. If a match was found, pops the 3 items representing - the exception and replaces them with the triplets for the non-matching part, + the exception and pushes the three items representing the non-matching parti of + the exception group, followed by the three items representing the matching part. + In other words, in case of a match it pops 4 items and pushes 6. + and above it the matching part. .. versionadded:: 3.11 diff --git a/Python/compile.c b/Python/compile.c index 97291303df790f..37bf316af5efe9 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3415,6 +3415,60 @@ compiler_try_except(struct compiler *c, stmt_ty s) return 1; } +/* + Code generated for "try: S except* E1 as V1: S1 except* E2 as V2: S2 ...": + (The contents of the value stack is shown in [], with the top + at the right; 'tb' is trace-back info, 'val' the exception instance, + and 'typ' the exception's type.) + + Value stack Label Instruction Argument + [] SETUP_FINALLY L1 + [] + [] POP_BLOCK + [] JUMP_FORWARD L0 + + [tb, val, typ, orig, typ] L1: DUP_TOP_TWO ) save a copy of the + [tb, val, typ, orig] POP_TOP ) original raised exception + [orig, tb, val, typ] ROT_FOUR ) + + [orig, tb, val, typ, res] BUILD_LIST ) list for raised/reraised + [orig, res, tb, val, typ] ROT_FOUR ) exceptions ("result") + + [orig, res, tb, val, typ] ) + [orig, res, tb, val, typ, E1] JUMP_IF_NOT_EXC_MATCH L2 ) only if E1 + + [orig, res, tb, rest, typ, tb, match, typ] POP + [orig, res, tb, rest, typ, tb, match] (or POP if no V1) + [orig, res, tb, rest, typ, tb] POP + + [orig, res, tb, rest, typ] SETUP_FINALLY R1 + [orig, res, tb, rest, typ] + [orig, res, tb, rest, typ] JUMP_FORWARD L2 + + [orig, res, tb, rest, typ, i, tb, v, t] R1: POP ) exception raised in except* body + [orig, res, tb, rest, typ, i, tb, v] LIST_APPEND 6 ) add it to res + [orig, res, tb, rest, typ, i, tb] POP + [orig, res, tb, rest, typ, i] POP + + [orig, res, tb, rest, typ] L2: + .............................etc....................... + + [orig, res, tb, rest, typ] Ln+1: POP ) add unhandled exception + [orig, res, tb, rest] LIST_APPEND 2 ) to res (could be None) + [orig, res, tb] POP + + [orig, res] PREP_RERAISE_STAR + [i, tb, val, typ] POP_JUMP_IF_TRUE RER + [i, tb, val, typ] POP + [i, tb, val] POP + [i, tb] POP + [i] POP + [] JUMP_FORWARD L0 + + [i, tb, val, typ] RER: POP_EXCEPT_AND_RERAISE + + [] L0: +*/ static int compiler_try_star_except(struct compiler *c, stmt_ty s) { From a461e7d9fa46787c056eff10531c9d59226ee23c Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 25 Nov 2021 15:48:11 +0000 Subject: [PATCH 25/37] one more save step before try --- Lib/ast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ast.py b/Lib/ast.py index d776c4408894dd..625738ad681af4 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -978,8 +978,8 @@ def visit_Try(self, node): self._in_try_star = prev_in_try_star def visit_TryStar(self, node): + prev_in_try_star = self._in_try_star try: - prev_in_try_star = self._in_try_star self._in_try_star = True self.do_visit_try(node) finally: From be609b3e7208437dd5f6075b53159447d308606a Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 25 Nov 2021 16:22:50 +0000 Subject: [PATCH 26/37] fix diagram --- Python/compile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 37bf316af5efe9..2379646b88696c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3427,10 +3427,9 @@ compiler_try_except(struct compiler *c, stmt_ty s) [] POP_BLOCK [] JUMP_FORWARD L0 - [tb, val, typ, orig, typ] L1: DUP_TOP_TWO ) save a copy of the - [tb, val, typ, orig] POP_TOP ) original raised exception - [orig, tb, val, typ] ROT_FOUR ) - + [tb, val, typ] L1: DUP_TOP_TWO ) save a copy of the + [tb, val, typ, orig, typ] POP_TOP ) original raised exception + [tb, val, typ, orig] ROT_FOUR ) [orig, tb, val, typ, res] BUILD_LIST ) list for raised/reraised [orig, res, tb, val, typ] ROT_FOUR ) exceptions ("result") From 706e54b418c22242c54f615320037e1bc9516273 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Thu, 25 Nov 2021 16:24:28 +0000 Subject: [PATCH 27/37] fix diagram some more --- Python/compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index 2379646b88696c..9af241c8369c3c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3430,8 +3430,8 @@ compiler_try_except(struct compiler *c, stmt_ty s) [tb, val, typ] L1: DUP_TOP_TWO ) save a copy of the [tb, val, typ, orig, typ] POP_TOP ) original raised exception [tb, val, typ, orig] ROT_FOUR ) - [orig, tb, val, typ, res] BUILD_LIST ) list for raised/reraised - [orig, res, tb, val, typ] ROT_FOUR ) exceptions ("result") + [orig, tb, val, typ] BUILD_LIST ) list for raised/reraised + [orig, tb, val, typ, res] ROT_FOUR ) exceptions ("result") [orig, res, tb, val, typ] ) [orig, res, tb, val, typ, E1] JUMP_IF_NOT_EXC_MATCH L2 ) only if E1 From 7f495759bce3fe83fc1f3820ce4dd2895011fdbb Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 27 Nov 2021 12:01:37 +0000 Subject: [PATCH 28/37] treat JUMP_IF_NOT_EG_MATCH like *_EXC_MATCH in mark_stacks --- Objects/frameobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 58dc7e9f6f5011..15d9d3bcad06a5 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -214,7 +214,9 @@ mark_stacks(PyCodeObject *code_obj, int len) if (stacks[j] == UNINITIALIZED && j < i) { todo = 1; } - if (opcode == JUMP_IF_NOT_EXC_MATCH) { + if (opcode == JUMP_IF_NOT_EXC_MATCH || + opcode == JUMP_IF_NOT_EG_MATCH) + { next_stack = pop_value(pop_value(next_stack)); target_stack = next_stack; } From ae729f380da48f47f180ab0b680a803f312fb729 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 27 Nov 2021 12:35:37 +0000 Subject: [PATCH 29/37] whatnew in 3.11 --- Doc/whatsnew/3.11.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 9751f894f9a9a5..211a82304f228d 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -65,6 +65,7 @@ Summary -- Release highlights .. PEP-sized items next. +PEP-654: Exception Groups and ``except*``. New Features ============ From bbe44fb3187ed1c43ca4860eb1da19bec5ed254a Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 8 Dec 2021 09:58:45 +0000 Subject: [PATCH 30/37] fix typos in dis doc entry --- Doc/library/dis.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 06d8b44526163c..3b12d170d60998 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -891,12 +891,10 @@ All of the following opcodes use their arguments. the exception group representing TOS1. Jumps if no match is found. Pops one item from the stack. If a match was found, pops the 3 items representing - the exception and pushes the three items representing the non-matching parti of + the exception and pushes the three items representing the non-matching part of the exception group, followed by the three items representing the matching part. In other words, in case of a match it pops 4 items and pushes 6. - and above it the matching part. - .. versionadded:: 3.11 From 22bf2077313e1d02876b8edbb35854f6fbb1e263 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Wed, 8 Dec 2021 20:06:15 +0000 Subject: [PATCH 31/37] "three items" --> "3items" Co-authored-by: Guido van Rossum --- Doc/library/dis.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 3b12d170d60998..f79a723c9ed581 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -891,8 +891,8 @@ All of the following opcodes use their arguments. the exception group representing TOS1. Jumps if no match is found. Pops one item from the stack. If a match was found, pops the 3 items representing - the exception and pushes the three items representing the non-matching part of - the exception group, followed by the three items representing the matching part. + the exception and pushes the 3items representing the non-matching part of + the exception group, followed by the 3items representing the matching part. In other words, in case of a match it pops 4 items and pushes 6. .. versionadded:: 3.11 From 66d830ac8c64e5c18dd9ce81719e775299ab33f6 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Wed, 8 Dec 2021 21:31:13 +0000 Subject: [PATCH 32/37] add spaces --- Doc/library/dis.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index f79a723c9ed581..3dcb52ed92dd46 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -891,8 +891,8 @@ All of the following opcodes use their arguments. the exception group representing TOS1. Jumps if no match is found. Pops one item from the stack. If a match was found, pops the 3 items representing - the exception and pushes the 3items representing the non-matching part of - the exception group, followed by the 3items representing the matching part. + the exception and pushes the 3 items representing the non-matching part of + the exception group, followed by the 3 items representing the matching part. In other words, in case of a match it pops 4 items and pushes 6. .. versionadded:: 3.11 From 035fe5cf08a58b362bbd79ba02f3de80fc032582 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 11 Dec 2021 15:17:59 +0000 Subject: [PATCH 33/37] Apply first batch of suggestions from code review Thank you Erlend! Co-authored-by: Erlend Egeberg Aasland --- Lib/test/test_except_star.py | 1 - Objects/exceptions.c | 24 ++++++--------- Python/ceval.c | 57 ++++++++++++++++++------------------ Python/compile.c | 34 +++++++++++++-------- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Lib/test/test_except_star.py b/Lib/test/test_except_star.py index 53f509d7a515a5..b03de9c1de32eb 100644 --- a/Lib/test/test_except_star.py +++ b/Lib/test/test_except_star.py @@ -974,4 +974,3 @@ def test_exc_info_restored(self): if __name__ == '__main__': unittest.main() - diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 0cc775b0948fda..f7635139846db3 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -774,8 +774,7 @@ BaseExceptionGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } PyObject * -_PyExc_CreateExceptionGroup( - const char *msg_str, PyObject *excs) +_PyExc_CreateExceptionGroup(const char *msg_str, PyObject *excs) { PyObject *msg = PyUnicode_FromString(msg_str); if (!msg) { @@ -786,8 +785,7 @@ _PyExc_CreateExceptionGroup( if (!args) { return NULL; } - PyObject *result = PyObject_CallObject( - PyExc_BaseExceptionGroup, args); + PyObject *result = PyObject_CallObject(PyExc_BaseExceptionGroup, args); Py_DECREF(args); return result; } @@ -979,12 +977,8 @@ exceptiongroup_split_check_match(PyObject *exc, } case EXCEPTION_GROUP_MATCH_INSTANCES: { assert(PySet_Check(matcher_value)); - if (! _PyBaseExceptionGroup_Check(exc)) { - int include = PySet_Contains(matcher_value, exc); - if (include == -1) { - return -1; - } - return include; + if (!_PyBaseExceptionGroup_Check(exc)) { + return PySet_Contains(matcher_value, exc); } return 0; } @@ -1168,9 +1162,9 @@ BaseExceptionGroup_subgroup(PyObject *self, PyObject *args) } static int -collect_exception_group_leaves(PyObject* exc, PyObject *leaves) +collect_exception_group_leaves(PyObject *exc, PyObject *leaves) { - if (exc == Py_None) { + if (Py_IsNone(exc)) { return 0; } @@ -1180,7 +1174,7 @@ collect_exception_group_leaves(PyObject* exc, PyObject *leaves) /* Add all leaf exceptions in exc to the leaves set */ if (!_PyBaseExceptionGroup_Check(exc)) { - if (PySet_Add(leaves, exc) == -1) { + if (PySet_Add(leaves, exc) < 0) { return -1; } return 0; @@ -1219,7 +1213,7 @@ _PyExc_ExceptionGroupProjection(PyObject *eg, PyObject *keep) PyObject *e = PyList_GET_ITEM(keep, i); assert(e != NULL); assert(_PyBaseExceptionGroup_Check(e)); - if (collect_exception_group_leaves(e, leaves) == -1) { + if (collect_exception_group_leaves(e, leaves) < 0) { Py_DECREF(leaves); return NULL; } @@ -1231,7 +1225,7 @@ _PyExc_ExceptionGroupProjection(PyObject *eg, PyObject *keep) eg, EXCEPTION_GROUP_MATCH_INSTANCES, leaves, construct_rest, &split_result); Py_DECREF(leaves); - if (err == -1) { + if (err < 0) { return NULL; } diff --git a/Python/ceval.c b/Python/ceval.c index ec0f25b2c471ba..1c02b875468cda 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1092,7 +1092,7 @@ match_class(PyThreadState *tstate, PyObject *subject, PyObject *type, static int do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause); -static PyObject* do_reraise_star(PyObject *excs, PyObject *orig); +static PyObject *do_reraise_star(PyObject *excs, PyObject *orig); static int exception_group_match( PyObject *exc_type, PyObject* exc_value, PyObject *match_type, PyObject **match, PyObject **rest); @@ -2814,7 +2814,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr PyObject *lasti_unused = Py_NewRef(_PyLong_GetZero()); PUSH(lasti_unused); - if (val != Py_None) { + if (!Py_IsNone(val)) { PyObject *tb = PyException_GetTraceback(val); PUSH(tb ? tb : Py_NewRef(Py_None)); PUSH(val); @@ -3970,10 +3970,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr } PyObject *match = NULL, *rest = NULL; - int res = exception_group_match( - exc_type, exc_value, match_type, &match, &rest); + int res = exception_group_match(exc_type, exc_value, + match_type, &match, &rest); Py_DECREF(match_type); - if (res == -1) { + if (res < 0) { goto error; } @@ -3983,7 +3983,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr goto error; } - if (match == Py_None) { + if (Py_IsNone(match)) { Py_DECREF(match); Py_XDECREF(rest); /* no match - jump to target */ @@ -4003,7 +4003,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr PyObject *val = SECOND(); PyObject *tb = THIRD(); - if (rest != Py_None) { + if (!Py_IsNone(rest)) { /* tb remains the same */ SET_TOP(Py_NewRef(Py_TYPE(rest))); SET_SECOND(Py_NewRef(rest)); @@ -6248,12 +6248,11 @@ do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause) */ static int -exception_group_match( - PyObject *exc_type, PyObject* exc_value, PyObject *match_type, - PyObject **match, PyObject **rest) +exception_group_match(PyObject *exc_type, PyObject* exc_value, + PyObject *match_type, PyObject **match, PyObject **rest) { - if (exc_type == Py_None) { - assert(exc_value == Py_None); + if (Py_IsNone(exc_type)) { + assert(Py_IsNone(exc_value)); *match = Py_NewRef(Py_None); *rest = Py_NewRef(Py_None); return 0; @@ -6292,8 +6291,8 @@ exception_group_match( * Check for partial match if it's an exception group. */ if (_PyBaseExceptionGroup_Check(exc_value)) { - PyObject *pair = PyObject_CallMethod( - exc_value, "split", "(O)", match_type); + PyObject *pair = PyObject_CallMethod(exc_value, "split", "(O)", + match_type); if (pair == NULL) { return -1; } @@ -6327,9 +6326,9 @@ is_same_exception_metadata(PyObject *exc1, PyObject *exc2) PyObject *ctx2 = PyException_GetContext(exc2); PyObject *cause2 = PyException_GetCause(exc2); - bool result = ((tb1 == tb2) && - (ctx1 == ctx2) && - (cause1 == cause2)); + bool result = (Py_Is(tb1, tb2) && + Py_Is(ctx1, ctx2) && + Py_Is(cause1, cause2)); Py_XDECREF(tb1); Py_XDECREF(ctx1); @@ -6351,7 +6350,7 @@ is_same_exception_metadata(PyObject *exc1, PyObject *exc2) Returns NULL and sets an exception on failure. */ -static PyObject* +static PyObject * do_reraise_star(PyObject *excs, PyObject *orig) { assert(PyList_Check(excs)); @@ -6394,7 +6393,7 @@ do_reraise_star(PyObject *excs, PyObject *orig) for (Py_ssize_t i = 0; i < numexcs; i++) { PyObject *e = PyList_GET_ITEM(excs, i); assert(e != NULL); - if (e == Py_None) { + if (Py_IsNone(e)) { continue; } bool is_reraise = is_same_exception_metadata(e, orig); @@ -6409,20 +6408,21 @@ do_reraise_star(PyObject *excs, PyObject *orig) goto done; } - if (reraised_eg != Py_None) { + if (!Py_IsNone(reraised_eg)) { assert(is_same_exception_metadata(reraised_eg, orig)); } Py_ssize_t num_raised = PyList_GET_SIZE(raised_list); if (num_raised == 0) { result = reraised_eg; - } else if (num_raised > 0) { + } + else if (num_raised > 0) { int res = 0; - if (reraised_eg != Py_None) { + if (!Py_IsNone(reraised_eg)) { res = PyList_Append(raised_list, reraised_eg); } Py_DECREF(reraised_eg); - if (res == -1) { + if (res < 0) { goto done; } result = _PyExc_CreateExceptionGroup("", raised_list); @@ -7334,7 +7334,7 @@ import_all_from(PyThreadState *tstate, PyObject *locals, PyObject *v) "BaseException is not allowed" #define CANNOT_EXCEPT_STAR_EG "catching ExceptionGroup with except* "\ - "is not allowed. Use except instead." + "is not allowed. Use except instead." static int check_except_type_valid(PyThreadState *tstate, PyObject* right) @@ -7370,12 +7370,11 @@ check_except_star_type_valid(PyThreadState *tstate, PyObject* right) // reject except *ExceptionGroup int res = 0; if (PyTuple_Check(right)) { - Py_ssize_t i, length; - length = PyTuple_GET_SIZE(right); - for (i = 0; i < length; i++) { + Py_ssize_t length = PyTuple_GET_SIZE(right); + for (Py_ssize_t i = 0; i < length; i++) { PyObject *exc = PyTuple_GET_ITEM(right, i); res = PyObject_IsSubclass(exc, PyExc_BaseExceptionGroup); - if (res == -1) { + if (res < 0) { return -1; } if (res == 1) { @@ -7385,7 +7384,7 @@ check_except_star_type_valid(PyThreadState *tstate, PyObject* right) } else { res = PyObject_IsSubclass(right, PyExc_BaseExceptionGroup); - if (res == -1) { + if (res < 0) { return -1; } } diff --git a/Python/compile.c b/Python/compile.c index 1e16a6816e6111..c49b5931807f5a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3225,8 +3225,9 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s) if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.TryStar.finalbody)) return 0; if (s->v.TryStar.handlers && asdl_seq_LEN(s->v.TryStar.handlers)) { - if (!compiler_try_star_except(c, s)) + if (!compiler_try_star_except(c, s)) { return 0; + } } else { VISIT_SEQ(c, stmt, s->v.TryStar.body); @@ -3241,8 +3242,9 @@ compiler_try_star_finally(struct compiler *c, stmt_ty s) UNSET_LOC(c); ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); - if (!compiler_push_fblock(c, FINALLY_END, end, NULL, NULL)) + if (!compiler_push_fblock(c, FINALLY_END, end, NULL, NULL)) { return 0; + } VISIT_SEQ(c, stmt, s->v.TryStar.finalbody); compiler_pop_fblock(c, FINALLY_END, end); ADDOP_I(c, RERAISE, 0); @@ -3485,13 +3487,15 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) return 0; reraise_star = compiler_new_block(c); - if (reraise_star == NULL) + if (reraise_star == NULL) { return 0; + } ADDOP_JUMP(c, SETUP_FINALLY, except); compiler_use_next_block(c, body); - if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL)) + if (!compiler_push_fblock(c, TRY_EXCEPT, body, NULL, NULL)) { return 0; + } VISIT_SEQ(c, stmt, s->v.TryStar.body); compiler_pop_fblock(c, TRY_EXCEPT, body); ADDOP_NOLINE(c, POP_BLOCK); @@ -3510,8 +3514,9 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) s->v.TryStar.handlers, i); SET_LOC(c, handler); except = compiler_new_block(c); - if (except == NULL) + if (except == NULL) { return 0; + } if (i == 0) { /* Push the original EG into the stack */ /* @@ -3577,7 +3582,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); ADDOP(c, POP_BLOCK); - if(handler->v.ExceptHandler.name) { + if (handler->v.ExceptHandler.name) { ADDOP_LOAD_CONST(c, Py_None); compiler_nameop(c, handler->v.ExceptHandler.name, Store); compiler_nameop(c, handler->v.ExceptHandler.name, Del); @@ -3590,7 +3595,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) /* name = None; del name; # Mark as artificial */ UNSET_LOC(c); - if(handler->v.ExceptHandler.name) { + if (handler->v.ExceptHandler.name) { ADDOP_LOAD_CONST(c, Py_None); compiler_nameop(c, handler->v.ExceptHandler.name, Store); compiler_nameop(c, handler->v.ExceptHandler.name, Del); @@ -3616,10 +3621,10 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) /* Mark as artificial */ UNSET_LOC(c); compiler_pop_fblock(c, EXCEPTION_GROUP_HANDLER, NULL); - basicblock *reraise; - reraise = compiler_new_block(c); - if (!reraise) + basicblock *reraise = compiler_new_block(c); + if (!reraise) { return 0; + } compiler_use_next_block(c, reraise_star); ADDOP(c, PREP_RERAISE_STAR); @@ -3656,11 +3661,14 @@ compiler_try(struct compiler *c, stmt_ty s) { } static int -compiler_try_star(struct compiler *c, stmt_ty s) { - if (s->v.TryStar.finalbody && asdl_seq_LEN(s->v.TryStar.finalbody)) +compiler_try_star(struct compiler *c, stmt_ty s) +{ + if (s->v.TryStar.finalbody && asdl_seq_LEN(s->v.TryStar.finalbody)) { return compiler_try_star_finally(c, s); - else + } + else { return compiler_try_star_except(c, s); + } } static int From 5d52de3e13f80de8b3d2ff5d7462e3eac0a0da34 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 11 Dec 2021 16:52:39 +0000 Subject: [PATCH 34/37] the remaining comments from Erlend --- Lib/test/test_ast.py | 20 ++++++++++++ Python/ceval.c | 34 ++++++++------------ Python/compile.c | 74 ++++++++++++++++++++++++++++---------------- 3 files changed, 80 insertions(+), 48 deletions(-) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index f1b0e4e448461e..314b360c58ba95 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -1312,6 +1312,26 @@ def test_try(self): t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))]) self.stmt(t, "must have Load context") + def test_try_star(self): + p = ast.Pass() + t = ast.TryStar([], [], [], [p]) + self.stmt(t, "empty body on TryStar") + t = ast.TryStar([ast.Expr(ast.Name("x", ast.Store()))], [], [], [p]) + self.stmt(t, "must have Load context") + t = ast.TryStar([p], [], [], []) + self.stmt(t, "TryStar has neither except handlers nor finalbody") + t = ast.TryStar([p], [], [p], [p]) + self.stmt(t, "TryStar has orelse but no except handlers") + t = ast.TryStar([p], [ast.ExceptHandler(None, "x", [])], [], []) + self.stmt(t, "empty body on ExceptHandler") + e = [ast.ExceptHandler(ast.Name("x", ast.Store()), "y", [p])] + self.stmt(ast.TryStar([p], e, [], []), "must have Load context") + e = [ast.ExceptHandler(None, "x", [p])] + t = ast.TryStar([p], e, [ast.Expr(ast.Name("x", ast.Store()))], [p]) + self.stmt(t, "must have Load context") + t = ast.TryStar([p], e, [p], [ast.Expr(ast.Name("x", ast.Store()))]) + self.stmt(t, "must have Load context") + def test_assert(self): self.stmt(ast.Assert(ast.Name("x", ast.Store()), None), "must have Load context") diff --git a/Python/ceval.c b/Python/ceval.c index 1c02b875468cda..fb19f78ba14d46 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4049,15 +4049,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr int res = PyErr_GivenExceptionMatches(left, right); Py_DECREF(right); - if (res > 0) { - /* Exception matches -- Do nothing */; - } - else if (res == 0) { + if (res == 0) { JUMPTO(oparg); } - else { - goto error; - } DISPATCH(); } @@ -6260,11 +6254,7 @@ exception_group_match(PyObject *exc_type, PyObject* exc_value, assert(PyExceptionClass_Check(exc_type)); assert(PyExceptionInstance_Check(exc_value)); - int res = PyErr_GivenExceptionMatches(exc_type, match_type); - if (res == -1) { - return -1; - } - if (res > 0) { + if (PyErr_GivenExceptionMatches(exc_type, match_type)) { /* Full match of exc itself */ bool is_eg = _PyBaseExceptionGroup_Check(exc_value); if (is_eg) { @@ -6398,7 +6388,7 @@ do_reraise_star(PyObject *excs, PyObject *orig) } bool is_reraise = is_same_exception_metadata(e, orig); PyObject *append_list = is_reraise ? reraised_list : raised_list; - if (PyList_Append(append_list, e) == -1) { + if (PyList_Append(append_list, e) < 0) { goto done; } } @@ -7367,28 +7357,30 @@ check_except_star_type_valid(PyThreadState *tstate, PyObject* right) if (check_except_type_valid(tstate, right) < 0) { return -1; } - // reject except *ExceptionGroup - int res = 0; + + /* reject except *ExceptionGroup */ + + int is_subclass = 0; if (PyTuple_Check(right)) { Py_ssize_t length = PyTuple_GET_SIZE(right); for (Py_ssize_t i = 0; i < length; i++) { PyObject *exc = PyTuple_GET_ITEM(right, i); - res = PyObject_IsSubclass(exc, PyExc_BaseExceptionGroup); - if (res < 0) { + is_subclass = PyObject_IsSubclass(exc, PyExc_BaseExceptionGroup); + if (is_subclass < 0) { return -1; } - if (res == 1) { + if (is_subclass) { break; } } } else { - res = PyObject_IsSubclass(right, PyExc_BaseExceptionGroup); - if (res < 0) { + is_subclass = PyObject_IsSubclass(right, PyExc_BaseExceptionGroup); + if (is_subclass < 0) { return -1; } } - if (res == 1) { + if (is_subclass) { _PyErr_SetString(tstate, PyExc_TypeError, CANNOT_EXCEPT_STAR_EG); return -1; diff --git a/Python/compile.c b/Python/compile.c index c49b5931807f5a..6cda8d6967ee81 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3210,20 +3210,28 @@ compiler_try_finally(struct compiler *c, stmt_ty s) static int compiler_try_star_finally(struct compiler *c, stmt_ty s) { - basicblock *body, *end, *exit, *cleanup; - - body = compiler_new_block(c); - end = compiler_new_block(c); - exit = compiler_new_block(c); - cleanup = compiler_new_block(c); - if (body == NULL || end == NULL || exit == NULL || cleanup == NULL) { + basicblock *body = compiler_new_block(c); + if (body == NULL) { + return 0; + } + basicblock *end = compiler_new_block(c); + if (!end) { + return 0; + } + basicblock *exit = compiler_new_block(c); + if (!exit) { + return 0; + } + basicblock *cleanup = compiler_new_block(c); + if (!cleanup) { return 0; } /* `try` block */ ADDOP_JUMP(c, SETUP_FINALLY, end); compiler_use_next_block(c, body); - if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.TryStar.finalbody)) + if (!compiler_push_fblock(c, FINALLY_TRY, body, end, s->v.TryStar.finalbody)) { return 0; + } if (s->v.TryStar.handlers && asdl_seq_LEN(s->v.TryStar.handlers)) { if (!compiler_try_star_except(c, s)) { return 0; @@ -3474,19 +3482,27 @@ compiler_try_except(struct compiler *c, stmt_ty s) static int compiler_try_star_except(struct compiler *c, stmt_ty s) { - basicblock *body, *orelse, *except, *end, *cleanup; - basicblock *reraise_star = NULL; /* for except* */ - Py_ssize_t i, n; - - body = compiler_new_block(c); - except = compiler_new_block(c); - orelse = compiler_new_block(c); - end = compiler_new_block(c); - cleanup = compiler_new_block(c); - if (body == NULL || except == NULL || orelse == NULL || end == NULL || cleanup == NULL) + basicblock *body = compiler_new_block(c); + if (body == NULL) { return 0; - - reraise_star = compiler_new_block(c); + } + basicblock *except = compiler_new_block(c); + if (except == NULL) { + return 0; + } + basicblock *orelse = compiler_new_block(c); + if (orelse == NULL) { + return 0; + } + basicblock *end = compiler_new_block(c); + if (end == NULL) { + return 0; + } + basicblock *cleanup = compiler_new_block(c); + if (cleanup == NULL) { + return 0; + } + basicblock *reraise_star = compiler_new_block(c); if (reraise_star == NULL) { return 0; } @@ -3500,16 +3516,18 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) compiler_pop_fblock(c, TRY_EXCEPT, body); ADDOP_NOLINE(c, POP_BLOCK); ADDOP_JUMP_NOLINE(c, JUMP_FORWARD, orelse); - n = asdl_seq_LEN(s->v.TryStar.handlers); + Py_ssize_t n = asdl_seq_LEN(s->v.TryStar.handlers); compiler_use_next_block(c, except); UNSET_LOC(c); ADDOP_JUMP(c, SETUP_CLEANUP, cleanup); ADDOP(c, PUSH_EXC_INFO); /* Runtime will push a block here, so we need to account for that */ - if (!compiler_push_fblock(c, EXCEPTION_GROUP_HANDLER, NULL, NULL, "except handler")) + if (!compiler_push_fblock(c, EXCEPTION_GROUP_HANDLER, + NULL, NULL, "except handler")) { return 0; - for (i = 0; i < n; i++) { + } + for (Py_ssize_t i = 0; i < n; i++) { excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( s->v.TryStar.handlers, i); SET_LOC(c, handler); @@ -3544,11 +3562,13 @@ compiler_try_star_except(struct compiler *c, stmt_ty s) NEXT_BLOCK(c); } ADDOP(c, POP_TOP); // exc_type - basicblock *cleanup_end, *cleanup_body; - cleanup_end = compiler_new_block(c); - cleanup_body = compiler_new_block(c); - if (cleanup_end == NULL || cleanup_body == NULL) { + basicblock *cleanup_end = compiler_new_block(c); + if (cleanup_end == NULL) { + return 0; + } + basicblock *cleanup_body = compiler_new_block(c); + if (cleanup_body == NULL) { return 0; } From a1591f01d3f74a5e54caab98f1ee776efd93f3d5 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 11 Dec 2021 16:55:17 +0000 Subject: [PATCH 35/37] sign what's new --- Doc/whatsnew/3.11.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 2cfd9403a10851..793075c4b61734 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -66,6 +66,7 @@ Summary -- Release highlights .. PEP-sized items next. PEP-654: Exception Groups and ``except*``. +(Contributed by Irit Katriel in :issue:`45292`.) New Features ============ From 20d9ccdd48b3b2cc10127ffaff10f92875952bae Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sun, 12 Dec 2021 12:21:14 +0000 Subject: [PATCH 36/37] '== -1' --> '< 0' for consistency. Added a missing recursion guard. --- Objects/exceptions.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c index f7635139846db3..1db49d949b5c01 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -895,7 +895,7 @@ exceptiongroup_subset( if (tb) { int res = PyException_SetTraceback(eg, tb); Py_DECREF(tb); - if (res == -1) { + if (res < 0) { goto error; } } @@ -1052,7 +1052,7 @@ exceptiongroup_split_recursive(PyObject *exc, } if (exceptiongroup_split_recursive( e, matcher_type, matcher_value, - construct_rest, &rec_result) == -1) { + construct_rest, &rec_result) < 0) { assert(!rec_result.match); assert(!rec_result.rest); Py_LeaveRecursiveCall(); @@ -1061,7 +1061,7 @@ exceptiongroup_split_recursive(PyObject *exc, Py_LeaveRecursiveCall(); if (rec_result.match) { assert(PyList_CheckExact(match_list)); - if (PyList_Append(match_list, rec_result.match) == -1) { + if (PyList_Append(match_list, rec_result.match) < 0) { Py_DECREF(rec_result.match); goto done; } @@ -1070,7 +1070,7 @@ exceptiongroup_split_recursive(PyObject *exc, if (rec_result.rest) { assert(construct_rest); assert(PyList_CheckExact(rest_list)); - if (PyList_Append(rest_list, rec_result.rest) == -1) { + if (PyList_Append(rest_list, rec_result.rest) < 0) { Py_DECREF(rec_result.rest); goto done; } @@ -1079,13 +1079,13 @@ exceptiongroup_split_recursive(PyObject *exc, } /* construct result */ - if (exceptiongroup_subset(eg, match_list, &result->match) == -1) { + if (exceptiongroup_subset(eg, match_list, &result->match) < 0) { goto done; } if (construct_rest) { assert(PyList_CheckExact(rest_list)); - if (exceptiongroup_subset(eg, rest_list, &result->rest) == -1) { + if (exceptiongroup_subset(eg, rest_list, &result->rest) < 0) { Py_CLEAR(result->match); goto done; } @@ -1094,7 +1094,7 @@ exceptiongroup_split_recursive(PyObject *exc, done: Py_DECREF(match_list); Py_XDECREF(rest_list); - if (retval == -1) { + if (retval < 0) { Py_CLEAR(result->match); Py_CLEAR(result->rest); } @@ -1110,7 +1110,7 @@ BaseExceptionGroup_split(PyObject *self, PyObject *args) } _exceptiongroup_split_matcher_type matcher_type; - if (get_matcher_type(matcher_value, &matcher_type) == -1) { + if (get_matcher_type(matcher_value, &matcher_type) < 0) { return NULL; } @@ -1118,7 +1118,7 @@ BaseExceptionGroup_split(PyObject *self, PyObject *args) bool construct_rest = true; if (exceptiongroup_split_recursive( self, matcher_type, matcher_value, - construct_rest, &split_result) == -1) { + construct_rest, &split_result) < 0) { return NULL; } @@ -1141,7 +1141,7 @@ BaseExceptionGroup_subgroup(PyObject *self, PyObject *args) } _exceptiongroup_split_matcher_type matcher_type; - if (get_matcher_type(matcher_value, &matcher_type) == -1) { + if (get_matcher_type(matcher_value, &matcher_type) < 0) { return NULL; } @@ -1149,7 +1149,7 @@ BaseExceptionGroup_subgroup(PyObject *self, PyObject *args) bool construct_rest = false; if (exceptiongroup_split_recursive( self, matcher_type, matcher_value, - construct_rest, &split_result) == -1) { + construct_rest, &split_result) < 0) { return NULL; } @@ -1184,7 +1184,12 @@ collect_exception_group_leaves(PyObject *exc, PyObject *leaves) /* recursive calls */ for (Py_ssize_t i = 0; i < num_excs; i++) { PyObject *e = PyTuple_GET_ITEM(eg->excs, i); - if (collect_exception_group_leaves(e, leaves) == -1) { + if (Py_EnterRecursiveCall(" in collect_exception_group_leaves")) { + return -1; + } + int res = collect_exception_group_leaves(e, leaves); + Py_LeaveRecursiveCall(); + if (res < 0) { return -1; } } From 078f05028f55a4a46088aa05a1fdf9eb67e058d3 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Tue, 14 Dec 2021 11:36:01 +0000 Subject: [PATCH 37/37] whitespace Co-authored-by: Erlend Egeberg Aasland --- Python/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/compile.c b/Python/compile.c index 2ebb36ac1ded72..00e1e016969ad2 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3705,7 +3705,7 @@ compiler_try_star(struct compiler *c, stmt_ty s) } else { return compiler_try_star_except(c, s); - } + } } static int