#!/usr/bin/env python3.8
# @generated by pegen from C:\Users\hnakamura5\Projects\Typhon/src/Typhon/Grammar/typhon.gram

import ast
import sys
import tokenize

from typing import Any, Optional

from pegen.parser import memoize, memoize_left_rec, logger, Parser

import enum
import io
import itertools
import os
import token
from typing import (
    Callable,
    Iterator,
    List,
    Literal,
    NoReturn,
    Sequence,
    Tuple,
    TypeVar,
    Union,
)

from .typhon_ast import (
    assign_as_declaration,
    make_function_literal,
    make_arrow_type,
    make_with_stmt,
    declaration_as_withitem,
    make_for_stmt,
    make_function_def,
    make_comprehension,
    set_is_typing_expression,
    maybe_optional,
    set_is_coalescing,
    set_type_annotation,
    get_optional_question_node,
    get_force_unwrap_node,
    make_if_let,
    make_while_let,
    make_pipe_call,
    make_arrow_type_single_chain,
    if_comp_exp,
    make_genexp,
    make_listcomp,
    make_setcomp,
    make_dictcomp,
    make_with_comp,
    make_try_comp,
    make_try_comp_except,
    make_match_comp,
    make_match_comp_case,
    make_while_comp,
    make_if_let_comp,
    make_while_let_comp,
    make_let_comp,
    make_record_literal,
    make_record_type,
    make_attributes_pattern,
    make_tuple_pattern,
    make_for_let_pattern,
    make_with_let_pattern,
    make_inline_with_let_pattern,
)
from .parser_helper import Parser, Load, Store, Del, Target
from .tokenizer_custom import TokenizerCustom
from .token_factory_custom import token_stream_factory


def parse(
    filename: str,
    tokenizer: TokenizerCustom,
    mode: Union[Literal["eval"], Literal["exec"], Literal["file"]],
    py_version: Optional[tuple[int, int]] = None,
    verbose: bool = False,
) -> ast.AST | None:
    parser = TyphonParser(tokenizer, verbose=verbose, py_version=py_version)
    return parser.parse(mode)


# Keywords and soft keywords are listed at the end of the parser definition.
class TyphonParser(Parser):
    @memoize
    def start(self) -> Optional[Any]:
        # start: file
        mark = self._mark()
        if file := self.file():
            return file
        self._reset(mark)
        return None

    @memoize
    def file(self) -> Optional[ast.Module]:
        # file: statements? $
        mark = self._mark()
        if (a := self.statements(),) and (self.expect("ENDMARKER")):
            return ast.Module(body=a or [], type_ignores=[])
        self._reset(mark)
        return None

    @memoize
    def interactive(self) -> Optional[ast.Interactive]:
        # interactive: statement_newline
        mark = self._mark()
        if a := self.statement_newline():
            return ast.Interactive(body=a)
        self._reset(mark)
        return None

    @memoize
    def eval(self) -> Optional[ast.Expression]:
        # eval: expressions NEWLINE* $
        mark = self._mark()
        if (
            (a := self.expressions())
            and (self._loop0_1(),)
            and (self.expect("ENDMARKER"))
        ):
            return ast.Expression(body=a)
        self._reset(mark)
        return None

    @memoize
    def func_type(self) -> Optional[ast.FunctionType]:
        # func_type: '(' type_expressions? ')' typing_arrow_return_type NEWLINE* $
        mark = self._mark()
        if (
            (self.expect("("))
            and (a := self.type_expressions(),)
            and (self.expect(")"))
            and (b := self.typing_arrow_return_type())
            and (self._loop0_2(),)
            and (self.expect("ENDMARKER"))
        ):
            return ast.FunctionType(argtypes=a, returns=b)
        self._reset(mark)
        return None

    @memoize
    def fstring(self) -> Optional[ast.JoinedStr]:
        # fstring: FSTRING_START fstring_mid* FSTRING_END
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.fstring_start()) and (b := self._loop0_3(),) and (self.fstring_end()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.JoinedStr(
                values=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def DELIMITER(self) -> Optional[Any]:
        # DELIMITER: ';' | NEWLINE
        mark = self._mark()
        if literal := self.expect(";"):
            return literal
        self._reset(mark)
        if _newline := self.expect("NEWLINE"):
            return _newline
        self._reset(mark)
        return None

    @memoize
    def statements(self) -> Optional[List[ast.stmt]]:
        # statements: NEWLINE* statement*
        # nullable=True
        mark = self._mark()
        if (self._loop0_4(),) and (a := self._loop0_5(),):
            return sum(a, [])
        self._reset(mark)
        return None

    @memoize
    def statement(self) -> Optional[List[ast.stmt]]:
        # statement: expansive_stmt NEWLINE* | compound_stmt NEWLINE* DELIMITER? | simple_stmts NEWLINE*
        mark = self._mark()
        if (a := self.expansive_stmt()) and (self._loop0_6(),):
            return a
        self._reset(mark)
        if (a := self.compound_stmt()) and (self._loop0_7(),) and (self.DELIMITER(),):
            return [a]
        self._reset(mark)
        if (a := self.simple_stmts()) and (self._loop0_8(),):
            return a
        self._reset(mark)
        return None

    @memoize
    def statement_newline(self) -> Optional[List[ast.stmt]]:
        # statement_newline: compound_stmt NEWLINE | simple_stmts | NEWLINE | $
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.compound_stmt()) and (self.expect("NEWLINE")):
            return [a]
        self._reset(mark)
        if simple_stmts := self.simple_stmts():
            return simple_stmts
        self._reset(mark)
        if self.expect("NEWLINE"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                ast.Pass(
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if self.expect("ENDMARKER"):
            return None
        self._reset(mark)
        return None

    @memoize
    def simple_stmts(self) -> Optional[List[ast.stmt]]:
        # simple_stmts: DELIMITER.simple_stmt+ DELIMITER?
        mark = self._mark()
        if (a := self._gather_9()) and (self.DELIMITER(),):
            return a
        self._reset(mark)
        return None

    @memoize
    def simple_stmt(self) -> Optional[ast.stmt]:
        # simple_stmt: assignment | &"type" type_alias | star_expressions | &'return' return_stmt | &('import' | 'from') import_stmt | &'raise' raise_stmt | 'pass' | &'del' del_stmt | &'yield' yield_stmt | &'assert' assert_stmt | 'break' | 'continue' | &'global' global_stmt | &'nonlocal' nonlocal_stmt
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if assignment := self.assignment():
            return assignment
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "type")) and (
            type_alias := self.type_alias()
        ):
            return type_alias
        self._reset(mark)
        if e := self.star_expressions():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Expr(
                value=e,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "return")) and (
            return_stmt := self.return_stmt()
        ):
            return return_stmt
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_11,
            )
        ) and (import_stmt := self.import_stmt()):
            return import_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "raise")) and (
            raise_stmt := self.raise_stmt()
        ):
            return raise_stmt
        self._reset(mark)
        if self.expect("pass"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Pass(
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "del")) and (
            del_stmt := self.del_stmt()
        ):
            return del_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "yield")) and (
            yield_stmt := self.yield_stmt()
        ):
            return yield_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "assert")) and (
            assert_stmt := self.assert_stmt()
        ):
            return assert_stmt
        self._reset(mark)
        if self.expect("break"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Break(
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("continue"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Continue(
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "global")) and (
            global_stmt := self.global_stmt()
        ):
            return global_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "nonlocal")) and (
            nonlocal_stmt := self.nonlocal_stmt()
        ):
            return nonlocal_stmt
        self._reset(mark)
        return None

    @memoize
    def compound_stmt(self) -> Optional[Any]:
        # compound_stmt: &('let' | 'var') declaration_else | &('def' | '@' | 'async' | 'static') function_def | &'if' if_stmt | &('class' | '@') class_def | &('with' | 'async') with_stmt | &('for' | 'async') for_stmt | &'try' try_stmt | &'while' while_stmt | match_stmt
        mark = self._mark()
        if (
            self.positive_lookahead(
                self._tmp_12,
            )
        ) and (declaration_else := self.declaration_else()):
            return declaration_else
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_13,
            )
        ) and (function_def := self.function_def()):
            return function_def
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "if")) and (if_stmt := self.if_stmt()):
            return if_stmt
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_14,
            )
        ) and (class_def := self.class_def()):
            return class_def
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_15,
            )
        ) and (with_stmt := self.with_stmt()):
            return with_stmt
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_16,
            )
        ) and (for_stmt := self.for_stmt()):
            return for_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "try")) and (
            try_stmt := self.try_stmt()
        ):
            return try_stmt
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "while")) and (
            while_stmt := self.while_stmt()
        ):
            return while_stmt
        self._reset(mark)
        if match_stmt := self.match_stmt():
            return match_stmt
        self._reset(mark)
        return None

    @memoize
    def decl_keyword(self) -> Optional[Any]:
        # decl_keyword: 'var' | 'let'
        mark = self._mark()
        if literal := self.expect("var"):
            return literal
        self._reset(mark)
        if literal := self.expect("let"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def expansive_stmt(self) -> Optional[List[ast.stmt]]:
        # expansive_stmt: &decl_keyword declaration_assignment !'else' DELIMITER? | &('with' | 'async') inline_with_stmt
        mark = self._mark()
        if (
            (
                self.positive_lookahead(
                    self.decl_keyword,
                )
            )
            and (a := self.declaration_assignment())
            and (self.negative_lookahead(self.expect, "else"))
            and (self.DELIMITER(),)
        ):
            return a
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_17,
            )
        ) and (inline_with_stmt := self.inline_with_stmt()):
            return inline_with_stmt
        self._reset(mark)
        return None

    @memoize
    def simple_assignment(self) -> Optional[Any]:
        # simple_assignment: NAME ':' typing_expression ['=' annotated_rhs] | ('(' single_target ')' | single_subscript_attribute_target) ':' typing_expression ['=' annotated_rhs] | ((star_targets '='))+ (yield_expr | star_expressions) !'=' TYPE_COMMENT?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.name())
            and (self.expect(":"))
            and (b := self.typing_expression())
            and (c := self._tmp_18(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 6),
                "Variable annotation syntax is",
                ast.AnnAssign(
                    target=ast.Name(
                        id=a.string,
                        ctx=Store,
                        lineno=a.start[0],
                        col_offset=a.start[1],
                        end_lineno=a.end[0],
                        end_col_offset=a.end[1],
                    ),
                    annotation=b,
                    value=c,
                    simple=1,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if (
            (a := self._tmp_19())
            and (self.expect(":"))
            and (b := self.typing_expression())
            and (c := self._tmp_20(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 6),
                "Variable annotation syntax is",
                ast.AnnAssign(
                    target=a,
                    annotation=b,
                    value=c,
                    simple=0,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if (
            (a := self._loop1_21())
            and (b := self._tmp_22())
            and (self.negative_lookahead(self.expect, "="))
            and (tc := self.type_comment(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Assign(
                targets=a,
                value=b,
                type_comment=tc,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def assignment(self) -> Optional[ast.stmt]:
        # assignment: simple_assignment | single_target augassign ~ (yield_expr | star_expressions) | invalid_assignment
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if simple_assignment := self.simple_assignment():
            return simple_assignment
        self._reset(mark)
        cut = False
        if (
            (a := self.single_target())
            and (b := self.augassign())
            and (cut := True)
            and (c := self._tmp_23())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.AugAssign(
                target=a,
                op=b,
                value=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_assignment()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def annotated_rhs(self) -> Optional[Any]:
        # annotated_rhs: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def augassign(self) -> Optional[Any]:
        # augassign: '+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//='
        mark = self._mark()
        if self.expect("+="):
            return ast.Add()
        self._reset(mark)
        if self.expect("-="):
            return ast.Sub()
        self._reset(mark)
        if self.expect("*="):
            return ast.Mult()
        self._reset(mark)
        if self.expect("@="):
            return self.check_version((3, 5), "The '@' operator is", ast.MatMult())
        self._reset(mark)
        if self.expect("/="):
            return ast.Div()
        self._reset(mark)
        if self.expect("%="):
            return ast.Mod()
        self._reset(mark)
        if self.expect("&="):
            return ast.BitAnd()
        self._reset(mark)
        if self.expect("|="):
            return ast.BitOr()
        self._reset(mark)
        if self.expect("^="):
            return ast.BitXor()
        self._reset(mark)
        if self.expect("<<="):
            return ast.LShift()
        self._reset(mark)
        if self.expect(">>="):
            return ast.RShift()
        self._reset(mark)
        if self.expect("**="):
            return ast.Pow()
        self._reset(mark)
        if self.expect("//="):
            return ast.FloorDiv()
        self._reset(mark)
        return None

    @memoize
    def declaration_assignment(self) -> Optional[List[ast.stmt]]:
        # declaration_assignment: decl_keyword ','.declaration_single_assignment+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (d := self.decl_keyword()) and (a := self._gather_24()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return list(
                map(
                    lambda a1: assign_as_declaration(
                        d.string,
                        a1,
                        len(a) > 1,
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    ),
                    a,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def declaration_else(self) -> Optional[Any]:
        # declaration_else: decl_keyword ','.pattern_assignment+ ['else' block]
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (d := self.decl_keyword())
            and (pat_sub := self._gather_26())
            and (e := self._tmp_28(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let(
                decl_type=d.string,
                pattern_subjects=pat_sub,
                cond=None,
                body=[],
                orelse=e,
                is_let_else=True,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def declaration_single_assignment(
        self,
    ) -> Optional[Tuple[ast.expr, Optional[ast.expr], Optional[ast.expr]]]:
        # declaration_single_assignment: decl_star_target annotation ['=' annotated_rhs] | decl_star_target '=' annotated_rhs
        mark = self._mark()
        if (
            (a := self.decl_star_target())
            and (b := self.annotation())
            and (c := self._tmp_29(),)
        ):
            return (a, b, c)
        self._reset(mark)
        if (
            (a := self.decl_star_target())
            and (self.expect("="))
            and (c := self.annotated_rhs())
        ):
            return (a, None, c)
        self._reset(mark)
        return None

    @memoize
    def pattern_assignment(self) -> Optional[Tuple[ast.pattern, ast.expr]]:
        # pattern_assignment: pattern '=' star_named_expression
        mark = self._mark()
        if (
            (pattern := self.pattern())
            and (self.expect("="))
            and (subject := self.star_named_expression())
        ):
            return (pattern, subject)
        self._reset(mark)
        return None

    @memoize
    def return_stmt(self) -> Optional[ast.Return]:
        # return_stmt: 'return' star_expressions?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("return")) and (a := self.star_expressions(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Return(
                value=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def raise_stmt(self) -> Optional[ast.Raise]:
        # raise_stmt: 'raise' expression ['from' expression] | 'raise'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("raise"))
            and (a := self.expression())
            and (b := self._tmp_30(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Raise(
                exc=a,
                cause=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("raise"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Raise(
                exc=None,
                cause=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def global_stmt(self) -> Optional[ast.Global]:
        # global_stmt: 'global' ','.NAME+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("global")) and (a := self._gather_31()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Global(
                names=[n.string for n in a],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def nonlocal_stmt(self) -> Optional[ast.Nonlocal]:
        # nonlocal_stmt: 'nonlocal' ','.NAME+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("nonlocal")) and (a := self._gather_33()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Nonlocal(
                names=[n.string for n in a],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def del_stmt(self) -> Optional[ast.Delete]:
        # del_stmt: 'del' del_targets &(';' | NEWLINE) | invalid_del_stmt
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("del"))
            and (a := self.del_targets())
            and (
                self.positive_lookahead(
                    self._tmp_35,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Delete(
                targets=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_del_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def yield_stmt(self) -> Optional[ast.Expr]:
        # yield_stmt: yield_expr
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if y := self.yield_expr():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Expr(
                value=y,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def assert_stmt(self) -> Optional[ast.Assert]:
        # assert_stmt: 'assert' expression [',' expression]
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("assert"))
            and (a := self.expression())
            and (b := self._tmp_36(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Assert(
                test=a,
                msg=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def import_stmt(self) -> Optional[ast.Import]:
        # import_stmt: invalid_import | import_name | import_from
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_import()):
            return None  # pragma: no cover;
        self._reset(mark)
        if import_name := self.import_name():
            return import_name
        self._reset(mark)
        if import_from := self.import_from():
            return import_from
        self._reset(mark)
        return None

    @memoize
    def import_name(self) -> Optional[ast.Import]:
        # import_name: 'import' dotted_as_names
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("import")) and (a := self.dotted_as_names()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Import(
                names=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def import_from(self) -> Optional[ast.ImportFrom]:
        # import_from: 'from' (('.' | '...'))* dotted_name 'import' import_from_targets | 'from' (('.' | '...'))+ 'import' import_from_targets
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("from"))
            and (a := self._loop0_37(),)
            and (b := self.dotted_name())
            and (self.expect("import"))
            and (c := self.import_from_targets())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.ImportFrom(
                module=b,
                names=c,
                level=self.extract_import_level(a),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("from"))
            and (a := self._loop1_38())
            and (self.expect("import"))
            and (b := self.import_from_targets())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.ImportFrom(
                    names=b,
                    level=self.extract_import_level(a),
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.ImportFrom(
                    module=None,
                    names=b,
                    level=self.extract_import_level(a),
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def import_from_targets(self) -> Optional[List[ast.alias]]:
        # import_from_targets: '(' import_from_as_names ','? ')' | import_from_as_names !',' | '*' | invalid_import_from_targets
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("("))
            and (a := self.import_from_as_names())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            return a
        self._reset(mark)
        if (import_from_as_names := self.import_from_as_names()) and (
            self.negative_lookahead(self.expect, ",")
        ):
            return import_from_as_names
        self._reset(mark)
        if self.expect("*"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                ast.alias(
                    name="*",
                    asname=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_import_from_targets()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def import_from_as_names(self) -> Optional[List[ast.alias]]:
        # import_from_as_names: ','.import_from_as_name+
        mark = self._mark()
        if a := self._gather_39():
            return a
        self._reset(mark)
        return None

    @memoize
    def import_from_as_name(self) -> Optional[ast.alias]:
        # import_from_as_name: NAME ['as' NAME]
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self._tmp_41(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.alias(
                name=a.string,
                asname=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def dotted_as_names(self) -> Optional[List[ast.alias]]:
        # dotted_as_names: ','.dotted_as_name+
        mark = self._mark()
        if a := self._gather_42():
            return a
        self._reset(mark)
        return None

    @memoize
    def dotted_as_name(self) -> Optional[ast.alias]:
        # dotted_as_name: dotted_name ['as' NAME]
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.dotted_name()) and (b := self._tmp_44(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.alias(
                name=a,
                asname=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize_left_rec
    def dotted_name(self) -> Optional[str]:
        # dotted_name: dotted_name '.' NAME | NAME
        mark = self._mark()
        if (a := self.dotted_name()) and (self.expect(".")) and (b := self.name()):
            return a + "." + b.string
        self._reset(mark)
        if a := self.name():
            return a.string
        self._reset(mark)
        return None

    @memoize
    def block(self) -> Optional[List[ast.stmt]]:
        # block: '{' statements* '}' | invalid_block
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("{")) and (a := self._loop0_45(),) and (self.expect("}")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                sum(a, [])
                if len(a) > 0
                else [
                    ast.Pass(
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    )
                ]
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_block()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def decorators(self) -> Optional[Any]:
        # decorators: decorator+
        mark = self._mark()
        if _loop1_46 := self._loop1_46():
            return _loop1_46
        self._reset(mark)
        return None

    @memoize
    def decorator(self) -> Optional[Any]:
        # decorator: ('@' dec_maybe_call NEWLINE) | ('@' named_expression NEWLINE)
        mark = self._mark()
        if a := self._tmp_47():
            return a
        self._reset(mark)
        if a := self._tmp_48():
            return self.check_version((3, 9), "Generic decorator are", a)
        self._reset(mark)
        return None

    @memoize
    def dec_maybe_call(self) -> Optional[Any]:
        # dec_maybe_call: dec_primary ('(' | '?(') arguments? ')' | dec_primary
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (dn := self.dec_primary())
            and (o := self._tmp_49())
            and (z := self.arguments(),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Call(
                    func=dn,
                    args=z[0] if z else [],
                    keywords=z[1] if z else [],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        if dec_primary := self.dec_primary():
            return dec_primary
        self._reset(mark)
        return None

    @memoize_left_rec
    def dec_primary(self) -> Optional[Any]:
        # dec_primary: dec_primary ('.' | '?.') NAME | NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.dec_primary()) and (self._tmp_50()) and (b := self.name()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Attribute(
                    value=a,
                    attr=b.string,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        if a := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=a.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def class_def(self) -> Optional[ast.ClassDef]:
        # class_def: decorators class_def_raw | class_def_raw
        mark = self._mark()
        if (a := self.decorators()) and (b := self.class_def_raw()):
            return self.set_decorators(b, a)
        self._reset(mark)
        if class_def_raw := self.class_def_raw():
            return class_def_raw
        self._reset(mark)
        return None

    @memoize
    def class_def_raw(self) -> Optional[ast.ClassDef]:
        # class_def_raw: invalid_class_def_raw | 'class' NAME type_params? ['(' arguments? ')'] NEWLINE* block
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_class_def_raw()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("class"))
            and (a := self.name())
            and (t := self.type_params(),)
            and (b := self._tmp_51(),)
            and (self._loop0_52(),)
            and (c := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.ClassDef(
                    a.string,
                    bases=b[0] if b else [],
                    keywords=b[1] if b else [],
                    body=c,
                    decorator_list=[],
                    type_params=t or [],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 12)
                else ast.ClassDef(
                    a.string,
                    bases=b[0] if b else [],
                    keywords=b[1] if b else [],
                    body=c,
                    decorator_list=[],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def function_def(self) -> Optional[Union[ast.FunctionDef, ast.AsyncFunctionDef]]:
        # function_def: decorators function_def_raw | function_def_raw
        mark = self._mark()
        if (d := self.decorators()) and (f := self.function_def_raw()):
            return self.set_decorators(f, d)
        self._reset(mark)
        if f := self.function_def_raw():
            return self.set_decorators(f, [])
        self._reset(mark)
        return None

    @memoize
    def function_def_raw(
        self,
    ) -> Optional[Union[ast.FunctionDef, ast.AsyncFunctionDef]]:
        # function_def_raw: invalid_def_raw | 'static'? 'async'? 'def' NAME type_params? &&'(' params? ')' typing_arrow_return_type? func_type_comment? NEWLINE* block
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_def_raw()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (st := self.expect("static"),)
            and (asc := self.expect("async"),)
            and (self.expect("def"))
            and (n := self.name())
            and (t := self.type_params(),)
            and (self.expect_forced(self.expect("("), "'('"))
            and (params := self.params(),)
            and (self.expect(")"))
            and (a := self.typing_arrow_return_type(),)
            and (tc := self.func_type_comment(),)
            and (self._loop0_53(),)
            and (b := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_function_def(
                is_async=(asc is not None),
                is_static=(st is not None),
                name=n.string,
                args=params or self.make_arguments(None, [], None, [], None),
                returns=a,
                body=b,
                type_comment=tc,
                type_params=t or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def params(self) -> Optional[Any]:
        # params: invalid_parameters | parameters
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_parameters()):
            return None  # pragma: no cover;
        self._reset(mark)
        if parameters := self.parameters():
            return parameters
        self._reset(mark)
        return None

    @memoize
    def parameters(self) -> Optional[ast.arguments]:
        # parameters: slash_no_default param_no_default* param_with_default* star_etc? | slash_with_default param_with_default* star_etc? | param_no_default+ param_with_default* star_etc? | param_with_default+ star_etc? | star_etc
        mark = self._mark()
        if (
            (a := self.slash_no_default())
            and (b := self._loop0_54(),)
            and (c := self._loop0_55(),)
            and (d := self.star_etc(),)
        ):
            return self.check_version(
                (3, 8),
                "Positional only arguments are",
                self.make_arguments(a, [], b, c, d),
            )
        self._reset(mark)
        if (
            (a := self.slash_with_default())
            and (b := self._loop0_56(),)
            and (c := self.star_etc(),)
        ):
            return self.check_version(
                (3, 8),
                "Positional only arguments are",
                self.make_arguments(None, a, None, b, c),
            )
        self._reset(mark)
        if (
            (a := self._loop1_57())
            and (b := self._loop0_58(),)
            and (c := self.star_etc(),)
        ):
            return self.make_arguments(None, [], a, b, c)
        self._reset(mark)
        if (a := self._loop1_59()) and (b := self.star_etc(),):
            return self.make_arguments(None, [], None, a, b)
        self._reset(mark)
        if a := self.star_etc():
            return self.make_arguments(None, [], None, None, a)
        self._reset(mark)
        return None

    @memoize
    def slash_no_default(self) -> Optional[List[Tuple[ast.arg, None]]]:
        # slash_no_default: param_no_default+ '/' ',' | param_no_default+ '/' &')'
        mark = self._mark()
        if (a := self._loop1_60()) and (self.expect("/")) and (self.expect(",")):
            return [(p, None) for p in a]
        self._reset(mark)
        if (
            (a := self._loop1_61())
            and (self.expect("/"))
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return [(p, None) for p in a]
        self._reset(mark)
        return None

    @memoize
    def slash_with_default(self) -> Optional[List[Tuple[ast.arg, Any]]]:
        # slash_with_default: param_no_default* param_with_default+ '/' ',' | param_no_default* param_with_default+ '/' &')'
        mark = self._mark()
        if (
            (a := self._loop0_62(),)
            and (b := self._loop1_63())
            and (self.expect("/"))
            and (self.expect(","))
        ):
            return ([(p, None) for p in a] if a else []) + b
        self._reset(mark)
        if (
            (a := self._loop0_64(),)
            and (b := self._loop1_65())
            and (self.expect("/"))
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return ([(p, None) for p in a] if a else []) + b
        self._reset(mark)
        return None

    @memoize
    def star_etc(
        self,
    ) -> Optional[
        Tuple[Optional[ast.arg], List[Tuple[ast.arg, Any]], Optional[ast.arg]]
    ]:
        # star_etc: invalid_star_etc | '*' param_no_default param_maybe_default* kwds? | '*' param_no_default_star_annotation param_maybe_default* kwds? | '*' ',' param_maybe_default+ kwds? | kwds
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_star_etc()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("*"))
            and (a := self.param_no_default())
            and (b := self._loop0_66(),)
            and (c := self.kwds(),)
        ):
            return (a, b, c)
        self._reset(mark)
        if (
            (self.expect("*"))
            and (a := self.param_no_default_star_annotation())
            and (b := self._loop0_67(),)
            and (c := self.kwds(),)
        ):
            return (a, b, c)
        self._reset(mark)
        if (
            (self.expect("*"))
            and (self.expect(","))
            and (b := self._loop1_68())
            and (c := self.kwds(),)
        ):
            return (None, b, c)
        self._reset(mark)
        if a := self.kwds():
            return (None, [], a)
        self._reset(mark)
        return None

    @memoize
    def kwds(self) -> Optional[ast.arg]:
        # kwds: invalid_kwds | '**' param_no_default
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_kwds()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.expect("**")) and (a := self.param_no_default()):
            return a
        self._reset(mark)
        return None

    @memoize
    def param_no_default(self) -> Optional[ast.arg]:
        # param_no_default: param ',' TYPE_COMMENT? | param TYPE_COMMENT? &')'
        mark = self._mark()
        if (a := self.param()) and (self.expect(",")) and (tc := self.type_comment(),):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        if (
            (a := self.param())
            and (tc := self.type_comment(),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        return None

    @memoize
    def param_no_default_star_annotation(self) -> Optional[ast.arg]:
        # param_no_default_star_annotation: param_star_annotation ',' TYPE_COMMENT? | param_star_annotation TYPE_COMMENT? &')'
        mark = self._mark()
        if (
            (a := self.param_star_annotation())
            and (self.expect(","))
            and (tc := self.type_comment(),)
        ):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        if (
            (a := self.param_star_annotation())
            and (tc := self.type_comment(),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        return None

    @memoize
    def param_with_default(self) -> Optional[Tuple[ast.arg, Any]]:
        # param_with_default: param default ',' TYPE_COMMENT? | param default TYPE_COMMENT? &')'
        mark = self._mark()
        if (
            (a := self.param())
            and (c := self.default())
            and (self.expect(","))
            and (tc := self.type_comment(),)
        ):
            return (self.set_arg_type_comment(a, tc), c)
        self._reset(mark)
        if (
            (a := self.param())
            and (c := self.default())
            and (tc := self.type_comment(),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return (self.set_arg_type_comment(a, tc), c)
        self._reset(mark)
        return None

    @memoize
    def param_maybe_default(self) -> Optional[Tuple[ast.arg, Any]]:
        # param_maybe_default: param default? ',' TYPE_COMMENT? | param default? TYPE_COMMENT? &')'
        mark = self._mark()
        if (
            (a := self.param())
            and (c := self.default(),)
            and (self.expect(","))
            and (tc := self.type_comment(),)
        ):
            return (self.set_arg_type_comment(a, tc), c)
        self._reset(mark)
        if (
            (a := self.param())
            and (c := self.default(),)
            and (tc := self.type_comment(),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return (self.set_arg_type_comment(a, tc), c)
        self._reset(mark)
        return None

    @memoize
    def param(self) -> Optional[Any]:
        # param: NAME annotation?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.annotation(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.arg(
                arg=a.string,
                annotation=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def param_star_annotation(self) -> Optional[Any]:
        # param_star_annotation: NAME star_annotation
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.star_annotation()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.arg(
                arg=a.string,
                annotations=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def annotation(self) -> Optional[Any]:
        # annotation: ':' typing_expression
        mark = self._mark()
        if (self.expect(":")) and (a := self.typing_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def star_annotation(self) -> Optional[Any]:
        # star_annotation: ':' typing_star_expression
        mark = self._mark()
        if (self.expect(":")) and (a := self.typing_star_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def default(self) -> Optional[Any]:
        # default: '=' expression | invalid_default
        mark = self._mark()
        if (self.expect("=")) and (a := self.expression()):
            return a
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_default()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def if_stmt(self) -> Optional[ast.stmt]:
        # if_stmt: invalid_if_stmt | 'if' '(' named_expression ')' NEWLINE* block elif_stmt | 'if' '(' named_expression ')' NEWLINE* block else_block? | 'if' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* block elif_stmt | 'if' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* block else_block?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_if_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_69(),)
            and (b := self.block())
            and (c := self.elif_stmt())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.If(
                test=a,
                body=b,
                orelse=c or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_70(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.If(
                test=a,
                body=b,
                orelse=c or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_71())
            and (cond := self._tmp_73(),)
            and (self.expect(")"))
            and (self._loop0_74(),)
            and (b := self.block())
            and (c := self.elif_stmt())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let(
                decl_type="let",
                pattern_subjects=pat_sub,
                cond=cond,
                body=b,
                orelse=c,
                is_let_else=False,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_75())
            and (cond := self._tmp_77(),)
            and (self.expect(")"))
            and (self._loop0_78(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let(
                decl_type="let",
                pattern_subjects=pat_sub,
                cond=cond,
                body=b,
                orelse=c,
                is_let_else=False,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def elif_stmt(self) -> Optional[List[ast.stmt]]:
        # elif_stmt: invalid_elif_stmt | 'elif' '(' named_expression ')' NEWLINE* block elif_stmt | 'elif' '(' named_expression ')' NEWLINE* block else_block? | 'elif' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* block elif_stmt | 'elif' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* block else_block?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_elif_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_79(),)
            and (b := self.block())
            and (c := self.elif_stmt())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                ast.If(
                    test=a,
                    body=b,
                    orelse=c or [],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_80(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                ast.If(
                    test=a,
                    body=b,
                    orelse=c or [],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_81())
            and (cond := self._tmp_83(),)
            and (self.expect(")"))
            and (self._loop0_84(),)
            and (b := self.block())
            and (c := self.elif_stmt())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                make_if_let(
                    decl_type="let",
                    pattern_subjects=pat_sub,
                    cond=cond,
                    body=b,
                    orelse=c or [],
                    is_let_else=False,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_85())
            and (cond := self._tmp_87(),)
            and (self.expect(")"))
            and (self._loop0_88(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                make_if_let(
                    decl_type="let",
                    pattern_subjects=pat_sub,
                    cond=cond,
                    body=b,
                    orelse=c or [],
                    is_let_else=False,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        return None

    @memoize
    def else_block(self) -> Optional[List[ast.stmt]]:
        # else_block: invalid_else_stmt | 'else' block
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_else_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.expect("else")) and (b := self.block()):
            return b
        self._reset(mark)
        return None

    @memoize
    def while_stmt(self) -> Optional[ast.While]:
        # while_stmt: invalid_while_stmt | 'while' '(' named_expression ')' NEWLINE* block else_block? | 'while' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* block else_block?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_while_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_89(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.While(
                test=a,
                body=b,
                orelse=c or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_90())
            and (cond := self._tmp_92(),)
            and (self.expect(")"))
            and (self._loop0_93(),)
            and (b := self.block())
            and (c := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_while_let(
                pattern_subjects=pat_sub,
                cond=cond,
                body=b,
                orelse=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def for_stmt(self) -> Optional[Union[ast.For, ast.AsyncFor]]:
        # for_stmt: invalid_for_stmt | 'async'? 'for' '(' decl_keyword decl_star_target star_annotation? 'in' ~ star_expressions ')' TYPE_COMMENT? NEWLINE* block else_block? | 'async'? 'for' '(' decl_keyword pattern 'in' ~ star_expressions ')' TYPE_COMMENT? NEWLINE* block else_block? | invalid_for_target
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_for_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        cut = False
        if (
            (is_async := self.expect("async"),)
            and (self.expect("for"))
            and (self.expect("("))
            and (d := self.decl_keyword())
            and (t := self.decl_star_target())
            and (a := self.star_annotation(),)
            and (self.expect("in"))
            and (cut := True)
            and (ex := self.star_expressions())
            and (self.expect(")"))
            and (tc := self.type_comment(),)
            and (self._loop0_94(),)
            and (b := self.block())
            and (el := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_for_stmt(
                decl_type=d.string,
                target=t,
                type_annotation=a,
                iter=ex,
                body=b,
                orelse=el or [],
                type_comment=tc,
                is_async=is_async is not None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        cut = False
        if (
            (is_async := self.expect("async"),)
            and (self.expect("for"))
            and (self.expect("("))
            and (d := self.decl_keyword())
            and (pat := self.pattern())
            and (self.expect("in"))
            and (cut := True)
            and (ex := self.star_expressions())
            and (self.expect(")"))
            and (tc := self.type_comment(),)
            and (self._loop0_95(),)
            and (b := self.block())
            and (el := self.else_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_for_let_pattern(
                decl_type=d.string,
                pattern=pat,
                iter=ex,
                body=b,
                orelse=el or [],
                type_comment=tc,
                is_async=is_async is not None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_for_target()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def with_stmt(self) -> Optional[Union[ast.With, ast.AsyncWith]]:
        # with_stmt: block_with | invalid_with_stmt
        mark = self._mark()
        if block_with := self.block_with():
            return block_with
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_with_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def block_with(self) -> Optional[Union[ast.With, ast.AsyncWith]]:
        # block_with: 'async'? 'with' '(' with_item ')' NEWLINE* block | 'async'? 'with' '(' with_pattern_item ')' NEWLINE* block
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (is_async := self.expect("async"),)
            and (self.expect("with"))
            and (self.expect("("))
            and (a := self.with_item())
            and (self.expect(")"))
            and (self._loop0_96(),)
            and (b := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_with_stmt(
                is_async=is_async is not None,
                items=a,
                body=b,
                is_inline=False,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (is_async := self.expect("async"),)
            and (self.expect("with"))
            and (self.expect("("))
            and (a := self.with_pattern_item())
            and (self.expect(")"))
            and (self._loop0_97(),)
            and (b := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_with_let_pattern(
                is_async=is_async is not None,
                decl_type=a[0],
                pattern_subjects=a[1],
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def inline_with_stmt(self) -> Optional[List[ast.stmt]]:
        # inline_with_stmt: 'async'? 'with' with_item DELIMITER | 'async'? 'with' with_pattern_item DELIMITER
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (is_async := self.expect("async"),)
            and (self.expect("with"))
            and (a := self.with_item())
            and (self.DELIMITER())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return [
                make_with_stmt(
                    is_async=is_async is not None,
                    items=a,
                    body=[],
                    is_inline=True,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            ]
        self._reset(mark)
        if (
            (is_async := self.expect("async"),)
            and (self.expect("with"))
            and (a := self.with_pattern_item())
            and (self.DELIMITER())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_inline_with_let_pattern(
                is_async=is_async is not None,
                decl_type=a[0],
                pattern_subjects=a[1],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def with_item(self) -> Optional[List[ast.withitem]]:
        # with_item: declaration_assignment &(',' | ')' | DELIMITER) | invalid_with_item | ','.expression+ ','?
        mark = self._mark()
        if (a := self.declaration_assignment()) and (
            self.positive_lookahead(
                self._tmp_98,
            )
        ):
            return list(map(declaration_as_withitem, a))
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_with_item()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (exprs := self._gather_99()) and (self.expect(","),):
            return list(
                map(lambda e: ast.withitem(context_expr=e, optional_vars=None), exprs)
            )
        self._reset(mark)
        return None

    @memoize
    def with_pattern_item(
        self,
    ) -> Optional[Tuple[str, List[Tuple[ast.pattern, ast.expr]]]]:
        # with_pattern_item: decl_keyword ','.pattern_assignment+ &(',' | ')' | DELIMITER)
        mark = self._mark()
        if (
            (d := self.decl_keyword())
            and (pat_sub := self._gather_101())
            and (
                self.positive_lookahead(
                    self._tmp_103,
                )
            )
        ):
            return (d.string, pat_sub)
        self._reset(mark)
        return None

    @memoize
    def try_stmt(self) -> Optional[ast.Try]:
        # try_stmt: invalid_try_stmt | 'try' block finally_block | 'try' block except_block+ else_block? finally_block? | 'try' block except_star_block+ else_block? finally_block?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_try_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.expect("try")) and (b := self.block()) and (f := self.finally_block()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Try(
                body=b,
                handlers=[],
                orelse=[],
                finalbody=f,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("try"))
            and (b := self.block())
            and (ex := self._loop1_104())
            and (el := self.else_block(),)
            and (f := self.finally_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Try(
                body=b,
                handlers=ex,
                orelse=el or [],
                finalbody=f or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("try"))
            and (b := self.block())
            and (ex := self._loop1_105())
            and (el := self.else_block(),)
            and (f := self.finally_block(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 11),
                "Exception groups are",
                (
                    ast.TryStar(
                        body=b,
                        handlers=ex,
                        orelse=el or [],
                        finalbody=f or [],
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    )
                    if sys.version_info >= (3, 11)
                    else None
                ),
            )
        self._reset(mark)
        return None

    @memoize
    def except_block(self) -> Optional[ast.ExceptHandler]:
        # except_block: 'except' '(' expression ['as' NAME] ')' NEWLINE* block | 'except' block | invalid_except_stmt
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("except"))
            and (self.expect("("))
            and (e := self.expression())
            and (t := self._tmp_106(),)
            and (self.expect(")"))
            and (self._loop0_107(),)
            and (b := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.ExceptHandler(
                type=e,
                name=t,
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("except")) and (b := self.block()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.ExceptHandler(
                type=None,
                name=None,
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_except_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def except_star_block(self) -> Optional[ast.ExceptHandler]:
        # except_star_block: 'except' '*' '(' expression ['as' NAME] ')' NEWLINE* block | invalid_except_stmt
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("except"))
            and (self.expect("*"))
            and (self.expect("("))
            and (e := self.expression())
            and (t := self._tmp_108(),)
            and (self.expect(")"))
            and (self._loop0_109(),)
            and (b := self.block())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.ExceptHandler(
                type=e,
                name=t,
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_except_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def finally_block(self) -> Optional[List[ast.stmt]]:
        # finally_block: invalid_finally_stmt | 'finally' block
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_finally_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.expect("finally")) and (a := self.block()):
            return a
        self._reset(mark)
        return None

    @memoize
    def match_stmt(self) -> Optional["ast.Match"]:
        # match_stmt: "match" '(' subject_expr ')' NEWLINE* '{' case_block+ '}' | invalid_match_stmt
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("match"))
            and (self.expect("("))
            and (subject := self.subject_expr())
            and (self.expect(")"))
            and (self._loop0_110(),)
            and (self.expect("{"))
            and (cases := self._loop1_111())
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Match(
                subject=subject,
                cases=cases,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_match_stmt()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def subject_expr(self) -> Optional[Any]:
        # subject_expr: star_named_expression ',' star_named_expressions? | named_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (value := self.star_named_expression())
            and (self.expect(","))
            and (values := self.star_named_expressions(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 10),
                "Pattern matching is",
                ast.Tuple(
                    elts=[value] + (values or []),
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if e := self.named_expression():
            return self.check_version((3, 10), "Pattern matching is", e)
        self._reset(mark)
        return None

    @memoize
    def case_block(self) -> Optional["ast.match_case"]:
        # case_block: invalid_case_block | "case" '(' patterns ')' NEWLINE* guard? NEWLINE* block
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_case_block()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("case"))
            and (self.expect("("))
            and (pattern := self.patterns())
            and (self.expect(")"))
            and (self._loop0_112(),)
            and (guard := self.guard(),)
            and (self._loop0_113(),)
            and (body := self.block())
        ):
            return ast.match_case(pattern=pattern, guard=guard, body=body)
        self._reset(mark)
        return None

    @memoize
    def guard(self) -> Optional[Any]:
        # guard: 'if' '(' named_expression ')'
        mark = self._mark()
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (guard := self.named_expression())
            and (self.expect(")"))
        ):
            return guard
        self._reset(mark)
        return None

    @memoize
    def patterns(self) -> Optional[Any]:
        # patterns: open_sequence_pattern | pattern
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if patterns := self.open_sequence_pattern():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_tuple_pattern(
                patterns=patterns,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if pattern := self.pattern():
            return pattern
        self._reset(mark)
        return None

    @memoize
    def pattern(self) -> Optional[Any]:
        # pattern: as_pattern | or_pattern
        mark = self._mark()
        if as_pattern := self.as_pattern():
            return as_pattern
        self._reset(mark)
        if or_pattern := self.or_pattern():
            return or_pattern
        self._reset(mark)
        return None

    @memoize
    def as_pattern(self) -> Optional["ast.MatchAs"]:
        # as_pattern: or_pattern 'as' pattern_capture_target_annot | invalid_as_pattern
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (pattern := self.or_pattern())
            and (self.expect("as"))
            and (target := self.pattern_capture_target_annot())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.MatchAs(
                    pattern=pattern,
                    name=target[0],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                target[1],
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_as_pattern()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def or_pattern(self) -> Optional["ast.MatchOr"]:
        # or_pattern: '|'.closed_pattern+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if patterns := self._gather_114():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.MatchOr(
                    patterns=patterns,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if len(patterns) > 1
                else patterns[0]
            )
        self._reset(mark)
        return None

    @memoize
    def closed_pattern(self) -> Optional[Any]:
        # closed_pattern: literal_pattern | capture_pattern | wildcard_pattern | value_pattern | group_pattern | sequence_pattern | mapping_pattern | class_pattern | attributes_pattern
        mark = self._mark()
        if literal_pattern := self.literal_pattern():
            return literal_pattern
        self._reset(mark)
        if capture_pattern := self.capture_pattern():
            return capture_pattern
        self._reset(mark)
        if wildcard_pattern := self.wildcard_pattern():
            return wildcard_pattern
        self._reset(mark)
        if value_pattern := self.value_pattern():
            return value_pattern
        self._reset(mark)
        if group_pattern := self.group_pattern():
            return group_pattern
        self._reset(mark)
        if sequence_pattern := self.sequence_pattern():
            return sequence_pattern
        self._reset(mark)
        if mapping_pattern := self.mapping_pattern():
            return mapping_pattern
        self._reset(mark)
        if class_pattern := self.class_pattern():
            return class_pattern
        self._reset(mark)
        if attributes_pattern := self.attributes_pattern():
            return attributes_pattern
        self._reset(mark)
        return None

    @memoize
    def literal_pattern(self) -> Optional[Any]:
        # literal_pattern: signed_number !('+' | '-') | complex_number | strings | 'None' | 'True' | 'False'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (value := self.signed_number()) and (
            self.negative_lookahead(
                self._tmp_116,
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchValue(
                value=value,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if value := self.complex_number():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchValue(
                value=value,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if value := self.strings():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchValue(
                value=value,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("None"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchSingleton(
                value=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("True"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchSingleton(
                value=True,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("False"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchSingleton(
                value=False,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def literal_expr(self) -> Optional[Any]:
        # literal_expr: signed_number !('+' | '-') | complex_number | strings | 'None' | 'True' | 'False'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (signed_number := self.signed_number()) and (
            self.negative_lookahead(
                self._tmp_117,
            )
        ):
            return signed_number
        self._reset(mark)
        if complex_number := self.complex_number():
            return complex_number
        self._reset(mark)
        if strings := self.strings():
            return strings
        self._reset(mark)
        if self.expect("None"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("True"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=True,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("False"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=False,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def complex_number(self) -> Optional[Any]:
        # complex_number: signed_real_number '+' imaginary_number | signed_real_number '-' imaginary_number
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (real := self.signed_real_number())
            and (self.expect("+"))
            and (imag := self.imaginary_number())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=real,
                op=ast.Add(),
                right=imag,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (real := self.signed_real_number())
            and (self.expect("-"))
            and (imag := self.imaginary_number())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=real,
                op=ast.Sub(),
                right=imag,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def signed_number(self) -> Optional[Any]:
        # signed_number: NUMBER | '-' NUMBER
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if a := self.number():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=ast.literal_eval(a.string),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("-")) and (a := self.number()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.USub(),
                operand=ast.Constant(
                    value=ast.literal_eval(a.string),
                    lineno=a.start[0],
                    col_offset=a.start[1],
                    end_lineno=a.end[0],
                    end_col_offset=a.end[1],
                ),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def signed_real_number(self) -> Optional[Any]:
        # signed_real_number: real_number | '-' real_number
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if real_number := self.real_number():
            return real_number
        self._reset(mark)
        if (self.expect("-")) and (real := self.real_number()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.USub(),
                operand=real,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def real_number(self) -> Optional[ast.Constant]:
        # real_number: NUMBER
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if real := self.number():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=self.ensure_real(real),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def imaginary_number(self) -> Optional[ast.Constant]:
        # imaginary_number: NUMBER
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if imag := self.number():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=self.ensure_imaginary(imag),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def capture_pattern(self) -> Optional[Any]:
        # capture_pattern: pattern_capture_target_annot
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if target := self.pattern_capture_target_annot():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.MatchAs(
                    pattern=None,
                    name=target[0],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                target[1],
            )
        self._reset(mark)
        return None

    @memoize
    def pattern_capture_target(self) -> Optional[str]:
        # pattern_capture_target: !"_" NAME !('.' | '(')
        mark = self._mark()
        if (
            (self.negative_lookahead(self.expect, "_"))
            and (name := self.name())
            and (
                self.negative_lookahead(
                    self._tmp_118,
                )
            )
        ):
            return name.string
        self._reset(mark)
        return None

    @memoize
    def pattern_capture_target_annot(self) -> Optional[tuple[str, ast.expr | None]]:
        # pattern_capture_target_annot: !"_" NAME annotation? !('.' | '(')
        mark = self._mark()
        if (
            (self.negative_lookahead(self.expect, "_"))
            and (name := self.name())
            and (a := self.annotation(),)
            and (
                self.negative_lookahead(
                    self._tmp_119,
                )
            )
        ):
            return (name.string, a)
        self._reset(mark)
        return None

    @memoize
    def wildcard_pattern(self) -> Optional["ast.MatchAs"]:
        # wildcard_pattern: "_"
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.expect("_"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchAs(
                pattern=None,
                name=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def value_pattern(self) -> Optional["ast.MatchValue"]:
        # value_pattern: attr !('.' | '(')
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (attr := self.attr()) and (
            self.negative_lookahead(
                self._tmp_120,
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchValue(
                value=attr,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize_left_rec
    def attr(self) -> Optional[ast.Attribute]:
        # attr: name_or_attr ('.' | '?.') NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (value := self.name_or_attr())
            and (self._tmp_121())
            and (attr := self.name())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Attribute(
                    value=value,
                    attr=attr.string,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        return None

    @logger
    def name_or_attr(self) -> Optional[Any]:
        # name_or_attr: attr | NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if attr := self.attr():
            return attr
        self._reset(mark)
        if name := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=name.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def group_pattern(self) -> Optional[Any]:
        # group_pattern: '(' pattern ')'
        mark = self._mark()
        if (self.expect("(")) and (pattern := self.pattern()) and (self.expect(")")):
            return pattern
        self._reset(mark)
        return None

    @memoize
    def sequence_pattern(self) -> Optional["ast.MatchSequence"]:
        # sequence_pattern: '[' maybe_sequence_pattern? ']' | '(' open_sequence_pattern? ')'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("["))
            and (patterns := self.maybe_sequence_pattern(),)
            and (self.expect("]"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchSequence(
                patterns=patterns or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("("))
            and (patterns := self.open_sequence_pattern(),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_tuple_pattern(
                patterns=patterns or [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def open_sequence_pattern(self) -> Optional[Any]:
        # open_sequence_pattern: maybe_star_pattern ',' maybe_sequence_pattern?
        mark = self._mark()
        if (
            (pattern := self.maybe_star_pattern())
            and (self.expect(","))
            and (patterns := self.maybe_sequence_pattern(),)
        ):
            return [pattern] + (patterns or [])
        self._reset(mark)
        return None

    @memoize
    def maybe_sequence_pattern(self) -> Optional[Any]:
        # maybe_sequence_pattern: ','.maybe_star_pattern+ ','?
        mark = self._mark()
        if (patterns := self._gather_122()) and (self.expect(","),):
            return patterns
        self._reset(mark)
        return None

    @memoize
    def maybe_star_pattern(self) -> Optional[Any]:
        # maybe_star_pattern: star_pattern | pattern
        mark = self._mark()
        if star_pattern := self.star_pattern():
            return star_pattern
        self._reset(mark)
        if pattern := self.pattern():
            return pattern
        self._reset(mark)
        return None

    @memoize
    def star_pattern(self) -> Optional[Any]:
        # star_pattern: '*' pattern_capture_target_annot | '*' wildcard_pattern
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (target := self.pattern_capture_target_annot()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.MatchStar(
                    name=target[0],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                target[1],
            )
        self._reset(mark)
        if (self.expect("*")) and (self.wildcard_pattern()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchStar(
                target=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def mapping_pattern(self) -> Optional[Any]:
        # mapping_pattern: '{' '}' | '{' double_star_pattern ','? '}' | '{' items_pattern ',' double_star_pattern ','? '}' | '{' items_pattern ','? '}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("{")) and (self.expect("}")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchMapping(
                keys=[],
                patterns=[],
                rest=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (rest := self.double_star_pattern())
            and (self.expect(","),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchMapping(
                keys=[],
                patterns=[],
                rest=rest,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (items := self.items_pattern())
            and (self.expect(","))
            and (rest := self.double_star_pattern())
            and (self.expect(","),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchMapping(
                keys=[k for k, _ in items],
                patterns=[p for _, p in items],
                rest=rest,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (items := self.items_pattern())
            and (self.expect(","),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchMapping(
                keys=[k for k, _ in items],
                patterns=[p for _, p in items],
                rest=None,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def items_pattern(self) -> Optional[Any]:
        # items_pattern: ','.key_value_pattern+
        mark = self._mark()
        if _gather_124 := self._gather_124():
            return _gather_124
        self._reset(mark)
        return None

    @memoize
    def attr_pattern(self) -> Optional[ast.Attribute]:
        # attr_pattern: name_or_attr '.' NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (value := self.name_or_attr())
            and (self.expect("."))
            and (attr := self.name())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Attribute(
                value=value,
                attr=attr.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def name_or_attr_pattern(self) -> Optional[Any]:
        # name_or_attr_pattern: attr_pattern | NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if attr_pattern := self.attr_pattern():
            return attr_pattern
        self._reset(mark)
        if name := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=name.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def key_value_pattern(self) -> Optional[Any]:
        # key_value_pattern: (literal_expr | attr_pattern) ':' pattern
        mark = self._mark()
        if (
            (key := self._tmp_126())
            and (self.expect(":"))
            and (pattern := self.pattern())
        ):
            return (key, pattern)
        self._reset(mark)
        return None

    @memoize
    def double_star_pattern(self) -> Optional[Any]:
        # double_star_pattern: '**' pattern_capture_target
        mark = self._mark()
        if (self.expect("**")) and (target := self.pattern_capture_target()):
            return target
        self._reset(mark)
        return None

    @memoize
    def class_pattern(self) -> Optional["ast.MatchClass"]:
        # class_pattern: name_or_attr_pattern '(' ')' | name_or_attr_pattern '(' positional_patterns ','? ')' | name_or_attr_pattern '(' keyword_patterns ','? ')' | name_or_attr_pattern '(' positional_patterns ',' keyword_patterns ','? ')' | invalid_class_pattern
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (cls := self.name_or_attr_pattern())
            and (self.expect("("))
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchClass(
                cls=cls,
                patterns=[],
                kwd_attrs=[],
                kwd_patterns=[],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (cls := self.name_or_attr_pattern())
            and (self.expect("("))
            and (patterns := self.positional_patterns())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchClass(
                cls=cls,
                patterns=patterns,
                kwd_attrs=[],
                kwd_patterns=[],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (cls := self.name_or_attr_pattern())
            and (self.expect("("))
            and (keywords := self.keyword_patterns())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchClass(
                cls=cls,
                patterns=[],
                kwd_attrs=[k for k, _ in keywords],
                kwd_patterns=[p for _, p in keywords],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (cls := self.name_or_attr_pattern())
            and (self.expect("("))
            and (patterns := self.positional_patterns())
            and (self.expect(","))
            and (keywords := self.keyword_patterns())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchClass(
                cls=cls,
                patterns=patterns,
                kwd_attrs=[k for k, _ in keywords],
                kwd_patterns=[p for _, p in keywords],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_class_pattern()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def attribute_capture_pattern(self) -> Optional[tuple[str, ast.pattern | None]]:
        # attribute_capture_pattern: '.' keyword_pattern | '.' NAME
        mark = self._mark()
        if (self.expect(".")) and (p := self.keyword_pattern()):
            return p
        self._reset(mark)
        if (self.expect(".")) and (a := self.name()):
            return (a.string, None)
        self._reset(mark)
        return None

    @memoize
    def attributes_pattern(self) -> Optional["ast.MatchClass"]:
        # attributes_pattern: '{' ','.attribute_capture_pattern+ ','? '}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{"))
            and (keywords := self._gather_127())
            and (self.expect(","),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_attributes_pattern(
                keywords=keywords,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def positional_patterns(self) -> Optional[Any]:
        # positional_patterns: ','.positional_pattern+
        mark = self._mark()
        if args := self._gather_129():
            return args
        self._reset(mark)
        return None

    @memoize
    def positional_pattern(self) -> Optional[Any]:
        # positional_pattern: positional_as_pattern | positional_or_pattern
        mark = self._mark()
        if positional_as_pattern := self.positional_as_pattern():
            return positional_as_pattern
        self._reset(mark)
        if positional_or_pattern := self.positional_or_pattern():
            return positional_or_pattern
        self._reset(mark)
        return None

    @memoize
    def positional_as_pattern(self) -> Optional["ast.MatchAs"]:
        # positional_as_pattern: positional_or_pattern 'as' positional_pattern_capture_target_annot | invalid_as_pattern
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (pattern := self.positional_or_pattern())
            and (self.expect("as"))
            and (target := self.positional_pattern_capture_target_annot())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.MatchAs(
                    pattern=pattern,
                    name=target[0],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                target[1],
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_as_pattern()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def positional_or_pattern(self) -> Optional["ast.MatchOr"]:
        # positional_or_pattern: '|'.positional_closed_pattern+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if patterns := self._gather_131():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.MatchOr(
                    patterns=patterns,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if len(patterns) > 1
                else patterns[0]
            )
        self._reset(mark)
        return None

    @memoize
    def positional_pattern_capture_target(self) -> Optional[str]:
        # positional_pattern_capture_target: !"_" NAME !('.' | '(' | '=')
        mark = self._mark()
        if (
            (self.negative_lookahead(self.expect, "_"))
            and (name := self.name())
            and (
                self.negative_lookahead(
                    self._tmp_133,
                )
            )
        ):
            return name.string
        self._reset(mark)
        return None

    @memoize
    def positional_pattern_capture_target_annot(
        self,
    ) -> Optional[tuple[str, ast.expr | None]]:
        # positional_pattern_capture_target_annot: !"_" NAME annotation? !('.' | '(' | '=')
        mark = self._mark()
        if (
            (self.negative_lookahead(self.expect, "_"))
            and (name := self.name())
            and (a := self.annotation(),)
            and (
                self.negative_lookahead(
                    self._tmp_134,
                )
            )
        ):
            return (name.string, a)
        self._reset(mark)
        return None

    @memoize
    def positional_capture_pattern(self) -> Optional[Any]:
        # positional_capture_pattern: positional_pattern_capture_target_annot
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if target := self.positional_pattern_capture_target_annot():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.MatchAs(
                    pattern=None,
                    name=target[0],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                target[1],
            )
        self._reset(mark)
        return None

    @memoize
    def positional_value_pattern(self) -> Optional["ast.MatchValue"]:
        # positional_value_pattern: attr !('.' | '(' | '=')
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (attr := self.attr()) and (
            self.negative_lookahead(
                self._tmp_135,
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.MatchValue(
                value=attr,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def positional_closed_pattern(self) -> Optional[Any]:
        # positional_closed_pattern: literal_pattern | positional_capture_pattern | wildcard_pattern | positional_value_pattern | group_pattern | sequence_pattern | mapping_pattern | class_pattern
        mark = self._mark()
        if literal_pattern := self.literal_pattern():
            return literal_pattern
        self._reset(mark)
        if positional_capture_pattern := self.positional_capture_pattern():
            return positional_capture_pattern
        self._reset(mark)
        if wildcard_pattern := self.wildcard_pattern():
            return wildcard_pattern
        self._reset(mark)
        if positional_value_pattern := self.positional_value_pattern():
            return positional_value_pattern
        self._reset(mark)
        if group_pattern := self.group_pattern():
            return group_pattern
        self._reset(mark)
        if sequence_pattern := self.sequence_pattern():
            return sequence_pattern
        self._reset(mark)
        if mapping_pattern := self.mapping_pattern():
            return mapping_pattern
        self._reset(mark)
        if class_pattern := self.class_pattern():
            return class_pattern
        self._reset(mark)
        return None

    @memoize
    def keyword_patterns(self) -> Optional[Any]:
        # keyword_patterns: ','.keyword_pattern+
        mark = self._mark()
        if _gather_136 := self._gather_136():
            return _gather_136
        self._reset(mark)
        return None

    @memoize
    def keyword_pattern(self) -> Optional[Any]:
        # keyword_pattern: NAME '=' pattern
        mark = self._mark()
        if (arg := self.name()) and (self.expect("=")) and (value := self.pattern()):
            return (arg.string, value)
        self._reset(mark)
        return None

    @memoize
    def type_alias(self) -> Optional["ast.TypeAlias"]:
        # type_alias: "type" NAME type_params? '=' typing_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("type"))
            and (n := self.name())
            and (t := self.type_params(),)
            and (self.expect("="))
            and (b := self.typing_expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 12),
                "Type statement is",
                (
                    ast.TypeAlias(
                        name=ast.Name(
                            id=n.string,
                            ctx=Store,
                            lineno=n.start[0],
                            col_offset=n.start[1],
                            end_lineno=n.end[0],
                            end_col_offset=n.end[1],
                        ),
                        type_params=t or [],
                        value=b,
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    )
                    if sys.version_info >= (3, 12)
                    else None
                ),
            )
        self._reset(mark)
        return None

    @memoize
    def type_params(self) -> Optional[List[ast.type_param]]:
        # type_params: '[' type_param_seq ']'
        mark = self._mark()
        if (self.expect("[")) and (t := self.type_param_seq()) and (self.expect("]")):
            return self.check_version((3, 12), "Type parameter lists are", t)
        self._reset(mark)
        return None

    @memoize
    def type_param_seq(self) -> Optional[Any]:
        # type_param_seq: ','.type_param+ ','?
        mark = self._mark()
        if (a := self._gather_138()) and (self.expect(","),):
            return a
        self._reset(mark)
        return None

    @memoize
    def type_param(self) -> Optional[ast.type_param]:
        # type_param: NAME type_param_bound? | '*' NAME ":" typing_expression | '*' NAME | '**' NAME ":" typing_expression | '**' NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.type_param_bound(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.TypeVar(
                    name=a.string,
                    bound=b,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 12)
                else object()
            )
        self._reset(mark)
        if (
            (self.expect("*"))
            and (self.name())
            and (colon := self.expect(":"))
            and (e := self.typing_expression())
        ):
            return self.raise_syntax_error_starting_from(
                "cannot use constraints with TypeVarTuple"
                if isinstance(e, ast.Tuple)
                else "cannot use bound with TypeVarTuple",
                colon,
            )
        self._reset(mark)
        if (self.expect("*")) and (a := self.name()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.TypeVarTuple(
                    name=a.string,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 12)
                else object()
            )
        self._reset(mark)
        if (
            (self.expect("**"))
            and (self.name())
            and (colon := self.expect(":"))
            and (e := self.typing_expression())
        ):
            return self.raise_syntax_error_starting_from(
                "cannot use constraints with ParamSpec"
                if isinstance(e, ast.Tuple)
                else "cannot use bound with ParamSpec",
                colon,
            )
        self._reset(mark)
        if (self.expect("**")) and (a := self.name()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.ParamSpec(
                    name=a.string,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 12)
                else object()
            )
        self._reset(mark)
        return None

    @memoize
    def type_param_bound(self) -> Optional[Any]:
        # type_param_bound: ":" typing_expression
        mark = self._mark()
        if (self.expect(":")) and (e := self.typing_expression()):
            return e
        self._reset(mark)
        return None

    @memoize
    def typing_star_expression(self) -> Optional[Any]:
        # typing_star_expression: '*' bitwise_or | typing_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (a := self.bitwise_or()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=a,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if typing_expression := self.typing_expression():
            return typing_expression
        self._reset(mark)
        return None

    @memoize
    def typing_expression(self) -> Optional[ast.expr]:
        # typing_expression: typing_expression_impl
        mark = self._mark()
        if t := self.typing_expression_impl():
            return set_is_typing_expression(t)
        self._reset(mark)
        return None

    @memoize
    def typing_expression_impl(self) -> Optional[ast.expr]:
        # typing_expression_impl: invalid_expression | &'(' typing_arrow_type | typing_arrow_single_param_type
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_expression()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "(")) and (
            typing_arrow_type := self.typing_arrow_type()
        ):
            return typing_arrow_type
        self._reset(mark)
        if typing_arrow_single_param_type := self.typing_arrow_single_param_type():
            return typing_arrow_single_param_type
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_single_param_type(self) -> Optional[ast.expr]:
        # typing_arrow_single_param_type: !'(' typing_disjunction (('->' typing_arrow_single_param_type))+ | typing_disjunction
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.negative_lookahead(self.expect, "("))
            and (a := self.typing_disjunction())
            and (r := self._loop1_140())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_arrow_type_single_chain(
                a,
                None,
                r,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if typing_disjunction := self.typing_disjunction():
            return typing_disjunction
        self._reset(mark)
        return None

    @memoize
    def typing_disjunction(self) -> Optional[ast.expr]:
        # typing_disjunction: typing_conjunction (('||' typing_conjunction))+ | typing_conjunction
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.typing_conjunction()) and (b := self._loop1_141()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BoolOp(
                op=ast.Or(),
                values=[a] + b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if typing_conjunction := self.typing_conjunction():
            return typing_conjunction
        self._reset(mark)
        return None

    @memoize
    def typing_conjunction(self) -> Optional[ast.expr]:
        # typing_conjunction: typing_inversion (('&&' typing_inversion))+ | typing_inversion
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.typing_inversion()) and (b := self._loop1_142()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BoolOp(
                op=ast.And(),
                values=[a] + b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if typing_inversion := self.typing_inversion():
            return typing_inversion
        self._reset(mark)
        return None

    @memoize
    def typing_inversion(self) -> Optional[ast.expr]:
        # typing_inversion: '!' typing_inversion | typing_comparison
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("!")) and (a := self.typing_inversion()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.Not(),
                operand=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if typing_comparison := self.typing_comparison():
            return typing_comparison
        self._reset(mark)
        return None

    @memoize
    def typing_comparison(self) -> Optional[ast.expr]:
        # typing_comparison: bitwise_or typing_compare_op_bitwise_or_pair+ | bitwise_or
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.bitwise_or()) and (b := self._loop1_143()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Compare(
                left=a,
                ops=self.get_comparison_ops(b),
                comparators=self.get_comparators(b),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if bitwise_or := self.bitwise_or():
            return bitwise_or
        self._reset(mark)
        return None

    @memoize
    def typing_compare_op_bitwise_or_pair(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # typing_compare_op_bitwise_or_pair: eq_bitwise_or | noteq_bitwise_or | lte_bitwise_or | lt_bitwise_or | gte_bitwise_or | gt_bitwise_or
        mark = self._mark()
        if eq_bitwise_or := self.eq_bitwise_or():
            return eq_bitwise_or
        self._reset(mark)
        if noteq_bitwise_or := self.noteq_bitwise_or():
            return noteq_bitwise_or
        self._reset(mark)
        if lte_bitwise_or := self.lte_bitwise_or():
            return lte_bitwise_or
        self._reset(mark)
        if lt_bitwise_or := self.lt_bitwise_or():
            return lt_bitwise_or
        self._reset(mark)
        if gte_bitwise_or := self.gte_bitwise_or():
            return gte_bitwise_or
        self._reset(mark)
        if gt_bitwise_or := self.gt_bitwise_or():
            return gt_bitwise_or
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_param_annot_or_type(self) -> Optional[ast.arg]:
        # typing_arrow_param_annot_or_type: NAME annotation | typing_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.annotation()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.arg(
                arg=a.string,
                annotation=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if b := self.typing_expression():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.arg(
                arg="",
                annotation=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_param(self) -> Optional[ast.arg]:
        # typing_arrow_param: typing_arrow_param_annot_or_type ',' | typing_arrow_param_annot_or_type &')'
        mark = self._mark()
        if (a := self.typing_arrow_param_annot_or_type()) and (self.expect(",")):
            return a
        self._reset(mark)
        if (a := self.typing_arrow_param_annot_or_type()) and (
            self.positive_lookahead(self.expect, ")")
        ):
            return a
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_kwds(self) -> Optional[ast.arg]:
        # typing_arrow_kwds: '**' typing_arrow_param
        mark = self._mark()
        if (self.expect("**")) and (a := self.typing_arrow_param()):
            return a
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_param_star_annotation(self) -> Optional[Any]:
        # typing_arrow_param_star_annotation: param_star_annotation ',' TYPE_COMMENT? | param_star_annotation TYPE_COMMENT? &')'
        mark = self._mark()
        if (
            (a := self.param_star_annotation())
            and (self.expect(","))
            and (tc := self.type_comment(),)
        ):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        if (
            (a := self.param_star_annotation())
            and (tc := self.type_comment(),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return self.set_arg_type_comment(a, tc)
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_star_etc(self) -> Optional[Tuple[ast.arg, ast.arg]]:
        # typing_arrow_star_etc: '*' typing_arrow_param typing_arrow_kwds? | '*' typing_arrow_param_star_annotation typing_arrow_kwds?
        mark = self._mark()
        if (
            (self.expect("*"))
            and (a := self.typing_arrow_param())
            and (c := self.typing_arrow_kwds(),)
        ):
            return (a, c)
        self._reset(mark)
        if (
            (self.expect("*"))
            and (a := self.typing_arrow_param_star_annotation())
            and (c := self.typing_arrow_kwds(),)
        ):
            return (a, c)
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_return_type(self) -> Optional[ast.expr]:
        # typing_arrow_return_type: '->' typing_expression
        mark = self._mark()
        if (self.expect("->")) and (a := self.typing_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def typing_arrow_type(self) -> Optional[ast.expr]:
        # typing_arrow_type: '(' typing_arrow_param* typing_arrow_star_etc? ')' typing_arrow_return_type
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("("))
            and (a := self._loop0_144(),)
            and (c := self.typing_arrow_star_etc(),)
            and (self.expect(")"))
            and (r := self.typing_arrow_return_type())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_arrow_type(
                a,
                c,
                r,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def expressions(self) -> Optional[Any]:
        # expressions: '(' expression ((',' expression))+ ','? ')' | expression ',' | expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("("))
            and (a := self.expression())
            and (b := self._loop1_145())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=[a] + b,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.expression()) and (self.expect(",")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=[a],
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if expression := self.expression():
            return expression
        self._reset(mark)
        return None

    @memoize
    def expression(self) -> Optional[Any]:
        # expression: invalid_expression | pipe_operator
        mark = self._mark()
        if self.call_invalid_rules and (self.invalid_expression()):
            return None  # pragma: no cover;
        self._reset(mark)
        if pipe_operator := self.pipe_operator():
            return pipe_operator
        self._reset(mark)
        return None

    @memoize
    def yield_expr(self) -> Optional[Any]:
        # yield_expr: 'yield' 'from' expression | 'yield' star_expressions?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("yield"))
            and (self.expect("from"))
            and (a := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.YieldFrom(
                value=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("yield")) and (a := self.star_expressions(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Yield(
                value=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def star_expressions(self) -> Optional[Any]:
        # star_expressions: '(' star_expression ((',' star_expression))+ ','? ')' | '(' star_expression ',' ')' | star_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("("))
            and (a := self.star_expression())
            and (b := self._loop1_146())
            and (self.expect(","),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=[a] + b,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("("))
            and (a := self.star_expression())
            and (self.expect(","))
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=[a],
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if star_expression := self.star_expression():
            return star_expression
        self._reset(mark)
        return None

    @memoize
    def star_expression(self) -> Optional[Any]:
        # star_expression: '*' bitwise_or | expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (a := self.bitwise_or()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=a,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if expression := self.expression():
            return expression
        self._reset(mark)
        return None

    @memoize
    def star_named_expressions(self) -> Optional[Any]:
        # star_named_expressions: ','.star_named_expression+ ','?
        mark = self._mark()
        if (a := self._gather_147()) and (self.expect(","),):
            return a
        self._reset(mark)
        return None

    @memoize
    def star_named_expression(self) -> Optional[Any]:
        # star_named_expression: '*' bitwise_or | named_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (a := self.bitwise_or()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=a,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if named_expression := self.named_expression():
            return named_expression
        self._reset(mark)
        return None

    @memoize
    def assignment_expression(self) -> Optional[Any]:
        # assignment_expression: NAME ':=' ~ expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (a := self.name())
            and (self.expect(":="))
            and (cut := True)
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 8),
                "The ':=' operator is",
                ast.NamedExpr(
                    target=ast.Name(
                        id=a.string,
                        ctx=Store,
                        lineno=a.start[0],
                        col_offset=a.start[1],
                        end_lineno=a.end[0],
                        end_col_offset=a.end[1],
                    ),
                    value=b,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if cut:
            return None
        return None

    @memoize
    def named_expression(self) -> Optional[Any]:
        # named_expression: assignment_expression | invalid_named_expression | expression !':='
        mark = self._mark()
        if assignment_expression := self.assignment_expression():
            return assignment_expression
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_named_expression()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (a := self.expression()) and (self.negative_lookahead(self.expect, ":=")):
            return a
        self._reset(mark)
        return None

    @memoize
    def pipe_operator(self) -> Optional[Any]:
        # pipe_operator: coalescing ((('|>' | '?|>') coalescing))+ | coalescing
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.coalescing()) and (op_b := self._loop1_149()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_pipe_call(
                a,
                op_b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if coalescing := self.coalescing():
            return coalescing
        self._reset(mark)
        return None

    @memoize
    def coalescing(self) -> Optional[Any]:
        # coalescing: arrow_single_param (('??' arrow_single_param))+ | arrow_single_param
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.arrow_single_param()) and (b := self._loop1_150()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_is_coalescing(
                ast.Tuple(
                    elts=[a] + b,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        if arrow_single_param := self.arrow_single_param():
            return arrow_single_param
        self._reset(mark)
        return None

    @memoize
    def arrow_single_param(self) -> Optional[ast.expr]:
        # arrow_single_param: !'(' disjunction (('->' typing_expression))+ | disjunction
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.negative_lookahead(self.expect, "("))
            and (a := self.disjunction())
            and (r := self._loop1_151())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_arrow_type_single_chain(
                a,
                None,
                r,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if disjunction := self.disjunction():
            return disjunction
        self._reset(mark)
        return None

    @memoize
    def disjunction(self) -> Optional[Any]:
        # disjunction: conjunction (('||' conjunction))+ | conjunction
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.conjunction()) and (b := self._loop1_152()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BoolOp(
                op=ast.Or(),
                values=[a] + b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if conjunction := self.conjunction():
            return conjunction
        self._reset(mark)
        return None

    @memoize
    def conjunction(self) -> Optional[Any]:
        # conjunction: comparison (('&&' comparison))+ | comparison
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.comparison()) and (b := self._loop1_153()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BoolOp(
                op=ast.And(),
                values=[a] + b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if comparison := self.comparison():
            return comparison
        self._reset(mark)
        return None

    @memoize
    def comparison(self) -> Optional[Any]:
        # comparison: bitwise_or compare_op_bitwise_or_pair+ | bitwise_or
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.bitwise_or()) and (b := self._loop1_154()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Compare(
                left=a,
                ops=self.get_comparison_ops(b),
                comparators=self.get_comparators(b),
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if bitwise_or := self.bitwise_or():
            return bitwise_or
        self._reset(mark)
        return None

    @memoize
    def compare_op_bitwise_or_pair(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # compare_op_bitwise_or_pair: eq_bitwise_or | noteq_bitwise_or | lte_bitwise_or | lt_bitwise_or | gte_bitwise_or | gt_bitwise_or | notin_bitwise_or | in_bitwise_or | isnot_bitwise_or | is_bitwise_or
        mark = self._mark()
        if eq_bitwise_or := self.eq_bitwise_or():
            return eq_bitwise_or
        self._reset(mark)
        if noteq_bitwise_or := self.noteq_bitwise_or():
            return noteq_bitwise_or
        self._reset(mark)
        if lte_bitwise_or := self.lte_bitwise_or():
            return lte_bitwise_or
        self._reset(mark)
        if lt_bitwise_or := self.lt_bitwise_or():
            return lt_bitwise_or
        self._reset(mark)
        if gte_bitwise_or := self.gte_bitwise_or():
            return gte_bitwise_or
        self._reset(mark)
        if gt_bitwise_or := self.gt_bitwise_or():
            return gt_bitwise_or
        self._reset(mark)
        if notin_bitwise_or := self.notin_bitwise_or():
            return notin_bitwise_or
        self._reset(mark)
        if in_bitwise_or := self.in_bitwise_or():
            return in_bitwise_or
        self._reset(mark)
        if isnot_bitwise_or := self.isnot_bitwise_or():
            return isnot_bitwise_or
        self._reset(mark)
        if is_bitwise_or := self.is_bitwise_or():
            return is_bitwise_or
        self._reset(mark)
        return None

    @memoize
    def eq_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # eq_bitwise_or: '==' bitwise_or
        mark = self._mark()
        if (self.expect("==")) and (a := self.bitwise_or()):
            return (ast.Eq(), a)
        self._reset(mark)
        return None

    @memoize
    def noteq_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # noteq_bitwise_or: '!=' bitwise_or
        mark = self._mark()
        if (self.expect("!=")) and (a := self.bitwise_or()):
            return (ast.NotEq(), a)
        self._reset(mark)
        return None

    @memoize
    def lte_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # lte_bitwise_or: '<=' bitwise_or
        mark = self._mark()
        if (self.expect("<=")) and (a := self.bitwise_or()):
            return (ast.LtE(), a)
        self._reset(mark)
        return None

    @memoize
    def lt_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # lt_bitwise_or: '<' bitwise_or
        mark = self._mark()
        if (self.expect("<")) and (a := self.bitwise_or()):
            return (ast.Lt(), a)
        self._reset(mark)
        return None

    @memoize
    def gte_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # gte_bitwise_or: '>=' bitwise_or
        mark = self._mark()
        if (self.expect(">=")) and (a := self.bitwise_or()):
            return (ast.GtE(), a)
        self._reset(mark)
        return None

    @memoize
    def gt_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # gt_bitwise_or: '>' bitwise_or
        mark = self._mark()
        if (self.expect(">")) and (a := self.bitwise_or()):
            return (ast.Gt(), a)
        self._reset(mark)
        return None

    @memoize
    def notin_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # notin_bitwise_or: 'not' 'in' bitwise_or
        mark = self._mark()
        if (self.expect("not")) and (self.expect("in")) and (a := self.bitwise_or()):
            return (ast.NotIn(), a)
        self._reset(mark)
        return None

    @memoize
    def in_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # in_bitwise_or: 'in' bitwise_or
        mark = self._mark()
        if (self.expect("in")) and (a := self.bitwise_or()):
            return (ast.In(), a)
        self._reset(mark)
        return None

    @memoize
    def isnot_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # isnot_bitwise_or: 'is' 'not' bitwise_or
        mark = self._mark()
        if (self.expect("is")) and (self.expect("not")) and (a := self.bitwise_or()):
            return (ast.IsNot(), a)
        self._reset(mark)
        return None

    @memoize
    def is_bitwise_or(self) -> Optional[Tuple[ast.cmpop, ast.expr]]:
        # is_bitwise_or: 'is' bitwise_or
        mark = self._mark()
        if (self.expect("is")) and (a := self.bitwise_or()):
            return (ast.Is(), a)
        self._reset(mark)
        return None

    @memoize_left_rec
    def bitwise_or(self) -> Optional[Any]:
        # bitwise_or: bitwise_or '|' bitwise_xor | bitwise_xor
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.bitwise_or())
            and (self.expect("|"))
            and (b := self.bitwise_xor())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.BitOr(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if bitwise_xor := self.bitwise_xor():
            return bitwise_xor
        self._reset(mark)
        return None

    @memoize_left_rec
    def bitwise_xor(self) -> Optional[Any]:
        # bitwise_xor: bitwise_xor '^' bitwise_and | bitwise_and
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.bitwise_xor())
            and (self.expect("^"))
            and (b := self.bitwise_and())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.BitXor(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if bitwise_and := self.bitwise_and():
            return bitwise_and
        self._reset(mark)
        return None

    @memoize_left_rec
    def bitwise_and(self) -> Optional[Any]:
        # bitwise_and: bitwise_and '&' shift_expr | shift_expr
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.bitwise_and())
            and (self.expect("&"))
            and (b := self.shift_expr())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.BitAnd(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if shift_expr := self.shift_expr():
            return shift_expr
        self._reset(mark)
        return None

    @memoize_left_rec
    def shift_expr(self) -> Optional[Any]:
        # shift_expr: shift_expr '<<' sum | shift_expr '>>' sum | sum
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.shift_expr()) and (self.expect("<<")) and (b := self.sum()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.LShift(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.shift_expr()) and (self.expect(">>")) and (b := self.sum()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.RShift(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if sum := self.sum():
            return sum
        self._reset(mark)
        return None

    @memoize_left_rec
    def sum(self) -> Optional[Any]:
        # sum: sum '+' term | sum '-' term | term
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.sum()) and (self.expect("+")) and (b := self.term()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Add(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.sum()) and (self.expect("-")) and (b := self.term()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Sub(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if term := self.term():
            return term
        self._reset(mark)
        return None

    @memoize_left_rec
    def term(self) -> Optional[Any]:
        # term: term '*' factor | term '/' factor | term '//' factor | term '%' factor | term '@' factor | factor
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.term()) and (self.expect("*")) and (b := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Mult(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.term()) and (self.expect("/")) and (b := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Div(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.term()) and (self.expect("//")) and (b := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.FloorDiv(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.term()) and (self.expect("%")) and (b := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Mod(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.term()) and (self.expect("@")) and (b := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 5),
                "The '@' operator is",
                ast.BinOp(
                    left=a,
                    op=ast.MatMult(),
                    right=b,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if factor := self.factor():
            return factor
        self._reset(mark)
        return None

    @memoize
    def factor(self) -> Optional[Any]:
        # factor: '+' factor | '-' factor | '~' factor | power
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("+")) and (a := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.UAdd(),
                operand=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("-")) and (a := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.USub(),
                operand=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("~")) and (a := self.factor()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.Invert(),
                operand=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if power := self.power():
            return power
        self._reset(mark)
        return None

    @memoize
    def power(self) -> Optional[Any]:
        # power: optional_question '**' factor | optional_question
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.optional_question())
            and (self.expect("**"))
            and (b := self.factor())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.BinOp(
                left=a,
                op=ast.Pow(),
                right=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if optional_question := self.optional_question():
            return optional_question
        self._reset(mark)
        return None

    @memoize
    def optional_question(self) -> Optional[Any]:
        # optional_question: force_unwrap '_typh_op_optional_question' | force_unwrap
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.force_unwrap()) and (self.expect("_typh_op_optional_question")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return get_optional_question_node(
                a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if force_unwrap := self.force_unwrap():
            return force_unwrap
        self._reset(mark)
        return None

    @memoize
    def force_unwrap(self) -> Optional[Any]:
        # force_unwrap: inversion '_typh_op_force_unwrap' | inversion
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.inversion()) and (self.expect("_typh_op_force_unwrap")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return get_force_unwrap_node(
                a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if inversion := self.inversion():
            return inversion
        self._reset(mark)
        return None

    @memoize
    def inversion(self) -> Optional[Any]:
        # inversion: '!' inversion | await_primary
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("!")) and (a := self.inversion()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.UnaryOp(
                op=ast.Not(),
                operand=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if await_primary := self.await_primary():
            return await_primary
        self._reset(mark)
        return None

    @memoize
    def await_primary(self) -> Optional[Any]:
        # await_primary: 'await' primary | primary
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("await")) and (a := self.primary()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return self.check_version(
                (3, 5),
                "Await expressions are",
                ast.Await(
                    a,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
            )
        self._reset(mark)
        if primary := self.primary():
            return primary
        self._reset(mark)
        return None

    @memoize_left_rec
    def primary(self) -> Optional[Any]:
        # primary: primary ('.' | '?.') NAME | primary comprehension_paren | primary question_comprehension_paren | primary ('(' | '?(') arguments? ')' | primary ('[' | '?[') slices ']' | atom
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.primary()) and (o := self._tmp_155()) and (b := self.name()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Attribute(
                    value=a,
                    attr=b.string,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        if (a := self.primary()) and (b := self.comprehension_paren()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Call(
                func=a,
                args=[b],
                keywords=[],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.primary()) and (b := self.question_comprehension_paren()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Call(
                    func=a,
                    args=[b],
                    keywords=[],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                "?",
            )
        self._reset(mark)
        if (
            (a := self.primary())
            and (o := self._tmp_156())
            and (b := self.arguments(),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Call(
                    func=a,
                    args=b[0] if b else [],
                    keywords=b[1] if b else [],
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        if (
            (a := self.primary())
            and (o := self._tmp_157())
            and (b := self.slices())
            and (self.expect("]"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return maybe_optional(
                ast.Subscript(
                    value=a,
                    slice=b,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                o.string,
            )
        self._reset(mark)
        if atom := self.atom():
            return atom
        self._reset(mark)
        return None

    @memoize
    def slices(self) -> Optional[Any]:
        # slices: slice !',' | ','.(slice | starred_expression)+ ','?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.slice()) and (self.negative_lookahead(self.expect, ",")):
            return a
        self._reset(mark)
        if (a := self._gather_158()) and (self.expect(","),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Tuple(
                    elts=a,
                    ctx=Load,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else (
                    ast.ExtSlice(
                        dims=a,
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    )
                    if any(isinstance(e, ast.Slice) for e in a)
                    else ast.Index(
                        value=ast.Tuple(
                            elts=[e.value for e in a],
                            ctx=Load,
                            lineno=start_lineno,
                            col_offset=start_col_offset,
                            end_lineno=end_lineno,
                            end_col_offset=end_col_offset,
                        ),
                        lineno=start_lineno,
                        col_offset=start_col_offset,
                        end_lineno=end_lineno,
                        end_col_offset=end_col_offset,
                    )
                )
            )
        self._reset(mark)
        return None

    @memoize
    def slice(self) -> Optional[Any]:
        # slice: expression? ':' expression? [':' expression?] | named_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.expression(),)
            and (self.expect(":"))
            and (b := self.expression(),)
            and (c := self._tmp_160(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Slice(
                lower=a,
                upper=b,
                step=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if a := self.named_expression():
            return (
                a
                if sys.version_info >= (3, 9) or isinstance(a, ast.Slice)
                else ast.Index(
                    value=a,
                    lineno=a.lineno,
                    col_offset=a.col_offset,
                    end_lineno=a.end_lineno,
                    end_col_offset=a.end_col_offset,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def atom(self) -> Optional[Any]:
        # atom: NAME | 'True' | 'False' | 'None' | &(STRING | FSTRING_START) strings | NUMBER | &'(' (function_literal | typing_arrow_type | tuple | group | comprehension_paren) | &'[' (list | listcomp) | &'{' (dict | set | dictcomp | setcomp) | &'{|' (record_type | record_literal) | '...'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if a := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=a.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("True"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Constant(
                    value=True,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.Constant(
                    value=True,
                    kind=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        if self.expect("False"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Constant(
                    value=False,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.Constant(
                    value=False,
                    kind=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        if self.expect("None"):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Constant(
                    value=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.Constant(
                    value=None,
                    kind=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        if (
            self.positive_lookahead(
                self._tmp_161,
            )
        ) and (strings := self.strings()):
            return strings
        self._reset(mark)
        if a := self.number():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Constant(
                    value=ast.literal_eval(a.string),
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.Constant(
                    value=ast.literal_eval(a.string),
                    kind=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "(")) and (
            _tmp_162 := self._tmp_162()
        ):
            return _tmp_162
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "[")) and (
            _tmp_163 := self._tmp_163()
        ):
            return _tmp_163
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "{")) and (
            _tmp_164 := self._tmp_164()
        ):
            return _tmp_164
        self._reset(mark)
        if (self.positive_lookahead(self.expect, "{|")) and (
            _tmp_165 := self._tmp_165()
        ):
            return _tmp_165
        self._reset(mark)
        if self.expect("..."):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Constant(
                    value=Ellipsis,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
                if sys.version_info >= (3, 9)
                else ast.Constant(
                    value=Ellipsis,
                    kind=None,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def group(self) -> Optional[Any]:
        # group: '(' (yield_expr | named_expression) ')' | invalid_group
        mark = self._mark()
        if (self.expect("(")) and (a := self._tmp_166()) and (self.expect(")")):
            return a
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_group()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def function_literal(self) -> Optional[Any]:
        # function_literal: '(' params ')' typing_arrow_return_type? '=>' ~ (block | expression)
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (self.expect("("))
            and (p := self.params())
            and (self.expect(")"))
            and (a := self.typing_arrow_return_type(),)
            and (self.expect("=>"))
            and (cut := True)
            and (b := self._tmp_167())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_function_literal(
                args=p,
                returns=a,
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        return None

    @memoize
    def fstring_mid(self) -> Optional[ast.expr]:
        # fstring_mid: fstring_replacement_field | FSTRING_MIDDLE
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if fstring_replacement_field := self.fstring_replacement_field():
            return fstring_replacement_field
        self._reset(mark)
        if t := self.fstring_middle():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=t.string,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def fstring_replacement_field(self) -> Optional[ast.FormattedValue]:
        # fstring_replacement_field: '{' (yield_expr | star_expressions) "="? fstring_conversion? fstring_full_format_spec? '}' | invalid_replacement_field
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{"))
            and (a := self._tmp_168())
            and (debug_expr := self.expect("="),)
            and (conversion := self.fstring_conversion(),)
            and (format := self.fstring_full_format_spec(),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.FormattedValue(
                value=a,
                conversion=(
                    conversion.string.encode()[0]
                    if conversion
                    else (b"r"[0] if debug_expr else -1)
                ),
                format_spec=format,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_replacement_field()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def fstring_conversion(self) -> Optional[int]:
        # fstring_conversion: "!" NAME
        mark = self._mark()
        if (conv_token := self.expect("!")) and (conv := self.name()):
            return self.check_fstring_conversion(conv_token, conv)
        self._reset(mark)
        return None

    @memoize
    def fstring_full_format_spec(self) -> Optional[Any]:
        # fstring_full_format_spec: ':' fstring_format_spec*
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect(":")) and (spec := self._loop0_169(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.JoinedStr(
                values=spec if spec and (len(spec) > 1 or spec[0].value) else [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def fstring_format_spec(self) -> Optional[Any]:
        # fstring_format_spec: FSTRING_MIDDLE | fstring_replacement_field
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if t := self.fstring_middle():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Constant(
                value=t.string,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if fstring_replacement_field := self.fstring_replacement_field():
            return fstring_replacement_field
        self._reset(mark)
        return None

    @memoize
    def strings(self) -> Optional[Any]:
        # strings: ((fstring | STRING))+
        mark = self._mark()
        if a := self._loop1_170():
            return self.concatenate_strings(a)
        self._reset(mark)
        return None

    @memoize
    def list(self) -> Optional[ast.List]:
        # list: '[' star_named_expressions? ']'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("["))
            and (a := self.star_named_expressions(),)
            and (self.expect("]"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.List(
                elts=a or [],
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def tuple(self) -> Optional[ast.Tuple]:
        # tuple: '(' [star_named_expression ',' star_named_expressions?] ')'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("(")) and (a := self._tmp_171(),) and (self.expect(")")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=a or [],
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def set(self) -> Optional[ast.Set]:
        # set: '{' star_named_expressions '}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{"))
            and (a := self.star_named_expressions())
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Set(
                elts=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def dict(self) -> Optional[ast.Dict]:
        # dict: '{' double_starred_kvpairs? '}' | '{' invalid_double_starred_kvpairs '}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{"))
            and (a := self.double_starred_kvpairs(),)
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Dict(
                keys=[kv[0] for kv in (a or [])],
                values=[kv[1] for kv in (a or [])],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            self.call_invalid_rules
            and (self.expect("{"))
            and (self.invalid_double_starred_kvpairs())
            and (self.expect("}"))
        ):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def double_starred_kvpairs(
        self,
    ) -> Optional[List[Tuple[ast.expr | None, ast.expr]]]:
        # double_starred_kvpairs: ','.double_starred_kvpair+ ','?
        mark = self._mark()
        if (a := self._gather_172()) and (self.expect(","),):
            return a
        self._reset(mark)
        return None

    @memoize
    def double_starred_kvpair(self) -> Optional[Tuple[ast.expr | None, ast.expr]]:
        # double_starred_kvpair: '**' bitwise_or | kvpair
        mark = self._mark()
        if (self.expect("**")) and (a := self.bitwise_or()):
            return (None, a)
        self._reset(mark)
        if kvpair := self.kvpair():
            return kvpair
        self._reset(mark)
        return None

    @memoize
    def kvpair(self) -> Optional[Tuple[ast.expr, ast.expr]]:
        # kvpair: expression ':' expression
        mark = self._mark()
        if (a := self.expression()) and (self.expect(":")) and (b := self.expression()):
            return (a, b)
        self._reset(mark)
        return None

    @memoize
    def record_literal_field(
        self,
    ) -> Optional[Tuple[ast.Name, ast.expr | None, ast.expr]]:
        # record_literal_field: NAME annotation? '=' expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.name())
            and (b := self.annotation(),)
            and (self.expect("="))
            and (c := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Name(
                    id=a.string,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                b,
                c,
            )
        self._reset(mark)
        return None

    @memoize
    def record_literal(self) -> Optional[ast.Name]:
        # record_literal: '{|' ','.record_literal_field+ ','? '|}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{|"))
            and (fs := self._gather_174())
            and (self.expect(","),)
            and (self.expect("|}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_record_literal(
                fs,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def record_type_field(self) -> Optional[Tuple[ast.Name, ast.expr]]:
        # record_type_field: NAME annotation
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.annotation()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return (
                ast.Name(
                    id=a.string,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                b,
            )
        self._reset(mark)
        return None

    @memoize
    def record_type(self) -> Optional[ast.Name]:
        # record_type: '{|' ','.record_type_field+ ','? '|}'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("{|"))
            and (fs := self._gather_176())
            and (self.expect(","),)
            and (self.expect("|}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_record_type(
                fs,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def for_if_clauses(self) -> Optional[List[ast.comprehension]]:
        # for_if_clauses: for_if_clause+
        mark = self._mark()
        if a := self._loop1_178():
            return a
        self._reset(mark)
        return None

    @memoize
    def for_if_clause(self) -> Optional[ast.comprehension]:
        # for_if_clause: 'async' 'for' '(' decl_keyword decl_star_target star_annotation? 'in' ~ pipe_operator ')' NEWLINE* (('if' '(' pipe_operator ')' NEWLINE*))* | 'for' '(' decl_keyword decl_star_target star_annotation? 'in' ~ pipe_operator ')' NEWLINE* (('if' '(' pipe_operator ')' NEWLINE*))* | invalid_for_target
        mark = self._mark()
        cut = False
        if (
            (self.expect("async"))
            and (self.expect("for"))
            and (self.expect("("))
            and (d := self.decl_keyword())
            and (t := self.decl_star_target())
            and (a := self.star_annotation(),)
            and (self.expect("in"))
            and (cut := True)
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_179(),)
            and (c := self._loop0_180(),)
        ):
            return self.check_version(
                (3, 6),
                "Async comprehensions are",
                make_comprehension(
                    decl_type=d.string,
                    target=t,
                    type_annotation=a,
                    iter=b,
                    ifs=c,
                    is_async=1,
                ),
            )
        self._reset(mark)
        if cut:
            return None
        cut = False
        if (
            (self.expect("for"))
            and (self.expect("("))
            and (d := self.decl_keyword())
            and (t := self.decl_star_target())
            and (a := self.star_annotation(),)
            and (self.expect("in"))
            and (cut := True)
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_181(),)
            and (c := self._loop0_182(),)
        ):
            return make_comprehension(
                decl_type=d.string,
                target=t,
                type_annotation=a,
                iter=b,
                ifs=c,
                is_async=0,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_for_target()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def listcomp(self) -> Optional[ast.ListComp]:
        # listcomp: '[' for_if_clauses 'yield' ~ named_expression ']' | invalid_comprehension
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (self.expect("["))
            and (b := self.for_if_clauses())
            and (self.expect("yield"))
            and (cut := True)
            and (a := self.named_expression())
            and (self.expect("]"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_listcomp(
                elt=a,
                generators=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_comprehension()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def setcomp(self) -> Optional[ast.SetComp]:
        # setcomp: '{' for_if_clauses 'yield' ~ named_expression '}' | invalid_comprehension
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (self.expect("{"))
            and (b := self.for_if_clauses())
            and (self.expect("yield"))
            and (cut := True)
            and (a := self.named_expression())
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_setcomp(
                elt=a,
                generators=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_comprehension()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def genexp_internal(self) -> Optional[ast.GeneratorExp]:
        # genexp_internal: for_if_clauses 'yield' ~ (assignment_expression | expression !':=')
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (b := self.for_if_clauses())
            and (self.expect("yield"))
            and (cut := True)
            and (a := self._tmp_183())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_genexp(
                elt=a,
                generators=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        return None

    @memoize
    def genexp(self) -> Optional[ast.GeneratorExp]:
        # genexp: '(' genexp_internal ')' | invalid_comprehension
        mark = self._mark()
        if (self.expect("(")) and (b := self.genexp_internal()) and (self.expect(")")):
            return b
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_comprehension()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def question_genexp(self) -> Optional[ast.GeneratorExp]:
        # question_genexp: '?(' genexp_internal ')'
        mark = self._mark()
        if (self.expect("?(")) and (b := self.genexp_internal()) and (self.expect(")")):
            return b
        self._reset(mark)
        return None

    @memoize
    def dictcomp(self) -> Optional[ast.DictComp]:
        # dictcomp: '{' for_if_clauses 'yield' ~ kvpair '}' | invalid_dict_comprehension
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        cut = False
        if (
            (self.expect("{"))
            and (b := self.for_if_clauses())
            and (self.expect("yield"))
            and (cut := True)
            and (a := self.kvpair())
            and (self.expect("}"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_dictcomp(
                key=a[0],
                value=a[1],
                generators=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if cut:
            return None
        if self.call_invalid_rules and (self.invalid_dict_comprehension()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def if_comp_internal(self) -> Optional[ast.expr]:
        # if_comp_internal: 'if' '(' pipe_operator ')' NEWLINE* expression if_comp_elif | 'if' '(' pipe_operator ')' NEWLINE* expression if_comp_else? | 'if' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* expression if_comp_elif | 'if' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* expression if_comp_else?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_184(),)
            and (a := self.expression())
            and (c := self.if_comp_elif())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return if_comp_exp(
                body=a,
                test=b,
                orelse=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_185(),)
            and (a := self.expression())
            and (c := self.if_comp_else(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return if_comp_exp(
                body=a,
                test=b,
                orelse=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_186())
            and (cond := self._tmp_188(),)
            and (self.expect(")"))
            and (self._loop0_189(),)
            and (b := self.expression())
            and (c := self.if_comp_elif())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let_comp(
                pat_sub,
                cond,
                b,
                c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_190())
            and (cond := self._tmp_192(),)
            and (self.expect(")"))
            and (self._loop0_193(),)
            and (b := self.expression())
            and (c := self.if_comp_else(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let_comp(
                pat_sub,
                cond,
                b,
                c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def if_comp_elif(self) -> Optional[ast.expr]:
        # if_comp_elif: 'elif' '(' pipe_operator ')' NEWLINE* expression if_comp_elif | 'elif' '(' pipe_operator ')' NEWLINE* expression if_comp_else? | 'elif' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* expression if_comp_elif | 'elif' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* expression if_comp_else?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_194(),)
            and (a := self.expression())
            and (c := self.if_comp_elif())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return if_comp_exp(
                body=a,
                test=b,
                orelse=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (b := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_195(),)
            and (a := self.expression())
            and (c := self.if_comp_else(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return if_comp_exp(
                body=a,
                test=b,
                orelse=c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_196())
            and (cond := self._tmp_198(),)
            and (self.expect(")"))
            and (self._loop0_199(),)
            and (b := self.expression())
            and (c := self.if_comp_elif())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let_comp(
                pat_sub,
                cond,
                b,
                c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_200())
            and (cond := self._tmp_202(),)
            and (self.expect(")"))
            and (self._loop0_203(),)
            and (b := self.expression())
            and (c := self.if_comp_else(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_if_let_comp(
                pat_sub,
                cond,
                b,
                c,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def if_comp_else(self) -> Optional[ast.expr]:
        # if_comp_else: 'else' NEWLINE* expression
        mark = self._mark()
        if (self.expect("else")) and (self._loop0_204(),) and (a := self.expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def if_comp_exp(self) -> Optional[ast.expr]:
        # if_comp_exp: '(' if_comp_internal ')'
        mark = self._mark()
        if (self.expect("(")) and (b := self.if_comp_internal()) and (self.expect(")")):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_if_comp_exp(self) -> Optional[ast.expr]:
        # question_if_comp_exp: '?(' if_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.if_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def with_comp_internal(self) -> Optional[ast.expr]:
        # with_comp_internal: 'async'? 'with' '(' ';'.with_item+ ';'? ')' NEWLINE* expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (is_async := self.expect("async"),)
            and (self.expect("with"))
            and (self.expect("("))
            and (a := self._gather_205())
            and (self.expect(";"),)
            and (self.expect(")"))
            and (self._loop0_207(),)
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_with_comp(
                is_async=is_async is not None,
                items=sum(a, []),
                body=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def with_comp(self) -> Optional[ast.expr]:
        # with_comp: '(' with_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (b := self.with_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_with_comp(self) -> Optional[ast.expr]:
        # question_with_comp: '?(' with_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.with_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def try_comp_internal(self) -> Optional[ast.expr]:
        # try_comp_internal: 'try' NEWLINE* expression try_comp_except*
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("try"))
            and (self._loop0_208(),)
            and (b := self.expression())
            and (ex := self._loop0_209(),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_try_comp(
                b,
                ex,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def try_comp_except(self) -> Optional[ast.Name]:
        # try_comp_except: 'except' '(' expression ['as' NAME] ')' NEWLINE* expression | 'except' '*' '(' expression ['as' NAME] ')' NEWLINE* expression | 'except' NEWLINE* expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("except"))
            and (self.expect("("))
            and (e := self.expression())
            and (t := self._tmp_210(),)
            and (self.expect(")"))
            and (self._loop0_211(),)
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_try_comp_except(
                t,
                e,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("except"))
            and (self.expect("*"))
            and (self.expect("("))
            and (e := self.expression())
            and (t := self._tmp_212(),)
            and (self.expect(")"))
            and (self._loop0_213(),)
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_try_comp_except(
                t,
                e,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("except"))
            and (self._loop0_214(),)
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_try_comp_except(
                None,
                None,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def try_comp(self) -> Optional[ast.expr]:
        # try_comp: '(' try_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (b := self.try_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_try_comp(self) -> Optional[ast.expr]:
        # question_try_comp: '?(' try_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.try_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def match_comp_internal(self) -> Optional[ast.expr]:
        # match_comp_internal: 'match' '(' subject_expr ')' NEWLINE* match_comp_case+
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("match"))
            and (self.expect("("))
            and (subject := self.subject_expr())
            and (self.expect(")"))
            and (self._loop0_215(),)
            and (cases := self._loop1_216())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_match_comp(
                subject,
                cases,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def match_comp(self) -> Optional[ast.expr]:
        # match_comp: '(' match_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (b := self.match_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_match_comp(self) -> Optional[ast.expr]:
        # question_match_comp: '?(' match_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.match_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def match_comp_case(self) -> Optional[ast.Name]:
        # match_comp_case: 'case' '(' patterns ')' NEWLINE* guard? NEWLINE* expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("case"))
            and (self.expect("("))
            and (pattern := self.patterns())
            and (self.expect(")"))
            and (self._loop0_217(),)
            and (guard := self.guard(),)
            and (self._loop0_218(),)
            and (body := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_match_comp_case(
                pattern,
                guard,
                body,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def while_comp_internal(self) -> Optional[ast.expr]:
        # while_comp_internal: 'while' '(' named_expression ')' NEWLINE* 'yield' expression | 'while' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* 'yield' expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (a := self.named_expression())
            and (self.expect(")"))
            and (self._loop0_219(),)
            and (self.expect("yield"))
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_while_comp(
                a,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (self.expect("let"))
            and (pat_sub := self._gather_220())
            and (cond := self._tmp_222(),)
            and (self.expect(")"))
            and (self._loop0_223(),)
            and (self.expect("yield"))
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_while_let_comp(
                pat_sub,
                cond,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def while_comp(self) -> Optional[ast.expr]:
        # while_comp: '(' while_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (b := self.while_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_while_comp(self) -> Optional[ast.expr]:
        # question_while_comp: '?(' while_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.while_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def let_comp_internal(self) -> Optional[ast.expr]:
        # let_comp_internal: 'let' ','.declaration_single_assignment+ ';' expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (self.expect("let"))
            and (a := self._gather_224())
            and (self.expect(";"))
            and (b := self.expression())
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return make_let_comp(
                a,
                b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def let_comp(self) -> Optional[ast.expr]:
        # let_comp: '(' let_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (b := self.let_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def question_let_comp(self) -> Optional[ast.expr]:
        # question_let_comp: '?(' let_comp_internal ')'
        mark = self._mark()
        if (
            (self.expect("?("))
            and (b := self.let_comp_internal())
            and (self.expect(")"))
        ):
            return b
        self._reset(mark)
        return None

    @memoize
    def comprehension_paren(self) -> Optional[Any]:
        # comprehension_paren: genexp | if_comp_exp | with_comp | try_comp | match_comp | while_comp | let_comp
        mark = self._mark()
        if genexp := self.genexp():
            return genexp
        self._reset(mark)
        if if_comp_exp := self.if_comp_exp():
            return if_comp_exp
        self._reset(mark)
        if with_comp := self.with_comp():
            return with_comp
        self._reset(mark)
        if try_comp := self.try_comp():
            return try_comp
        self._reset(mark)
        if match_comp := self.match_comp():
            return match_comp
        self._reset(mark)
        if while_comp := self.while_comp():
            return while_comp
        self._reset(mark)
        if let_comp := self.let_comp():
            return let_comp
        self._reset(mark)
        return None

    @memoize
    def question_comprehension_paren(self) -> Optional[Any]:
        # question_comprehension_paren: question_genexp | question_if_comp_exp | question_with_comp | question_try_comp | question_match_comp | question_while_comp | question_let_comp
        mark = self._mark()
        if question_genexp := self.question_genexp():
            return question_genexp
        self._reset(mark)
        if question_if_comp_exp := self.question_if_comp_exp():
            return question_if_comp_exp
        self._reset(mark)
        if question_with_comp := self.question_with_comp():
            return question_with_comp
        self._reset(mark)
        if question_try_comp := self.question_try_comp():
            return question_try_comp
        self._reset(mark)
        if question_match_comp := self.question_match_comp():
            return question_match_comp
        self._reset(mark)
        if question_while_comp := self.question_while_comp():
            return question_while_comp
        self._reset(mark)
        if question_let_comp := self.question_let_comp():
            return question_let_comp
        self._reset(mark)
        return None

    @memoize
    def arguments(self) -> Optional[Tuple[List[ast.expr], List[ast.keyword]]]:
        # arguments: args ','? &')' | invalid_arguments
        mark = self._mark()
        if (
            (a := self.args())
            and (self.expect(","),)
            and (self.positive_lookahead(self.expect, ")"))
        ):
            return a
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_arguments()):
            return None  # pragma: no cover;
        self._reset(mark)
        return None

    @memoize
    def args(self) -> Optional[Tuple[List[ast.expr], List[ast.keyword]]]:
        # args: ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ [',' kwargs] | kwargs
        mark = self._mark()
        if (a := self._gather_226()) and (b := self._tmp_228(),):
            return (
                a + ([e for e in b if isinstance(e, ast.Starred)] if b else []),
                ([e for e in b if not isinstance(e, ast.Starred)] if b else []),
            )
        self._reset(mark)
        if a := self.kwargs():
            return (
                [e for e in a if isinstance(e, ast.Starred)],
                [e for e in a if not isinstance(e, ast.Starred)],
            )
        self._reset(mark)
        return None

    @memoize
    def kwargs(self) -> Optional[List[ast.keyword | ast.Starred]]:
        # kwargs: ','.kwarg_or_starred+ ',' ','.kwarg_or_double_starred+ | ','.kwarg_or_starred+ | ','.kwarg_or_double_starred+
        mark = self._mark()
        if (
            (a := self._gather_229())
            and (self.expect(","))
            and (b := self._gather_231())
        ):
            return a + b
        self._reset(mark)
        if _gather_233 := self._gather_233():
            return _gather_233
        self._reset(mark)
        if _gather_235 := self._gather_235():
            return _gather_235
        self._reset(mark)
        return None

    @memoize
    def starred_expression(self) -> Optional[ast.Starred]:
        # starred_expression: invalid_starred_expression | '*' expression | '*'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_starred_expression()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (self.expect("*")) and (a := self.expression()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=a,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if self.expect("*"):
            return self.raise_syntax_error("Invalid star expression")
        self._reset(mark)
        return None

    @memoize
    def kwarg_or_starred(self) -> Optional[ast.keyword | ast.expr]:
        # kwarg_or_starred: invalid_kwarg | NAME '=' expression | starred_expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_kwarg()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (a := self.name()) and (self.expect("=")) and (b := self.expression()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.keyword(
                arg=a.string,
                value=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if a := self.starred_expression():
            return a
        self._reset(mark)
        return None

    @memoize
    def kwarg_or_double_starred(self) -> Optional[ast.keyword]:
        # kwarg_or_double_starred: invalid_kwarg | NAME '=' expression | '**' expression
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if self.call_invalid_rules and (self.invalid_kwarg()):
            return None  # pragma: no cover;
        self._reset(mark)
        if (a := self.name()) and (self.expect("=")) and (b := self.expression()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.keyword(
                arg=a.string,
                value=b,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("**")) and (a := self.expression()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.keyword(
                arg=None,
                value=a,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def star_targets(self) -> Optional[ast.Tuple]:
        # star_targets: star_target !',' | star_target ((',' star_target))* ','?
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.star_target()) and (self.negative_lookahead(self.expect, ",")):
            return a
        self._reset(mark)
        if (
            (a := self.star_target())
            and (b := self._loop0_237(),)
            and (self.expect(","),)
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=[a] + b,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def star_targets_list_seq(self) -> Optional[List[ast.expr]]:
        # star_targets_list_seq: ','.star_target_may_annot+ ','?
        mark = self._mark()
        if (a := self._gather_238()) and (self.expect(","),):
            return a
        self._reset(mark)
        return None

    @memoize
    def star_targets_tuple_seq(self) -> Optional[List[ast.expr]]:
        # star_targets_tuple_seq: star_target_may_annot ((',' star_target_may_annot))+ ','? | star_target_may_annot ','
        mark = self._mark()
        if (
            (a := self.star_target_may_annot())
            and (b := self._loop1_240())
            and (self.expect(","),)
        ):
            return [a] + b
        self._reset(mark)
        if (a := self.star_target_may_annot()) and (self.expect(",")):
            return [a]
        self._reset(mark)
        return None

    @memoize
    def star_target(
        self,
    ) -> Optional[
        ast.Starred | ast.Name | ast.Tuple | ast.List | ast.Attribute | ast.Subscript
    ]:
        # star_target: '*' (!'*' star_target) | target_with_star_atom
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (a := self._tmp_241()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=self.set_expr_context(a, Store),
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if target_with_star_atom := self.target_with_star_atom():
            return target_with_star_atom
        self._reset(mark)
        return None

    @memoize
    def star_target_may_annot(
        self,
    ) -> Optional[ast.Name | ast.Tuple | ast.List | ast.Attribute | ast.Subscript]:
        # star_target_may_annot: star_target annotation?
        mark = self._mark()
        if (a := self.star_target()) and (b := self.annotation(),):
            return set_type_annotation(a, b)
        self._reset(mark)
        return None

    @memoize
    def target_with_star_atom(
        self,
    ) -> Optional[ast.Name | ast.Tuple | ast.List | ast.Attribute | ast.Subscript]:
        # target_with_star_atom: t_primary '.' NAME !t_lookahead | t_primary '[' slices ']' !t_lookahead | star_atom
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.t_primary())
            and (self.expect("."))
            and (b := self.name())
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Attribute(
                value=a,
                attr=b.string,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (self.expect("["))
            and (b := self.slices())
            and (self.expect("]"))
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Subscript(
                value=a,
                slice=b,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if star_atom := self.star_atom():
            return star_atom
        self._reset(mark)
        return None

    @memoize
    def star_atom(
        self,
    ) -> Optional[ast.Name | ast.Tuple | ast.List | ast.Attribute | ast.Subscript]:
        # star_atom: NAME annotation? | '(' target_with_star_atom ')' | '(' star_targets_tuple_seq? ')' | '[' star_targets_list_seq? ']'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (a := self.name()) and (b := self.annotation(),):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return set_type_annotation(
                ast.Name(
                    id=a.string,
                    ctx=Store,
                    lineno=start_lineno,
                    col_offset=start_col_offset,
                    end_lineno=end_lineno,
                    end_col_offset=end_col_offset,
                ),
                b,
            )
        self._reset(mark)
        if (
            (self.expect("("))
            and (a := self.target_with_star_atom())
            and (self.expect(")"))
        ):
            return self.set_expr_context(a, Store)
        self._reset(mark)
        if (
            (self.expect("("))
            and (a := self.star_targets_tuple_seq(),)
            and (self.expect(")"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=a,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (self.expect("["))
            and (a := self.star_targets_list_seq(),)
            and (self.expect("]"))
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.List(
                elts=a,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def single_target(self) -> Optional[Any]:
        # single_target: single_subscript_attribute_target | NAME | '(' single_target ')'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            single_subscript_attribute_target
            := self.single_subscript_attribute_target()
        ):
            return single_subscript_attribute_target
        self._reset(mark)
        if a := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=a.string,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("(")) and (a := self.single_target()) and (self.expect(")")):
            return a
        self._reset(mark)
        return None

    @memoize
    def single_subscript_attribute_target(self) -> Optional[Any]:
        # single_subscript_attribute_target: t_primary '.' NAME !t_lookahead | t_primary '[' slices ']' !t_lookahead
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.t_primary())
            and (self.expect("."))
            and (b := self.name())
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Attribute(
                value=a,
                attr=b.string,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (self.expect("["))
            and (b := self.slices())
            and (self.expect("]"))
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Subscript(
                value=a,
                slice=b,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize_left_rec
    def t_primary(self) -> Optional[Any]:
        # t_primary: t_primary '.' NAME &t_lookahead | t_primary '[' slices ']' &t_lookahead | t_primary genexp &t_lookahead | t_primary '(' arguments? ')' &t_lookahead | atom &t_lookahead
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.t_primary())
            and (self.expect("."))
            and (b := self.name())
            and (
                self.positive_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Attribute(
                value=a,
                attr=b.string,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (self.expect("["))
            and (b := self.slices())
            and (self.expect("]"))
            and (
                self.positive_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Subscript(
                value=a,
                slice=b,
                ctx=Load,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (b := self.genexp())
            and (
                self.positive_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Call(
                func=a,
                args=[b],
                keywords=[],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (self.expect("("))
            and (b := self.arguments(),)
            and (self.expect(")"))
            and (
                self.positive_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Call(
                func=a,
                args=b[0] if b else [],
                keywords=b[1] if b else [],
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (a := self.atom()) and (
            self.positive_lookahead(
                self.t_lookahead,
            )
        ):
            return a
        self._reset(mark)
        return None

    @memoize
    def t_lookahead(self) -> Optional[Any]:
        # t_lookahead: '(' | '[' | '.'
        mark = self._mark()
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("["):
            return literal
        self._reset(mark)
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def del_targets(self) -> Optional[Any]:
        # del_targets: ','.del_target+ ','?
        mark = self._mark()
        if (a := self._gather_242()) and (self.expect(","),):
            return a
        self._reset(mark)
        return None

    @memoize
    def del_target(self) -> Optional[Any]:
        # del_target: t_primary '.' NAME !t_lookahead | t_primary '[' slices ']' !t_lookahead | del_t_atom
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (
            (a := self.t_primary())
            and (self.expect("."))
            and (b := self.name())
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Attribute(
                value=a,
                attr=b.string,
                ctx=Del,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (
            (a := self.t_primary())
            and (self.expect("["))
            and (b := self.slices())
            and (self.expect("]"))
            and (
                self.negative_lookahead(
                    self.t_lookahead,
                )
            )
        ):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Subscript(
                value=a,
                slice=b,
                ctx=Del,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if del_t_atom := self.del_t_atom():
            return del_t_atom
        self._reset(mark)
        return None

    @memoize
    def del_t_atom(self) -> Optional[Any]:
        # del_t_atom: NAME | '(' del_target ')' | '(' del_targets? ')' | '[' del_targets? ']'
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if a := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=a.string,
                ctx=Del,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("(")) and (a := self.del_target()) and (self.expect(")")):
            return self.set_expr_context(a, Del)
        self._reset(mark)
        if (self.expect("(")) and (a := self.del_targets(),) and (self.expect(")")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Tuple(
                elts=a,
                ctx=Del,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if (self.expect("[")) and (a := self.del_targets(),) and (self.expect("]")):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.List(
                elts=a,
                ctx=Del,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def decl_star_target(
        self,
    ) -> Optional[ast.Starred | ast.Name | ast.Tuple | ast.List]:
        # decl_star_target: '*' (!'*' decl_star_target) | decl_star_atom
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if (self.expect("*")) and (a := self._tmp_244()):
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Starred(
                value=self.set_expr_context(a, Store),
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        if decl_star_atom := self.decl_star_atom():
            return decl_star_atom
        self._reset(mark)
        return None

    @memoize
    def decl_star_atom(self) -> Optional[ast.Name | ast.Tuple | ast.List]:
        # decl_star_atom: NAME
        mark = self._mark()
        tok = self._tokenizer.peek()
        start_lineno, start_col_offset = tok.start
        if a := self.name():
            tok = self._tokenizer.get_last_non_whitespace_token()
            end_lineno, end_col_offset = tok.end
            return ast.Name(
                id=a.string,
                ctx=Store,
                lineno=start_lineno,
                col_offset=start_col_offset,
                end_lineno=end_lineno,
                end_col_offset=end_col_offset,
            )
        self._reset(mark)
        return None

    @memoize
    def decl_star_target_may_annot(self) -> Optional[ast.expr]:
        # decl_star_target_may_annot: decl_star_target annotation?
        mark = self._mark()
        if (a := self.decl_star_target()) and (b := self.annotation(),):
            return set_type_annotation(a, b)
        self._reset(mark)
        return None

    @memoize
    def type_expressions(self) -> Optional[List[ast.expr]]:
        # type_expressions: ','.expression+ ',' '*' expression ',' '**' expression | ','.expression+ ',' '*' expression | ','.expression+ ',' '**' expression | '*' expression ',' '**' expression | '*' expression | '**' expression | ','.expression+
        mark = self._mark()
        if (
            (a := self._gather_245())
            and (self.expect(","))
            and (self.expect("*"))
            and (b := self.expression())
            and (self.expect(","))
            and (self.expect("**"))
            and (c := self.expression())
        ):
            return a + [b, c]
        self._reset(mark)
        if (
            (a := self._gather_247())
            and (self.expect(","))
            and (self.expect("*"))
            and (b := self.expression())
        ):
            return a + [b]
        self._reset(mark)
        if (
            (a := self._gather_249())
            and (self.expect(","))
            and (self.expect("**"))
            and (b := self.expression())
        ):
            return a + [b]
        self._reset(mark)
        if (
            (self.expect("*"))
            and (a := self.expression())
            and (self.expect(","))
            and (self.expect("**"))
            and (b := self.expression())
        ):
            return [a, b]
        self._reset(mark)
        if (self.expect("*")) and (a := self.expression()):
            return [a]
        self._reset(mark)
        if (self.expect("**")) and (a := self.expression()):
            return [a]
        self._reset(mark)
        if a := self._gather_251():
            return a
        self._reset(mark)
        return None

    @memoize
    def func_type_comment(self) -> Optional[Any]:
        # func_type_comment: NEWLINE TYPE_COMMENT &(NEWLINE INDENT) | invalid_double_type_comments | TYPE_COMMENT
        mark = self._mark()
        if (
            (self.expect("NEWLINE"))
            and (t := self.type_comment())
            and (
                self.positive_lookahead(
                    self._tmp_253,
                )
            )
        ):
            return t.string
        self._reset(mark)
        if self.call_invalid_rules and (self.invalid_double_type_comments()):
            return None  # pragma: no cover;
        self._reset(mark)
        if type_comment := self.type_comment():
            return type_comment
        self._reset(mark)
        return None

    @memoize
    def invalid_arguments(self) -> Optional[NoReturn]:
        # invalid_arguments: ((','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) ',' ','.(starred_expression !'=')+ | expression for_if_clauses ',' [args | expression for_if_clauses] | NAME '=' expression for_if_clauses | [(args ',')] NAME '=' &(',' | ')') | args for_if_clauses | args ',' expression for_if_clauses | args ',' args
        mark = self._mark()
        if (self._tmp_254()) and (a := self.expect(",")) and (self._gather_255()):
            return self.raise_syntax_error_starting_from(
                "iterable argument unpacking follows keyword argument unpacking",
                a,
            )
        self._reset(mark)
        if (
            (a := self.expression())
            and (b := self.for_if_clauses())
            and (self.expect(","))
            and (self._tmp_257(),)
        ):
            return self.raise_syntax_error_known_range(
                "Generator expression must be parenthesized",
                a,
                (b[-1].ifs[-1] if b[-1].ifs else b[-1].iter),
            )
        self._reset(mark)
        if (
            (a := self.name())
            and (b := self.expect("="))
            and (self.expression())
            and (self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_range(
                "invalid syntax. Maybe you meant '==' or ':=' instead of '='?", a, b
            )
        self._reset(mark)
        if (
            (self._tmp_258(),)
            and (a := self.name())
            and (b := self.expect("="))
            and (
                self.positive_lookahead(
                    self._tmp_259,
                )
            )
        ):
            return self.raise_syntax_error_known_range(
                "expected argument value expression", a, b
            )
        self._reset(mark)
        if (a := self.args()) and (b := self.for_if_clauses()):
            return (
                self.raise_syntax_error_known_range(
                    "Generator expression must be parenthesized",
                    a[0][-1],
                    (b[-1].ifs[-1] if b[-1].ifs else b[-1].iter),
                )
                if len(a[0]) > 1
                else None
            )
        self._reset(mark)
        if (
            (self.args())
            and (self.expect(","))
            and (a := self.expression())
            and (b := self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_range(
                "Generator expression must be parenthesized",
                a,
                (b[-1].ifs[-1] if b[-1].ifs else b[-1].iter),
            )
        self._reset(mark)
        if (a := self.args()) and (self.expect(",")) and (self.args()):
            return self.raise_syntax_error(
                "positional argument follows keyword argument unpacking"
                if a[1][-1].arg is None
                else "positional argument follows keyword argument",
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_kwarg(self) -> Optional[NoReturn]:
        # invalid_kwarg: ('True' | 'False' | 'None') '=' | NAME '=' expression for_if_clauses | !(NAME '=') expression '=' | '**' expression '=' expression
        mark = self._mark()
        if (a := self._tmp_260()) and (b := self.expect("=")):
            return self.raise_syntax_error_known_range(
                f"cannot assign to {a.string}", a, b
            )
        self._reset(mark)
        if (
            (a := self.name())
            and (b := self.expect("="))
            and (self.expression())
            and (self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_range(
                "invalid syntax. Maybe you meant '==' or ':=' instead of '='?", a, b
            )
        self._reset(mark)
        if (
            (
                self.negative_lookahead(
                    self._tmp_261,
                )
            )
            and (a := self.expression())
            and (b := self.expect("="))
        ):
            return self.raise_syntax_error_known_range(
                'expression cannot contain assignment, perhaps you meant "=="?',
                a,
                b,
            )
        self._reset(mark)
        if (
            (a := self.expect("**"))
            and (self.expression())
            and (self.expect("="))
            and (b := self.expression())
        ):
            return self.raise_syntax_error_known_range(
                "cannot assign to keyword argument unpacking", a, b
            )
        self._reset(mark)
        return None

    @memoize
    def expression_without_invalid(self) -> Optional[ast.AST]:
        # expression_without_invalid: pipe_operator
        _prev_call_invalid = self.call_invalid_rules
        self.call_invalid_rules = False
        mark = self._mark()
        if pipe_operator := self.pipe_operator():
            self.call_invalid_rules = _prev_call_invalid
            return pipe_operator
        self._reset(mark)
        self.call_invalid_rules = _prev_call_invalid
        return None

    @memoize
    def invalid_expression(self) -> Optional[NoReturn]:
        # invalid_expression: !(NAME STRING | SOFT_KEYWORD) pipe_operator expression_without_invalid
        mark = self._mark()
        if (
            (
                self.negative_lookahead(
                    self._tmp_262,
                )
            )
            and (a := self.pipe_operator())
            and (b := self.expression_without_invalid())
        ):
            return (
                self.raise_syntax_error_known_range(
                    "invalid syntax. Perhaps you forgot a comma?", a, b
                )
                if not isinstance(a, ast.Name) or a.id not in ("print", "exec")
                else None
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_named_expression(self) -> Optional[NoReturn]:
        # invalid_named_expression: expression ':=' expression | NAME '=' bitwise_or !('=' | ':=') | !(list | tuple | genexp | 'True' | 'None' | 'False') bitwise_or '=' bitwise_or !('=' | ':=')
        mark = self._mark()
        if (a := self.expression()) and (self.expect(":=")) and (self.expression()):
            return self.raise_syntax_error_known_location(
                f"cannot use assignment expressions with {self.get_expr_name(a)}", a
            )
        self._reset(mark)
        if (
            (a := self.name())
            and (self.expect("="))
            and (b := self.bitwise_or())
            and (
                self.negative_lookahead(
                    self._tmp_263,
                )
            )
        ):
            return (
                None
                if self.in_recursive_rule
                else self.raise_syntax_error_known_range(
                    "invalid syntax. Maybe you meant '==' or ':=' instead of '='?", a, b
                )
            )
        self._reset(mark)
        if (
            (
                self.negative_lookahead(
                    self._tmp_264,
                )
            )
            and (a := self.bitwise_or())
            and (self.expect("="))
            and (self.bitwise_or())
            and (
                self.negative_lookahead(
                    self._tmp_265,
                )
            )
        ):
            return (
                None
                if self.in_recursive_rule
                else self.raise_syntax_error_known_location(
                    f"cannot assign to {self.get_expr_name(a)} here. Maybe you meant '==' instead of '='?",
                    a,
                )
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_assignment(self) -> Optional[NoReturn]:
        # invalid_assignment: invalid_ann_assign_target ':' expression | star_named_expression ',' star_named_expressions* ':' expression | expression ':' expression | ((star_targets '='))* star_expressions '=' | ((star_targets '='))* yield_expr '=' | star_expressions augassign (yield_expr | star_expressions)
        mark = self._mark()
        if (
            self.call_invalid_rules
            and (a := self.invalid_ann_assign_target())
            and (self.expect(":"))
            and (self.expression())
        ):
            return self.raise_syntax_error_known_location(
                f"only single target (not {self.get_expr_name(a)}) can be annotated", a
            )
        self._reset(mark)
        if (
            (a := self.star_named_expression())
            and (self.expect(","))
            and (self._loop0_266(),)
            and (self.expect(":"))
            and (self.expression())
        ):
            return self.raise_syntax_error_known_location(
                "only single target (not tuple) can be annotated", a
            )
        self._reset(mark)
        if (a := self.expression()) and (self.expect(":")) and (self.expression()):
            return self.raise_syntax_error_known_location(
                "illegal target for annotation", a
            )
        self._reset(mark)
        if (
            (self._loop0_267(),)
            and (a := self.star_expressions())
            and (self.expect("="))
        ):
            return self.raise_syntax_error_invalid_target(Target.STAR_TARGETS, a)
        self._reset(mark)
        if (self._loop0_268(),) and (a := self.yield_expr()) and (self.expect("=")):
            return self.raise_syntax_error_known_location(
                "assignment to yield expression not possible", a
            )
        self._reset(mark)
        if (a := self.star_expressions()) and (self.augassign()) and (self._tmp_269()):
            return self.raise_syntax_error_known_location(
                f"'{self.get_expr_name(a)}' is an illegal expression for augmented assignment",
                a,
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_ann_assign_target(self) -> Optional[ast.AST]:
        # invalid_ann_assign_target: list | tuple | '(' invalid_ann_assign_target ')'
        mark = self._mark()
        if a := self.list():
            return a
        self._reset(mark)
        if a := self.tuple():
            return a
        self._reset(mark)
        if (
            self.call_invalid_rules
            and (self.expect("("))
            and (a := self.invalid_ann_assign_target())
            and (self.expect(")"))
        ):
            return a
        self._reset(mark)
        return None

    @memoize
    def invalid_del_stmt(self) -> Optional[NoReturn]:
        # invalid_del_stmt: 'del' star_expressions
        mark = self._mark()
        if (self.expect("del")) and (a := self.star_expressions()):
            return self.raise_syntax_error_invalid_target(Target.DEL_TARGETS, a)
        self._reset(mark)
        return None

    @memoize
    def invalid_block(self) -> Optional[NoReturn]:
        # invalid_block: NEWLINE !INDENT
        mark = self._mark()
        if (self.expect("NEWLINE")) and (
            self.negative_lookahead(self.expect, "INDENT")
        ):
            return self.raise_indentation_error("expected an indented block")
        self._reset(mark)
        return None

    @memoize
    def invalid_comprehension(self) -> Optional[NoReturn]:
        # invalid_comprehension: ('[' | '(' | '{') starred_expression for_if_clauses | ('[' | '{') star_named_expression ',' star_named_expressions for_if_clauses | ('[' | '{') star_named_expression ',' for_if_clauses
        mark = self._mark()
        if (
            (self._tmp_270())
            and (a := self.starred_expression())
            and (self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_location(
                "iterable unpacking cannot be used in comprehension", a
            )
        self._reset(mark)
        if (
            (self._tmp_271())
            and (a := self.star_named_expression())
            and (self.expect(","))
            and (b := self.star_named_expressions())
            and (self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_range(
                "did you forget parentheses around the comprehension target?", a, b[-1]
            )
        self._reset(mark)
        if (
            (self._tmp_272())
            and (a := self.star_named_expression())
            and (b := self.expect(","))
            and (self.for_if_clauses())
        ):
            return self.raise_syntax_error_known_range(
                "did you forget parentheses around the comprehension target?", a, b
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_dict_comprehension(self) -> Optional[NoReturn]:
        # invalid_dict_comprehension: '{' '**' bitwise_or for_if_clauses '}'
        mark = self._mark()
        if (
            (self.expect("{"))
            and (a := self.expect("**"))
            and (self.bitwise_or())
            and (self.for_if_clauses())
            and (self.expect("}"))
        ):
            return self.raise_syntax_error_known_location(
                "dict unpacking cannot be used in dict comprehension", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_parameters(self) -> Optional[NoReturn]:
        # invalid_parameters: "/" ',' | (slash_no_default | slash_with_default) param_maybe_default* '/' | slash_no_default? param_no_default* invalid_parameters_helper param_no_default | [(slash_no_default | slash_with_default)] param_maybe_default* '*' (',' | param_no_default) param_maybe_default* '/' | param_maybe_default+ '/' '*'
        mark = self._mark()
        if (a := self.expect("/")) and (self.expect(",")):
            return self.raise_syntax_error_known_location(
                "at least one argument must precede /", a
            )
        self._reset(mark)
        if (self._tmp_273()) and (self._loop0_274(),) and (a := self.expect("/")):
            return self.raise_syntax_error_known_location("/ may appear only once", a)
        self._reset(mark)
        if (
            self.call_invalid_rules
            and (self.slash_no_default(),)
            and (self._loop0_275(),)
            and (self.invalid_parameters_helper())
            and (a := self.param_no_default())
        ):
            return self.raise_syntax_error_known_location(
                "parameter without a default follows parameter with a default", a
            )
        self._reset(mark)
        if (
            (self._tmp_276(),)
            and (self._loop0_277(),)
            and (self.expect("*"))
            and (self._tmp_278())
            and (self._loop0_279(),)
            and (a := self.expect("/"))
        ):
            return self.raise_syntax_error_known_location("/ must be ahead of *", a)
        self._reset(mark)
        if (self._loop1_280()) and (self.expect("/")) and (a := self.expect("*")):
            return self.raise_syntax_error_known_location(
                "expected comma between / and *", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_default(self) -> Optional[Any]:
        # invalid_default: '=' &(')' | ',')
        mark = self._mark()
        if (a := self.expect("=")) and (
            self.positive_lookahead(
                self._tmp_281,
            )
        ):
            return self.raise_syntax_error_known_location(
                "expected default value expression", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_star_etc(self) -> Optional[Any]:
        # invalid_star_etc: '*' (')' | ',' (')' | '**')) | '*' ',' TYPE_COMMENT | '*' param '=' | '*' (param_no_default | ',') param_maybe_default* '*' (param_no_default | ',')
        mark = self._mark()
        if (a := self.expect("*")) and (self._tmp_282()):
            return self.raise_syntax_error_known_location(
                "named arguments must follow bare *", a
            )
        self._reset(mark)
        if (self.expect("*")) and (self.expect(",")) and (self.type_comment()):
            return self.raise_syntax_error("bare * has associated type comment")
        self._reset(mark)
        if (self.expect("*")) and (self.param()) and (a := self.expect("=")):
            return self.raise_syntax_error_known_location(
                "var-positional argument cannot have default value", a
            )
        self._reset(mark)
        if (
            (self.expect("*"))
            and (self._tmp_283())
            and (self._loop0_284(),)
            and (a := self.expect("*"))
            and (self._tmp_285())
        ):
            return self.raise_syntax_error_known_location(
                "* argument may appear only once", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_kwds(self) -> Optional[Any]:
        # invalid_kwds: '**' param '=' | '**' param ',' param | '**' param ',' ('*' | '**' | '/')
        mark = self._mark()
        if (self.expect("**")) and (self.param()) and (a := self.expect("=")):
            return self.raise_syntax_error_known_location(
                "var-keyword argument cannot have default value", a
            )
        self._reset(mark)
        if (
            (self.expect("**"))
            and (self.param())
            and (self.expect(","))
            and (a := self.param())
        ):
            return self.raise_syntax_error_known_location(
                "arguments cannot follow var-keyword argument", a
            )
        self._reset(mark)
        if (
            (self.expect("**"))
            and (self.param())
            and (self.expect(","))
            and (a := self._tmp_286())
        ):
            return self.raise_syntax_error_known_location(
                "arguments cannot follow var-keyword argument", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_parameters_helper(self) -> Optional[Any]:
        # invalid_parameters_helper: slash_with_default | param_with_default+
        mark = self._mark()
        if a := self.slash_with_default():
            return [a]
        self._reset(mark)
        if a := self._loop1_287():
            return a
        self._reset(mark)
        return None

    @memoize
    def invalid_double_type_comments(self) -> Optional[NoReturn]:
        # invalid_double_type_comments: TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT
        mark = self._mark()
        if (
            (self.type_comment())
            and (self.expect("NEWLINE"))
            and (self.type_comment())
            and (self.expect("NEWLINE"))
            and (self.expect("INDENT"))
        ):
            return self.raise_syntax_error("Cannot have two type comments on def")
        self._reset(mark)
        return None

    @memoize
    def invalid_with_item(self) -> Optional[NoReturn]:
        # invalid_with_item: expression 'as' expression &(',' | ')' | ':')
        mark = self._mark()
        if (
            (self.expression())
            and (self.expect("as"))
            and (a := self.expression())
            and (
                self.positive_lookahead(
                    self._tmp_288,
                )
            )
        ):
            return self.raise_syntax_error_invalid_target(Target.STAR_TARGETS, a)
        self._reset(mark)
        return None

    @memoize
    def invalid_for_target(self) -> Optional[NoReturn]:
        # invalid_for_target: 'async'? 'for' star_expressions
        mark = self._mark()
        if (
            (self.expect("async"),)
            and (self.expect("for"))
            and (a := self.star_expressions())
        ):
            return self.raise_syntax_error_invalid_target(Target.FOR_TARGETS, a)
        self._reset(mark)
        return None

    @memoize
    def invalid_group(self) -> Optional[NoReturn]:
        # invalid_group: '(' starred_expression ')' | '(' '**' expression ')'
        mark = self._mark()
        if (
            (self.expect("("))
            and (a := self.starred_expression())
            and (self.expect(")"))
        ):
            return self.raise_syntax_error_known_location(
                "cannot use starred expression here", a
            )
        self._reset(mark)
        if (
            (self.expect("("))
            and (a := self.expect("**"))
            and (self.expression())
            and (self.expect(")"))
        ):
            return self.raise_syntax_error_known_location(
                "cannot use double starred expression here", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_import(self) -> Optional[Any]:
        # invalid_import: 'import' ','.dotted_name+ 'from' dotted_name
        mark = self._mark()
        if (
            (a := self.expect("import"))
            and (self._gather_289())
            and (self.expect("from"))
            and (self.dotted_name())
        ):
            return self.raise_syntax_error_starting_from(
                "Did you mean to use 'from ... import ...' instead?", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_import_from_targets(self) -> Optional[NoReturn]:
        # invalid_import_from_targets: import_from_as_names ',' NEWLINE
        mark = self._mark()
        if (
            (self.import_from_as_names())
            and (self.expect(","))
            and (self.expect("NEWLINE"))
        ):
            return self.raise_syntax_error(
                "trailing comma not allowed without surrounding parentheses"
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_with_stmt(self) -> Optional[None]:
        # invalid_with_stmt: 'async'? 'with' !('(' | decl_keyword) | 'async'? 'with' '(' with_item ')' NEWLINE* !'{'
        mark = self._mark()
        if (
            (self.expect("async"),)
            and (self.expect("with"))
            and (
                self.negative_lookahead(
                    self._tmp_291,
                )
            )
        ):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("async"),)
            and (self.expect("with"))
            and (self.expect("("))
            and (self.with_item())
            and (self.expect(")"))
            and (self._loop0_292(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_try_stmt(self) -> Optional[NoReturn]:
        # invalid_try_stmt: 'try' !'{' | 'try' block !('except' | 'finally') | 'try' block* except_block+ 'except' '*' | 'try' block* except_star_block+ 'except'
        mark = self._mark()
        if (self.expect("try")) and (self.negative_lookahead(self.expect, "{")):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("try"))
            and (self.block())
            and (
                self.negative_lookahead(
                    self._tmp_293,
                )
            )
        ):
            return self.raise_syntax_error("expected 'except' or 'finally' block")
        self._reset(mark)
        if (
            (self.expect("try"))
            and (self._loop0_294(),)
            and (self._loop1_295())
            and (a := self.expect("except"))
            and (b := self.expect("*"))
        ):
            return self.raise_syntax_error_known_range(
                "cannot have both 'except' and 'except*' on the same 'try'", a, b
            )
        self._reset(mark)
        if (
            (self.expect("try"))
            and (self._loop0_296(),)
            and (self._loop1_297())
            and (a := self.expect("except"))
        ):
            return self.raise_syntax_error_known_location(
                "cannot have both 'except' and 'except*' on the same 'try'", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_except_stmt(self) -> Optional[None]:
        # invalid_except_stmt: 'except' '*'? '(' expression ',' expressions ['as' NAME] ')' | 'except' '*'? '(' expression ['as' NAME] ')' NEWLINE* !'{' | 'except' '*'? !('{' | '(') | 'except' '*' NEWLINE* '{'
        mark = self._mark()
        if (
            (self.expect("except"))
            and (self.expect("*"),)
            and (self.expect("("))
            and (a := self.expression())
            and (self.expect(","))
            and (self.expressions())
            and (self._tmp_298(),)
            and (self.expect(")"))
        ):
            return self.raise_syntax_error_starting_from(
                "multiple exception types must be parenthesized", a
            )
        self._reset(mark)
        if (
            (self.expect("except"))
            and (self.expect("*"),)
            and (self.expect("("))
            and (self.expression())
            and (self._tmp_299(),)
            and (self.expect(")"))
            and (self._loop0_300(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("except"))
            and (self.expect("*"),)
            and (
                self.negative_lookahead(
                    self._tmp_301,
                )
            )
        ):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("except"))
            and (self.expect("*"))
            and (self._loop0_302(),)
            and (self.expect("{"))
        ):
            return self.raise_syntax_error("expected one or more exception types")
        self._reset(mark)
        return None

    @memoize
    def invalid_finally_stmt(self) -> Optional[NoReturn]:
        # invalid_finally_stmt: 'finally' !'{'
        mark = self._mark()
        if (self.expect("finally")) and (self.negative_lookahead(self.expect, "{")):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_match_stmt(self) -> Optional[NoReturn]:
        # invalid_match_stmt: "match" !'(' | "match" '(' subject_expr ')' NEWLINE* !'{'
        mark = self._mark()
        if (self.expect("match")) and (self.negative_lookahead(self.expect, "(")):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("match"))
            and (self.expect("("))
            and (self.subject_expr())
            and (self.expect(")"))
            and (self._loop0_303(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_case_block(self) -> Optional[NoReturn]:
        # invalid_case_block: "case" !'(' | "case" '(' patterns ')' NEWLINE* guard? NEWLINE* !'{'
        mark = self._mark()
        if (self.expect("case")) and (self.negative_lookahead(self.expect, "(")):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("case"))
            and (self.expect("("))
            and (self.patterns())
            and (self.expect(")"))
            and (self._loop0_304(),)
            and (self.guard(),)
            and (self._loop0_305(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_as_pattern(self) -> Optional[NoReturn]:
        # invalid_as_pattern: or_pattern 'as' "_" | or_pattern 'as' !NAME
        mark = self._mark()
        if (self.or_pattern()) and (self.expect("as")) and (a := self.expect("_")):
            return self.raise_syntax_error_known_location(
                "cannot use '_' as a target of as pattern", a
            )
        self._reset(mark)
        if (
            (self.or_pattern())
            and (self.expect("as"))
            and (
                self.negative_lookahead(
                    self.name,
                )
            )
        ):
            return self.raise_syntax_error("invalid as pattern target")
        self._reset(mark)
        return None

    @memoize
    def invalid_class_pattern(self) -> Optional[NoReturn]:
        # invalid_class_pattern: name_or_attr '(' invalid_class_argument_pattern
        mark = self._mark()
        if (
            self.call_invalid_rules
            and (self.name_or_attr())
            and (self.expect("("))
            and (a := self.invalid_class_argument_pattern())
        ):
            return self.raise_syntax_error_known_range(
                "positional patterns follow keyword patterns", a[0], a[-1]
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_class_argument_pattern(self) -> Optional[List[ast.pattern]]:
        # invalid_class_argument_pattern: [positional_patterns ','] keyword_patterns ',' positional_patterns
        mark = self._mark()
        if (
            (self._tmp_306(),)
            and (self.keyword_patterns())
            and (self.expect(","))
            and (a := self.positional_patterns())
        ):
            return a
        self._reset(mark)
        return None

    @memoize
    def invalid_if_stmt(self) -> Optional[NoReturn]:
        # invalid_if_stmt: 'if' !'(' | 'if' '(' named_expression ')' NEWLINE* !'{' | 'if' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* !'{'
        mark = self._mark()
        if (self.expect("if")) and (self.negative_lookahead(self.expect, "(")):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.named_expression())
            and (self.expect(")"))
            and (self._loop0_307(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (self.expect("let"))
            and (self._gather_308())
            and (self._tmp_310(),)
            and (self.expect(")"))
            and (self._loop0_311(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_elif_stmt(self) -> Optional[NoReturn]:
        # invalid_elif_stmt: 'elif' !'(' | 'elif' '(' named_expression ')' NEWLINE* !'{' | 'elif' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* !'{'
        mark = self._mark()
        if (self.expect("elif")) and (self.negative_lookahead(self.expect, "(")):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.named_expression())
            and (self.expect(")"))
            and (self._loop0_312(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("elif"))
            and (self.expect("("))
            and (self.expect("let"))
            and (self._gather_313())
            and (self._tmp_315(),)
            and (self.expect(")"))
            and (self._loop0_316(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_else_stmt(self) -> Optional[NoReturn]:
        # invalid_else_stmt: 'else' NEWLINE* !'{'
        mark = self._mark()
        if (
            (self.expect("else"))
            and (self._loop0_317(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_while_stmt(self) -> Optional[NoReturn]:
        # invalid_while_stmt: 'while' !'(' | 'while' '(' named_expression ')' NEWLINE* !'{' | 'while' '(' 'let' ','.pattern_assignment+ [';' named_expression] ')' NEWLINE* !'{'
        mark = self._mark()
        if (self.expect("while")) and (self.negative_lookahead(self.expect, "(")):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (self.named_expression())
            and (self.expect(")"))
            and (self._loop0_318(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("while"))
            and (self.expect("("))
            and (self.expect("let"))
            and (self._gather_319())
            and (self._tmp_321(),)
            and (self.expect(")"))
            and (self._loop0_322(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_for_stmt(self) -> Optional[NoReturn]:
        # invalid_for_stmt: 'async'? 'for' !'('
        mark = self._mark()
        if (
            (self.expect("async"),)
            and (self.expect("for"))
            and (self.negative_lookahead(self.expect, "("))
        ):
            return self.raise_syntax_error("expected '('")
        self._reset(mark)
        return None

    @memoize
    def invalid_def_raw(self) -> Optional[NoReturn]:
        # invalid_def_raw: 'async'? 'def' NAME type_params? '(' params? ')' '->' expression NEWLINE* !'{' | 'async'? 'def' NAME type_params? '(' params? ')' ':' | 'async'? 'def' NAME type_params? '(' params? ')' !('{' | '->')
        mark = self._mark()
        if (
            (self.expect("async"),)
            and (self.expect("def"))
            and (self.name())
            and (self.type_params(),)
            and (self.expect("("))
            and (self.params(),)
            and (self.expect(")"))
            and (self.expect("->"))
            and (self.expression())
            and (self._loop0_323(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        if (
            (self.expect("async"),)
            and (self.expect("def"))
            and (self.name())
            and (self.type_params(),)
            and (self.expect("("))
            and (self.params(),)
            and (self.expect(")"))
            and (self.expect(":"))
        ):
            return self.raise_syntax_error("use '->' for function return type")
        self._reset(mark)
        if (
            (self.expect("async"),)
            and (self.expect("def"))
            and (self.name())
            and (self.type_params(),)
            and (self.expect("("))
            and (self.params(),)
            and (self.expect(")"))
            and (
                self.negative_lookahead(
                    self._tmp_324,
                )
            )
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_class_def_raw(self) -> Optional[NoReturn]:
        # invalid_class_def_raw: 'class' NAME type_params? ['(' arguments? ')'] NEWLINE* !'{'
        mark = self._mark()
        if (
            (self.expect("class"))
            and (self.name())
            and (self.type_params(),)
            and (self._tmp_325(),)
            and (self._loop0_326(),)
            and (self.negative_lookahead(self.expect, "{"))
        ):
            return self.raise_syntax_error("expected '{'")
        self._reset(mark)
        return None

    @memoize
    def invalid_double_starred_kvpairs(self) -> Optional[None]:
        # invalid_double_starred_kvpairs: ','.double_starred_kvpair+ ',' invalid_kvpair | expression ':' '*' bitwise_or | expression ':' &('}' | ',')
        mark = self._mark()
        if (
            self.call_invalid_rules
            and (self._gather_327())
            and (self.expect(","))
            and (self.invalid_kvpair())
        ):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expression())
            and (self.expect(":"))
            and (a := self.expect("*"))
            and (self.bitwise_or())
        ):
            return self.raise_syntax_error_starting_from(
                "cannot use a starred expression in a dictionary value", a
            )
        self._reset(mark)
        if (
            (self.expression())
            and (a := self.expect(":"))
            and (
                self.positive_lookahead(
                    self._tmp_329,
                )
            )
        ):
            return self.raise_syntax_error_known_location(
                "expression expected after dictionary key and ':'", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_kvpair(self) -> Optional[None]:
        # invalid_kvpair: expression !(':') | expression ':' '*' bitwise_or | expression ':' &('}' | ',') | expression ':'
        mark = self._mark()
        if (a := self.expression()) and (self.negative_lookahead(self.expect, ":")):
            return self.raise_raw_syntax_error(
                "':' expected after dictionary key",
                (a.lineno, a.col_offset),
                (a.end_lineno, a.end_col_offset),
            )
        self._reset(mark)
        if (
            (self.expression())
            and (self.expect(":"))
            and (a := self.expect("*"))
            and (self.bitwise_or())
        ):
            return self.raise_syntax_error_starting_from(
                "cannot use a starred expression in a dictionary value", a
            )
        self._reset(mark)
        if (
            (self.expression())
            and (a := self.expect(":"))
            and (
                self.positive_lookahead(
                    self._tmp_330,
                )
            )
        ):
            return self.raise_syntax_error_known_location(
                "expression expected after dictionary key and ':'", a
            )
        self._reset(mark)
        if (self.expression()) and (a := self.expect(":")):
            return self.raise_syntax_error_known_location(
                "expression expected after dictionary key and ':'", a
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_starred_expression(self) -> Optional[Any]:
        # invalid_starred_expression: '*' expression '=' expression
        mark = self._mark()
        if (
            (a := self.expect("*"))
            and (self.expression())
            and (self.expect("="))
            and (b := self.expression())
        ):
            return self.raise_syntax_error_known_range(
                "cannot assign to iterable argument unpacking", a, b
            )
        self._reset(mark)
        return None

    @memoize
    def invalid_replacement_field(self) -> Optional[Any]:
        # invalid_replacement_field: '{' '=' | '{' '!' | '{' ':' | '{' '}' | '{' !(yield_expr | star_expressions) | '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}') | '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}') | '{' (yield_expr | star_expressions) '='? invalid_conversion_character | '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}') | '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' fstring_format_spec* !'}' | '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}'
        mark = self._mark()
        if (self.expect("{")) and (a := self.expect("=")):
            return self.raise_syntax_error_known_location(
                "f-string: valid expression required before '='", a
            )
        self._reset(mark)
        if (self.expect("{")) and (a := self.expect("!")):
            return self.raise_syntax_error_known_location(
                "f-string: valid expression required before '!'", a
            )
        self._reset(mark)
        if (self.expect("{")) and (a := self.expect(":")):
            return self.raise_syntax_error_known_location(
                "f-string: valid expression required before ':'", a
            )
        self._reset(mark)
        if (self.expect("{")) and (a := self.expect("}")):
            return self.raise_syntax_error_known_location(
                "f-string: valid expression required before '}'", a
            )
        self._reset(mark)
        if (self.expect("{")) and (
            self.negative_lookahead(
                self._tmp_331,
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: expecting a valid expression after '{'"
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (self._tmp_332())
            and (
                self.negative_lookahead(
                    self._tmp_333,
                )
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: expecting '=', or '!', or ':', or '}'"
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (self._tmp_334())
            and (self.expect("="))
            and (
                self.negative_lookahead(
                    self._tmp_335,
                )
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: expecting '!', or ':', or '}'"
            )
        self._reset(mark)
        if (
            self.call_invalid_rules
            and (self.expect("{"))
            and (self._tmp_336())
            and (self.expect("="),)
            and (self.invalid_conversion_character())
        ):
            return None  # pragma: no cover;
        self._reset(mark)
        if (
            (self.expect("{"))
            and (self._tmp_337())
            and (self.expect("="),)
            and (self._tmp_338(),)
            and (
                self.negative_lookahead(
                    self._tmp_339,
                )
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: expecting ':' or '}'"
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (self._tmp_340())
            and (self.expect("="),)
            and (self._tmp_341(),)
            and (self.expect(":"))
            and (self._loop0_342(),)
            and (self.negative_lookahead(self.expect, "}"))
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: expecting '}', or format specs"
            )
        self._reset(mark)
        if (
            (self.expect("{"))
            and (self._tmp_343())
            and (self.expect("="),)
            and (self._tmp_344(),)
            and (self.negative_lookahead(self.expect, "}"))
        ):
            return self.raise_syntax_error_on_next_token("f-string: expecting '}'")
        self._reset(mark)
        return None

    @memoize
    def invalid_conversion_character(self) -> Optional[Any]:
        # invalid_conversion_character: '!' &(':' | '}') | '!' !NAME
        mark = self._mark()
        if (self.expect("!")) and (
            self.positive_lookahead(
                self._tmp_345,
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: missing conversion character"
            )
        self._reset(mark)
        if (self.expect("!")) and (
            self.negative_lookahead(
                self.name,
            )
        ):
            return self.raise_syntax_error_on_next_token(
                "f-string: invalid conversion character"
            )
        self._reset(mark)
        return None

    @memoize
    def _loop0_1(self) -> Optional[Any]:
        # _loop0_1: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_2(self) -> Optional[Any]:
        # _loop0_2: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_3(self) -> Optional[Any]:
        # _loop0_3: fstring_mid
        mark = self._mark()
        children = []
        while fstring_mid := self.fstring_mid():
            children.append(fstring_mid)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_4(self) -> Optional[Any]:
        # _loop0_4: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_5(self) -> Optional[Any]:
        # _loop0_5: statement
        mark = self._mark()
        children = []
        while statement := self.statement():
            children.append(statement)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_6(self) -> Optional[Any]:
        # _loop0_6: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_7(self) -> Optional[Any]:
        # _loop0_7: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_8(self) -> Optional[Any]:
        # _loop0_8: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_10(self) -> Optional[Any]:
        # _loop0_10: DELIMITER simple_stmt
        mark = self._mark()
        children = []
        while (self.DELIMITER()) and (elem := self.simple_stmt()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_9(self) -> Optional[Any]:
        # _gather_9: simple_stmt _loop0_10
        mark = self._mark()
        if (elem := self.simple_stmt()) is not None and (
            seq := self._loop0_10()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_11(self) -> Optional[Any]:
        # _tmp_11: 'import' | 'from'
        mark = self._mark()
        if literal := self.expect("import"):
            return literal
        self._reset(mark)
        if literal := self.expect("from"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_12(self) -> Optional[Any]:
        # _tmp_12: 'let' | 'var'
        mark = self._mark()
        if literal := self.expect("let"):
            return literal
        self._reset(mark)
        if literal := self.expect("var"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_13(self) -> Optional[Any]:
        # _tmp_13: 'def' | '@' | 'async' | 'static'
        mark = self._mark()
        if literal := self.expect("def"):
            return literal
        self._reset(mark)
        if literal := self.expect("@"):
            return literal
        self._reset(mark)
        if literal := self.expect("async"):
            return literal
        self._reset(mark)
        if literal := self.expect("static"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_14(self) -> Optional[Any]:
        # _tmp_14: 'class' | '@'
        mark = self._mark()
        if literal := self.expect("class"):
            return literal
        self._reset(mark)
        if literal := self.expect("@"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_15(self) -> Optional[Any]:
        # _tmp_15: 'with' | 'async'
        mark = self._mark()
        if literal := self.expect("with"):
            return literal
        self._reset(mark)
        if literal := self.expect("async"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_16(self) -> Optional[Any]:
        # _tmp_16: 'for' | 'async'
        mark = self._mark()
        if literal := self.expect("for"):
            return literal
        self._reset(mark)
        if literal := self.expect("async"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_17(self) -> Optional[Any]:
        # _tmp_17: 'with' | 'async'
        mark = self._mark()
        if literal := self.expect("with"):
            return literal
        self._reset(mark)
        if literal := self.expect("async"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_18(self) -> Optional[Any]:
        # _tmp_18: '=' annotated_rhs
        mark = self._mark()
        if (self.expect("=")) and (d := self.annotated_rhs()):
            return d
        self._reset(mark)
        return None

    @memoize
    def _tmp_19(self) -> Optional[Any]:
        # _tmp_19: '(' single_target ')' | single_subscript_attribute_target
        mark = self._mark()
        if (self.expect("(")) and (b := self.single_target()) and (self.expect(")")):
            return b
        self._reset(mark)
        if (
            single_subscript_attribute_target
            := self.single_subscript_attribute_target()
        ):
            return single_subscript_attribute_target
        self._reset(mark)
        return None

    @memoize
    def _tmp_20(self) -> Optional[Any]:
        # _tmp_20: '=' annotated_rhs
        mark = self._mark()
        if (self.expect("=")) and (d := self.annotated_rhs()):
            return d
        self._reset(mark)
        return None

    @memoize
    def _loop1_21(self) -> Optional[Any]:
        # _loop1_21: (star_targets '=')
        mark = self._mark()
        children = []
        while _tmp_346 := self._tmp_346():
            children.append(_tmp_346)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_22(self) -> Optional[Any]:
        # _tmp_22: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_23(self) -> Optional[Any]:
        # _tmp_23: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _loop0_25(self) -> Optional[Any]:
        # _loop0_25: ',' declaration_single_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.declaration_single_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_24(self) -> Optional[Any]:
        # _gather_24: declaration_single_assignment _loop0_25
        mark = self._mark()
        if (elem := self.declaration_single_assignment()) is not None and (
            seq := self._loop0_25()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_27(self) -> Optional[Any]:
        # _loop0_27: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_26(self) -> Optional[Any]:
        # _gather_26: pattern_assignment _loop0_27
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_27()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_28(self) -> Optional[Any]:
        # _tmp_28: 'else' block
        mark = self._mark()
        if (self.expect("else")) and (b := self.block()):
            return b
        self._reset(mark)
        return None

    @memoize
    def _tmp_29(self) -> Optional[Any]:
        # _tmp_29: '=' annotated_rhs
        mark = self._mark()
        if (self.expect("=")) and (d := self.annotated_rhs()):
            return d
        self._reset(mark)
        return None

    @memoize
    def _tmp_30(self) -> Optional[Any]:
        # _tmp_30: 'from' expression
        mark = self._mark()
        if (self.expect("from")) and (z := self.expression()):
            return z
        self._reset(mark)
        return None

    @memoize
    def _loop0_32(self) -> Optional[Any]:
        # _loop0_32: ',' NAME
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.name()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_31(self) -> Optional[Any]:
        # _gather_31: NAME _loop0_32
        mark = self._mark()
        if (elem := self.name()) is not None and (seq := self._loop0_32()) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_34(self) -> Optional[Any]:
        # _loop0_34: ',' NAME
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.name()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_33(self) -> Optional[Any]:
        # _gather_33: NAME _loop0_34
        mark = self._mark()
        if (elem := self.name()) is not None and (seq := self._loop0_34()) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_35(self) -> Optional[Any]:
        # _tmp_35: ';' | NEWLINE
        mark = self._mark()
        if literal := self.expect(";"):
            return literal
        self._reset(mark)
        if _newline := self.expect("NEWLINE"):
            return _newline
        self._reset(mark)
        return None

    @memoize
    def _tmp_36(self) -> Optional[Any]:
        # _tmp_36: ',' expression
        mark = self._mark()
        if (self.expect(",")) and (z := self.expression()):
            return z
        self._reset(mark)
        return None

    @memoize
    def _loop0_37(self) -> Optional[Any]:
        # _loop0_37: ('.' | '...')
        mark = self._mark()
        children = []
        while _tmp_347 := self._tmp_347():
            children.append(_tmp_347)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_38(self) -> Optional[Any]:
        # _loop1_38: ('.' | '...')
        mark = self._mark()
        children = []
        while _tmp_348 := self._tmp_348():
            children.append(_tmp_348)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_40(self) -> Optional[Any]:
        # _loop0_40: ',' import_from_as_name
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.import_from_as_name()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_39(self) -> Optional[Any]:
        # _gather_39: import_from_as_name _loop0_40
        mark = self._mark()
        if (elem := self.import_from_as_name()) is not None and (
            seq := self._loop0_40()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_41(self) -> Optional[Any]:
        # _tmp_41: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_43(self) -> Optional[Any]:
        # _loop0_43: ',' dotted_as_name
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.dotted_as_name()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_42(self) -> Optional[Any]:
        # _gather_42: dotted_as_name _loop0_43
        mark = self._mark()
        if (elem := self.dotted_as_name()) is not None and (
            seq := self._loop0_43()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_44(self) -> Optional[Any]:
        # _tmp_44: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_45(self) -> Optional[Any]:
        # _loop0_45: statements
        mark = self._mark()
        children = []
        while statements := self.statements():
            children.append(statements)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_46(self) -> Optional[Any]:
        # _loop1_46: decorator
        mark = self._mark()
        children = []
        while decorator := self.decorator():
            children.append(decorator)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_47(self) -> Optional[Any]:
        # _tmp_47: '@' dec_maybe_call NEWLINE
        mark = self._mark()
        if (
            (self.expect("@"))
            and (f := self.dec_maybe_call())
            and (self.expect("NEWLINE"))
        ):
            return f
        self._reset(mark)
        return None

    @memoize
    def _tmp_48(self) -> Optional[Any]:
        # _tmp_48: '@' named_expression NEWLINE
        mark = self._mark()
        if (
            (self.expect("@"))
            and (f := self.named_expression())
            and (self.expect("NEWLINE"))
        ):
            return f
        self._reset(mark)
        return None

    @memoize
    def _tmp_49(self) -> Optional[Any]:
        # _tmp_49: '(' | '?('
        mark = self._mark()
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("?("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_50(self) -> Optional[Any]:
        # _tmp_50: '.' | '?.'
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("?."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_51(self) -> Optional[Any]:
        # _tmp_51: '(' arguments? ')'
        mark = self._mark()
        if (self.expect("(")) and (z := self.arguments(),) and (self.expect(")")):
            return z
        self._reset(mark)
        return None

    @memoize
    def _loop0_52(self) -> Optional[Any]:
        # _loop0_52: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_53(self) -> Optional[Any]:
        # _loop0_53: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_54(self) -> Optional[Any]:
        # _loop0_54: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_55(self) -> Optional[Any]:
        # _loop0_55: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_56(self) -> Optional[Any]:
        # _loop0_56: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_57(self) -> Optional[Any]:
        # _loop1_57: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_58(self) -> Optional[Any]:
        # _loop0_58: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_59(self) -> Optional[Any]:
        # _loop1_59: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_60(self) -> Optional[Any]:
        # _loop1_60: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_61(self) -> Optional[Any]:
        # _loop1_61: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_62(self) -> Optional[Any]:
        # _loop0_62: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_63(self) -> Optional[Any]:
        # _loop1_63: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_64(self) -> Optional[Any]:
        # _loop0_64: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_65(self) -> Optional[Any]:
        # _loop1_65: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_66(self) -> Optional[Any]:
        # _loop0_66: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_67(self) -> Optional[Any]:
        # _loop0_67: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_68(self) -> Optional[Any]:
        # _loop1_68: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_69(self) -> Optional[Any]:
        # _loop0_69: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_70(self) -> Optional[Any]:
        # _loop0_70: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_72(self) -> Optional[Any]:
        # _loop0_72: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_71(self) -> Optional[Any]:
        # _gather_71: pattern_assignment _loop0_72
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_72()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_73(self) -> Optional[Any]:
        # _tmp_73: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_74(self) -> Optional[Any]:
        # _loop0_74: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_76(self) -> Optional[Any]:
        # _loop0_76: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_75(self) -> Optional[Any]:
        # _gather_75: pattern_assignment _loop0_76
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_76()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_77(self) -> Optional[Any]:
        # _tmp_77: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_78(self) -> Optional[Any]:
        # _loop0_78: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_79(self) -> Optional[Any]:
        # _loop0_79: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_80(self) -> Optional[Any]:
        # _loop0_80: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_82(self) -> Optional[Any]:
        # _loop0_82: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_81(self) -> Optional[Any]:
        # _gather_81: pattern_assignment _loop0_82
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_82()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_83(self) -> Optional[Any]:
        # _tmp_83: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_84(self) -> Optional[Any]:
        # _loop0_84: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_86(self) -> Optional[Any]:
        # _loop0_86: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_85(self) -> Optional[Any]:
        # _gather_85: pattern_assignment _loop0_86
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_86()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_87(self) -> Optional[Any]:
        # _tmp_87: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_88(self) -> Optional[Any]:
        # _loop0_88: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_89(self) -> Optional[Any]:
        # _loop0_89: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_91(self) -> Optional[Any]:
        # _loop0_91: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_90(self) -> Optional[Any]:
        # _gather_90: pattern_assignment _loop0_91
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_91()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_92(self) -> Optional[Any]:
        # _tmp_92: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_93(self) -> Optional[Any]:
        # _loop0_93: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_94(self) -> Optional[Any]:
        # _loop0_94: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_95(self) -> Optional[Any]:
        # _loop0_95: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_96(self) -> Optional[Any]:
        # _loop0_96: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_97(self) -> Optional[Any]:
        # _loop0_97: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_98(self) -> Optional[Any]:
        # _tmp_98: ',' | ')' | DELIMITER
        mark = self._mark()
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if DELIMITER := self.DELIMITER():
            return DELIMITER
        self._reset(mark)
        return None

    @memoize
    def _loop0_100(self) -> Optional[Any]:
        # _loop0_100: ',' expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_99(self) -> Optional[Any]:
        # _gather_99: expression _loop0_100
        mark = self._mark()
        if (elem := self.expression()) is not None and (
            seq := self._loop0_100()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_102(self) -> Optional[Any]:
        # _loop0_102: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_101(self) -> Optional[Any]:
        # _gather_101: pattern_assignment _loop0_102
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_102()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_103(self) -> Optional[Any]:
        # _tmp_103: ',' | ')' | DELIMITER
        mark = self._mark()
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if DELIMITER := self.DELIMITER():
            return DELIMITER
        self._reset(mark)
        return None

    @memoize
    def _loop1_104(self) -> Optional[Any]:
        # _loop1_104: except_block
        mark = self._mark()
        children = []
        while except_block := self.except_block():
            children.append(except_block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_105(self) -> Optional[Any]:
        # _loop1_105: except_star_block
        mark = self._mark()
        children = []
        while except_star_block := self.except_star_block():
            children.append(except_star_block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_106(self) -> Optional[Any]:
        # _tmp_106: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_107(self) -> Optional[Any]:
        # _loop0_107: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_108(self) -> Optional[Any]:
        # _tmp_108: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_109(self) -> Optional[Any]:
        # _loop0_109: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_110(self) -> Optional[Any]:
        # _loop0_110: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_111(self) -> Optional[Any]:
        # _loop1_111: case_block
        mark = self._mark()
        children = []
        while case_block := self.case_block():
            children.append(case_block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_112(self) -> Optional[Any]:
        # _loop0_112: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_113(self) -> Optional[Any]:
        # _loop0_113: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_115(self) -> Optional[Any]:
        # _loop0_115: '|' closed_pattern
        mark = self._mark()
        children = []
        while (self.expect("|")) and (elem := self.closed_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_114(self) -> Optional[Any]:
        # _gather_114: closed_pattern _loop0_115
        mark = self._mark()
        if (elem := self.closed_pattern()) is not None and (
            seq := self._loop0_115()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_116(self) -> Optional[Any]:
        # _tmp_116: '+' | '-'
        mark = self._mark()
        if literal := self.expect("+"):
            return literal
        self._reset(mark)
        if literal := self.expect("-"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_117(self) -> Optional[Any]:
        # _tmp_117: '+' | '-'
        mark = self._mark()
        if literal := self.expect("+"):
            return literal
        self._reset(mark)
        if literal := self.expect("-"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_118(self) -> Optional[Any]:
        # _tmp_118: '.' | '('
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_119(self) -> Optional[Any]:
        # _tmp_119: '.' | '('
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_120(self) -> Optional[Any]:
        # _tmp_120: '.' | '('
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_121(self) -> Optional[Any]:
        # _tmp_121: '.' | '?.'
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("?."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_123(self) -> Optional[Any]:
        # _loop0_123: ',' maybe_star_pattern
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.maybe_star_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_122(self) -> Optional[Any]:
        # _gather_122: maybe_star_pattern _loop0_123
        mark = self._mark()
        if (elem := self.maybe_star_pattern()) is not None and (
            seq := self._loop0_123()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_125(self) -> Optional[Any]:
        # _loop0_125: ',' key_value_pattern
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.key_value_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_124(self) -> Optional[Any]:
        # _gather_124: key_value_pattern _loop0_125
        mark = self._mark()
        if (elem := self.key_value_pattern()) is not None and (
            seq := self._loop0_125()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_126(self) -> Optional[Any]:
        # _tmp_126: literal_expr | attr_pattern
        mark = self._mark()
        if literal_expr := self.literal_expr():
            return literal_expr
        self._reset(mark)
        if attr_pattern := self.attr_pattern():
            return attr_pattern
        self._reset(mark)
        return None

    @memoize
    def _loop0_128(self) -> Optional[Any]:
        # _loop0_128: ',' attribute_capture_pattern
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.attribute_capture_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_127(self) -> Optional[Any]:
        # _gather_127: attribute_capture_pattern _loop0_128
        mark = self._mark()
        if (elem := self.attribute_capture_pattern()) is not None and (
            seq := self._loop0_128()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_130(self) -> Optional[Any]:
        # _loop0_130: ',' positional_pattern
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.positional_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_129(self) -> Optional[Any]:
        # _gather_129: positional_pattern _loop0_130
        mark = self._mark()
        if (elem := self.positional_pattern()) is not None and (
            seq := self._loop0_130()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_132(self) -> Optional[Any]:
        # _loop0_132: '|' positional_closed_pattern
        mark = self._mark()
        children = []
        while (self.expect("|")) and (elem := self.positional_closed_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_131(self) -> Optional[Any]:
        # _gather_131: positional_closed_pattern _loop0_132
        mark = self._mark()
        if (elem := self.positional_closed_pattern()) is not None and (
            seq := self._loop0_132()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_133(self) -> Optional[Any]:
        # _tmp_133: '.' | '(' | '='
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_134(self) -> Optional[Any]:
        # _tmp_134: '.' | '(' | '='
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_135(self) -> Optional[Any]:
        # _tmp_135: '.' | '(' | '='
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_137(self) -> Optional[Any]:
        # _loop0_137: ',' keyword_pattern
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.keyword_pattern()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_136(self) -> Optional[Any]:
        # _gather_136: keyword_pattern _loop0_137
        mark = self._mark()
        if (elem := self.keyword_pattern()) is not None and (
            seq := self._loop0_137()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_139(self) -> Optional[Any]:
        # _loop0_139: ',' type_param
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.type_param()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_138(self) -> Optional[Any]:
        # _gather_138: type_param _loop0_139
        mark = self._mark()
        if (elem := self.type_param()) is not None and (
            seq := self._loop0_139()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop1_140(self) -> Optional[Any]:
        # _loop1_140: ('->' typing_arrow_single_param_type)
        mark = self._mark()
        children = []
        while _tmp_349 := self._tmp_349():
            children.append(_tmp_349)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_141(self) -> Optional[Any]:
        # _loop1_141: ('||' typing_conjunction)
        mark = self._mark()
        children = []
        while _tmp_350 := self._tmp_350():
            children.append(_tmp_350)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_142(self) -> Optional[Any]:
        # _loop1_142: ('&&' typing_inversion)
        mark = self._mark()
        children = []
        while _tmp_351 := self._tmp_351():
            children.append(_tmp_351)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_143(self) -> Optional[Any]:
        # _loop1_143: typing_compare_op_bitwise_or_pair
        mark = self._mark()
        children = []
        while (
            typing_compare_op_bitwise_or_pair
            := self.typing_compare_op_bitwise_or_pair()
        ):
            children.append(typing_compare_op_bitwise_or_pair)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_144(self) -> Optional[Any]:
        # _loop0_144: typing_arrow_param
        mark = self._mark()
        children = []
        while typing_arrow_param := self.typing_arrow_param():
            children.append(typing_arrow_param)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_145(self) -> Optional[Any]:
        # _loop1_145: (',' expression)
        mark = self._mark()
        children = []
        while _tmp_352 := self._tmp_352():
            children.append(_tmp_352)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_146(self) -> Optional[Any]:
        # _loop1_146: (',' star_expression)
        mark = self._mark()
        children = []
        while _tmp_353 := self._tmp_353():
            children.append(_tmp_353)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_148(self) -> Optional[Any]:
        # _loop0_148: ',' star_named_expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.star_named_expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_147(self) -> Optional[Any]:
        # _gather_147: star_named_expression _loop0_148
        mark = self._mark()
        if (elem := self.star_named_expression()) is not None and (
            seq := self._loop0_148()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop1_149(self) -> Optional[Any]:
        # _loop1_149: (('|>' | '?|>') coalescing)
        mark = self._mark()
        children = []
        while _tmp_354 := self._tmp_354():
            children.append(_tmp_354)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_150(self) -> Optional[Any]:
        # _loop1_150: ('??' arrow_single_param)
        mark = self._mark()
        children = []
        while _tmp_355 := self._tmp_355():
            children.append(_tmp_355)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_151(self) -> Optional[Any]:
        # _loop1_151: ('->' typing_expression)
        mark = self._mark()
        children = []
        while _tmp_356 := self._tmp_356():
            children.append(_tmp_356)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_152(self) -> Optional[Any]:
        # _loop1_152: ('||' conjunction)
        mark = self._mark()
        children = []
        while _tmp_357 := self._tmp_357():
            children.append(_tmp_357)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_153(self) -> Optional[Any]:
        # _loop1_153: ('&&' comparison)
        mark = self._mark()
        children = []
        while _tmp_358 := self._tmp_358():
            children.append(_tmp_358)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_154(self) -> Optional[Any]:
        # _loop1_154: compare_op_bitwise_or_pair
        mark = self._mark()
        children = []
        while compare_op_bitwise_or_pair := self.compare_op_bitwise_or_pair():
            children.append(compare_op_bitwise_or_pair)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_155(self) -> Optional[Any]:
        # _tmp_155: '.' | '?.'
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("?."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_156(self) -> Optional[Any]:
        # _tmp_156: '(' | '?('
        mark = self._mark()
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("?("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_157(self) -> Optional[Any]:
        # _tmp_157: '[' | '?['
        mark = self._mark()
        if literal := self.expect("["):
            return literal
        self._reset(mark)
        if literal := self.expect("?["):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_159(self) -> Optional[Any]:
        # _loop0_159: ',' (slice | starred_expression)
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self._tmp_359()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_158(self) -> Optional[Any]:
        # _gather_158: (slice | starred_expression) _loop0_159
        mark = self._mark()
        if (elem := self._tmp_359()) is not None and (
            seq := self._loop0_159()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_160(self) -> Optional[Any]:
        # _tmp_160: ':' expression?
        mark = self._mark()
        if (self.expect(":")) and (d := self.expression(),):
            return d
        self._reset(mark)
        return None

    @memoize
    def _tmp_161(self) -> Optional[Any]:
        # _tmp_161: STRING | FSTRING_START
        mark = self._mark()
        if string := self.string():
            return string
        self._reset(mark)
        if fstring_start := self.fstring_start():
            return fstring_start
        self._reset(mark)
        return None

    @memoize
    def _tmp_162(self) -> Optional[Any]:
        # _tmp_162: function_literal | typing_arrow_type | tuple | group | comprehension_paren
        mark = self._mark()
        if function_literal := self.function_literal():
            return function_literal
        self._reset(mark)
        if typing_arrow_type := self.typing_arrow_type():
            return typing_arrow_type
        self._reset(mark)
        if tuple := self.tuple():
            return tuple
        self._reset(mark)
        if group := self.group():
            return group
        self._reset(mark)
        if comprehension_paren := self.comprehension_paren():
            return comprehension_paren
        self._reset(mark)
        return None

    @memoize
    def _tmp_163(self) -> Optional[Any]:
        # _tmp_163: list | listcomp
        mark = self._mark()
        if list := self.list():
            return list
        self._reset(mark)
        if listcomp := self.listcomp():
            return listcomp
        self._reset(mark)
        return None

    @memoize
    def _tmp_164(self) -> Optional[Any]:
        # _tmp_164: dict | set | dictcomp | setcomp
        mark = self._mark()
        if dict := self.dict():
            return dict
        self._reset(mark)
        if set := self.set():
            return set
        self._reset(mark)
        if dictcomp := self.dictcomp():
            return dictcomp
        self._reset(mark)
        if setcomp := self.setcomp():
            return setcomp
        self._reset(mark)
        return None

    @memoize
    def _tmp_165(self) -> Optional[Any]:
        # _tmp_165: record_type | record_literal
        mark = self._mark()
        if record_type := self.record_type():
            return record_type
        self._reset(mark)
        if record_literal := self.record_literal():
            return record_literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_166(self) -> Optional[Any]:
        # _tmp_166: yield_expr | named_expression
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if named_expression := self.named_expression():
            return named_expression
        self._reset(mark)
        return None

    @memoize
    def _tmp_167(self) -> Optional[Any]:
        # _tmp_167: block | expression
        mark = self._mark()
        if block := self.block():
            return block
        self._reset(mark)
        if expression := self.expression():
            return expression
        self._reset(mark)
        return None

    @memoize
    def _tmp_168(self) -> Optional[Any]:
        # _tmp_168: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _loop0_169(self) -> Optional[Any]:
        # _loop0_169: fstring_format_spec
        mark = self._mark()
        children = []
        while fstring_format_spec := self.fstring_format_spec():
            children.append(fstring_format_spec)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_170(self) -> Optional[Any]:
        # _loop1_170: (fstring | STRING)
        mark = self._mark()
        children = []
        while _tmp_360 := self._tmp_360():
            children.append(_tmp_360)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_171(self) -> Optional[Any]:
        # _tmp_171: star_named_expression ',' star_named_expressions?
        mark = self._mark()
        if (
            (y := self.star_named_expression())
            and (self.expect(","))
            and (z := self.star_named_expressions(),)
        ):
            return [y] + (z or [])
        self._reset(mark)
        return None

    @memoize
    def _loop0_173(self) -> Optional[Any]:
        # _loop0_173: ',' double_starred_kvpair
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.double_starred_kvpair()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_172(self) -> Optional[Any]:
        # _gather_172: double_starred_kvpair _loop0_173
        mark = self._mark()
        if (elem := self.double_starred_kvpair()) is not None and (
            seq := self._loop0_173()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_175(self) -> Optional[Any]:
        # _loop0_175: ',' record_literal_field
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.record_literal_field()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_174(self) -> Optional[Any]:
        # _gather_174: record_literal_field _loop0_175
        mark = self._mark()
        if (elem := self.record_literal_field()) is not None and (
            seq := self._loop0_175()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_177(self) -> Optional[Any]:
        # _loop0_177: ',' record_type_field
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.record_type_field()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_176(self) -> Optional[Any]:
        # _gather_176: record_type_field _loop0_177
        mark = self._mark()
        if (elem := self.record_type_field()) is not None and (
            seq := self._loop0_177()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop1_178(self) -> Optional[Any]:
        # _loop1_178: for_if_clause
        mark = self._mark()
        children = []
        while for_if_clause := self.for_if_clause():
            children.append(for_if_clause)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_179(self) -> Optional[Any]:
        # _loop0_179: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_180(self) -> Optional[Any]:
        # _loop0_180: ('if' '(' pipe_operator ')' NEWLINE*)
        mark = self._mark()
        children = []
        while _tmp_361 := self._tmp_361():
            children.append(_tmp_361)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_181(self) -> Optional[Any]:
        # _loop0_181: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_182(self) -> Optional[Any]:
        # _loop0_182: ('if' '(' pipe_operator ')' NEWLINE*)
        mark = self._mark()
        children = []
        while _tmp_362 := self._tmp_362():
            children.append(_tmp_362)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_183(self) -> Optional[Any]:
        # _tmp_183: assignment_expression | expression !':='
        mark = self._mark()
        if assignment_expression := self.assignment_expression():
            return assignment_expression
        self._reset(mark)
        if (expression := self.expression()) and (
            self.negative_lookahead(self.expect, ":=")
        ):
            return expression
        self._reset(mark)
        return None

    @memoize
    def _loop0_184(self) -> Optional[Any]:
        # _loop0_184: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_185(self) -> Optional[Any]:
        # _loop0_185: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_187(self) -> Optional[Any]:
        # _loop0_187: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_186(self) -> Optional[Any]:
        # _gather_186: pattern_assignment _loop0_187
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_187()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_188(self) -> Optional[Any]:
        # _tmp_188: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_189(self) -> Optional[Any]:
        # _loop0_189: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_191(self) -> Optional[Any]:
        # _loop0_191: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_190(self) -> Optional[Any]:
        # _gather_190: pattern_assignment _loop0_191
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_191()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_192(self) -> Optional[Any]:
        # _tmp_192: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_193(self) -> Optional[Any]:
        # _loop0_193: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_194(self) -> Optional[Any]:
        # _loop0_194: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_195(self) -> Optional[Any]:
        # _loop0_195: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_197(self) -> Optional[Any]:
        # _loop0_197: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_196(self) -> Optional[Any]:
        # _gather_196: pattern_assignment _loop0_197
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_197()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_198(self) -> Optional[Any]:
        # _tmp_198: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_199(self) -> Optional[Any]:
        # _loop0_199: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_201(self) -> Optional[Any]:
        # _loop0_201: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_200(self) -> Optional[Any]:
        # _gather_200: pattern_assignment _loop0_201
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_201()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_202(self) -> Optional[Any]:
        # _tmp_202: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_203(self) -> Optional[Any]:
        # _loop0_203: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_204(self) -> Optional[Any]:
        # _loop0_204: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_206(self) -> Optional[Any]:
        # _loop0_206: ';' with_item
        mark = self._mark()
        children = []
        while (self.expect(";")) and (elem := self.with_item()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_205(self) -> Optional[Any]:
        # _gather_205: with_item _loop0_206
        mark = self._mark()
        if (elem := self.with_item()) is not None and (
            seq := self._loop0_206()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_207(self) -> Optional[Any]:
        # _loop0_207: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_208(self) -> Optional[Any]:
        # _loop0_208: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_209(self) -> Optional[Any]:
        # _loop0_209: try_comp_except
        mark = self._mark()
        children = []
        while try_comp_except := self.try_comp_except():
            children.append(try_comp_except)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_210(self) -> Optional[Any]:
        # _tmp_210: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_211(self) -> Optional[Any]:
        # _loop0_211: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_212(self) -> Optional[Any]:
        # _tmp_212: 'as' NAME
        mark = self._mark()
        if (self.expect("as")) and (z := self.name()):
            return z.string
        self._reset(mark)
        return None

    @memoize
    def _loop0_213(self) -> Optional[Any]:
        # _loop0_213: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_214(self) -> Optional[Any]:
        # _loop0_214: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_215(self) -> Optional[Any]:
        # _loop0_215: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_216(self) -> Optional[Any]:
        # _loop1_216: match_comp_case
        mark = self._mark()
        children = []
        while match_comp_case := self.match_comp_case():
            children.append(match_comp_case)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_217(self) -> Optional[Any]:
        # _loop0_217: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_218(self) -> Optional[Any]:
        # _loop0_218: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_219(self) -> Optional[Any]:
        # _loop0_219: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_221(self) -> Optional[Any]:
        # _loop0_221: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_220(self) -> Optional[Any]:
        # _gather_220: pattern_assignment _loop0_221
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_221()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_222(self) -> Optional[Any]:
        # _tmp_222: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_223(self) -> Optional[Any]:
        # _loop0_223: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_225(self) -> Optional[Any]:
        # _loop0_225: ',' declaration_single_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.declaration_single_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_224(self) -> Optional[Any]:
        # _gather_224: declaration_single_assignment _loop0_225
        mark = self._mark()
        if (elem := self.declaration_single_assignment()) is not None and (
            seq := self._loop0_225()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_227(self) -> Optional[Any]:
        # _loop0_227: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self._tmp_363()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_226(self) -> Optional[Any]:
        # _gather_226: (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_227
        mark = self._mark()
        if (elem := self._tmp_363()) is not None and (
            seq := self._loop0_227()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_228(self) -> Optional[Any]:
        # _tmp_228: ',' kwargs
        mark = self._mark()
        if (self.expect(",")) and (k := self.kwargs()):
            return k
        self._reset(mark)
        return None

    @memoize
    def _loop0_230(self) -> Optional[Any]:
        # _loop0_230: ',' kwarg_or_starred
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.kwarg_or_starred()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_229(self) -> Optional[Any]:
        # _gather_229: kwarg_or_starred _loop0_230
        mark = self._mark()
        if (elem := self.kwarg_or_starred()) is not None and (
            seq := self._loop0_230()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_232(self) -> Optional[Any]:
        # _loop0_232: ',' kwarg_or_double_starred
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.kwarg_or_double_starred()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_231(self) -> Optional[Any]:
        # _gather_231: kwarg_or_double_starred _loop0_232
        mark = self._mark()
        if (elem := self.kwarg_or_double_starred()) is not None and (
            seq := self._loop0_232()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_234(self) -> Optional[Any]:
        # _loop0_234: ',' kwarg_or_starred
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.kwarg_or_starred()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_233(self) -> Optional[Any]:
        # _gather_233: kwarg_or_starred _loop0_234
        mark = self._mark()
        if (elem := self.kwarg_or_starred()) is not None and (
            seq := self._loop0_234()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_236(self) -> Optional[Any]:
        # _loop0_236: ',' kwarg_or_double_starred
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.kwarg_or_double_starred()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_235(self) -> Optional[Any]:
        # _gather_235: kwarg_or_double_starred _loop0_236
        mark = self._mark()
        if (elem := self.kwarg_or_double_starred()) is not None and (
            seq := self._loop0_236()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_237(self) -> Optional[Any]:
        # _loop0_237: (',' star_target)
        mark = self._mark()
        children = []
        while _tmp_364 := self._tmp_364():
            children.append(_tmp_364)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_239(self) -> Optional[Any]:
        # _loop0_239: ',' star_target_may_annot
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.star_target_may_annot()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_238(self) -> Optional[Any]:
        # _gather_238: star_target_may_annot _loop0_239
        mark = self._mark()
        if (elem := self.star_target_may_annot()) is not None and (
            seq := self._loop0_239()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop1_240(self) -> Optional[Any]:
        # _loop1_240: (',' star_target_may_annot)
        mark = self._mark()
        children = []
        while _tmp_365 := self._tmp_365():
            children.append(_tmp_365)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_241(self) -> Optional[Any]:
        # _tmp_241: !'*' star_target
        mark = self._mark()
        if (self.negative_lookahead(self.expect, "*")) and (
            star_target := self.star_target()
        ):
            return star_target
        self._reset(mark)
        return None

    @memoize
    def _loop0_243(self) -> Optional[Any]:
        # _loop0_243: ',' del_target
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.del_target()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_242(self) -> Optional[Any]:
        # _gather_242: del_target _loop0_243
        mark = self._mark()
        if (elem := self.del_target()) is not None and (
            seq := self._loop0_243()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_244(self) -> Optional[Any]:
        # _tmp_244: !'*' decl_star_target
        mark = self._mark()
        if (self.negative_lookahead(self.expect, "*")) and (
            decl_star_target := self.decl_star_target()
        ):
            return decl_star_target
        self._reset(mark)
        return None

    @memoize
    def _loop0_246(self) -> Optional[Any]:
        # _loop0_246: ',' expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_245(self) -> Optional[Any]:
        # _gather_245: expression _loop0_246
        mark = self._mark()
        if (elem := self.expression()) is not None and (
            seq := self._loop0_246()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_248(self) -> Optional[Any]:
        # _loop0_248: ',' expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_247(self) -> Optional[Any]:
        # _gather_247: expression _loop0_248
        mark = self._mark()
        if (elem := self.expression()) is not None and (
            seq := self._loop0_248()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_250(self) -> Optional[Any]:
        # _loop0_250: ',' expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_249(self) -> Optional[Any]:
        # _gather_249: expression _loop0_250
        mark = self._mark()
        if (elem := self.expression()) is not None and (
            seq := self._loop0_250()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _loop0_252(self) -> Optional[Any]:
        # _loop0_252: ',' expression
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.expression()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_251(self) -> Optional[Any]:
        # _gather_251: expression _loop0_252
        mark = self._mark()
        if (elem := self.expression()) is not None and (
            seq := self._loop0_252()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_253(self) -> Optional[Any]:
        # _tmp_253: NEWLINE INDENT
        mark = self._mark()
        if (_newline := self.expect("NEWLINE")) and (_indent := self.expect("INDENT")):
            return [_newline, _indent]
        self._reset(mark)
        return None

    @memoize
    def _tmp_254(self) -> Optional[Any]:
        # _tmp_254: (','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs
        mark = self._mark()
        if _tmp_366 := self._tmp_366():
            return _tmp_366
        self._reset(mark)
        if kwargs := self.kwargs():
            return kwargs
        self._reset(mark)
        return None

    @memoize
    def _loop0_256(self) -> Optional[Any]:
        # _loop0_256: ',' (starred_expression !'=')
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self._tmp_367()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_255(self) -> Optional[Any]:
        # _gather_255: (starred_expression !'=') _loop0_256
        mark = self._mark()
        if (elem := self._tmp_367()) is not None and (
            seq := self._loop0_256()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_257(self) -> Optional[Any]:
        # _tmp_257: args | expression for_if_clauses
        mark = self._mark()
        if args := self.args():
            return args
        self._reset(mark)
        if (expression := self.expression()) and (
            for_if_clauses := self.for_if_clauses()
        ):
            return [expression, for_if_clauses]
        self._reset(mark)
        return None

    @memoize
    def _tmp_258(self) -> Optional[Any]:
        # _tmp_258: args ','
        mark = self._mark()
        if (args := self.args()) and (literal := self.expect(",")):
            return [args, literal]
        self._reset(mark)
        return None

    @memoize
    def _tmp_259(self) -> Optional[Any]:
        # _tmp_259: ',' | ')'
        mark = self._mark()
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_260(self) -> Optional[Any]:
        # _tmp_260: 'True' | 'False' | 'None'
        mark = self._mark()
        if literal := self.expect("True"):
            return literal
        self._reset(mark)
        if literal := self.expect("False"):
            return literal
        self._reset(mark)
        if literal := self.expect("None"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_261(self) -> Optional[Any]:
        # _tmp_261: NAME '='
        mark = self._mark()
        if (name := self.name()) and (literal := self.expect("=")):
            return [name, literal]
        self._reset(mark)
        return None

    @memoize
    def _tmp_262(self) -> Optional[Any]:
        # _tmp_262: NAME STRING | SOFT_KEYWORD
        mark = self._mark()
        if (name := self.name()) and (string := self.string()):
            return [name, string]
        self._reset(mark)
        if soft_keyword := self.soft_keyword():
            return soft_keyword
        self._reset(mark)
        return None

    @memoize
    def _tmp_263(self) -> Optional[Any]:
        # _tmp_263: '=' | ':='
        mark = self._mark()
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        if literal := self.expect(":="):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_264(self) -> Optional[Any]:
        # _tmp_264: list | tuple | genexp | 'True' | 'None' | 'False'
        mark = self._mark()
        if list := self.list():
            return list
        self._reset(mark)
        if tuple := self.tuple():
            return tuple
        self._reset(mark)
        if genexp := self.genexp():
            return genexp
        self._reset(mark)
        if literal := self.expect("True"):
            return literal
        self._reset(mark)
        if literal := self.expect("None"):
            return literal
        self._reset(mark)
        if literal := self.expect("False"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_265(self) -> Optional[Any]:
        # _tmp_265: '=' | ':='
        mark = self._mark()
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        if literal := self.expect(":="):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_266(self) -> Optional[Any]:
        # _loop0_266: star_named_expressions
        mark = self._mark()
        children = []
        while star_named_expressions := self.star_named_expressions():
            children.append(star_named_expressions)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_267(self) -> Optional[Any]:
        # _loop0_267: (star_targets '=')
        mark = self._mark()
        children = []
        while _tmp_368 := self._tmp_368():
            children.append(_tmp_368)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_268(self) -> Optional[Any]:
        # _loop0_268: (star_targets '=')
        mark = self._mark()
        children = []
        while _tmp_369 := self._tmp_369():
            children.append(_tmp_369)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_269(self) -> Optional[Any]:
        # _tmp_269: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_270(self) -> Optional[Any]:
        # _tmp_270: '[' | '(' | '{'
        mark = self._mark()
        if literal := self.expect("["):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if literal := self.expect("{"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_271(self) -> Optional[Any]:
        # _tmp_271: '[' | '{'
        mark = self._mark()
        if literal := self.expect("["):
            return literal
        self._reset(mark)
        if literal := self.expect("{"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_272(self) -> Optional[Any]:
        # _tmp_272: '[' | '{'
        mark = self._mark()
        if literal := self.expect("["):
            return literal
        self._reset(mark)
        if literal := self.expect("{"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_273(self) -> Optional[Any]:
        # _tmp_273: slash_no_default | slash_with_default
        mark = self._mark()
        if slash_no_default := self.slash_no_default():
            return slash_no_default
        self._reset(mark)
        if slash_with_default := self.slash_with_default():
            return slash_with_default
        self._reset(mark)
        return None

    @memoize
    def _loop0_274(self) -> Optional[Any]:
        # _loop0_274: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_275(self) -> Optional[Any]:
        # _loop0_275: param_no_default
        mark = self._mark()
        children = []
        while param_no_default := self.param_no_default():
            children.append(param_no_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_276(self) -> Optional[Any]:
        # _tmp_276: slash_no_default | slash_with_default
        mark = self._mark()
        if slash_no_default := self.slash_no_default():
            return slash_no_default
        self._reset(mark)
        if slash_with_default := self.slash_with_default():
            return slash_with_default
        self._reset(mark)
        return None

    @memoize
    def _loop0_277(self) -> Optional[Any]:
        # _loop0_277: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_278(self) -> Optional[Any]:
        # _tmp_278: ',' | param_no_default
        mark = self._mark()
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        if param_no_default := self.param_no_default():
            return param_no_default
        self._reset(mark)
        return None

    @memoize
    def _loop0_279(self) -> Optional[Any]:
        # _loop0_279: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_280(self) -> Optional[Any]:
        # _loop1_280: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_281(self) -> Optional[Any]:
        # _tmp_281: ')' | ','
        mark = self._mark()
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_282(self) -> Optional[Any]:
        # _tmp_282: ')' | ',' (')' | '**')
        mark = self._mark()
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if (literal := self.expect(",")) and (_tmp_370 := self._tmp_370()):
            return [literal, _tmp_370]
        self._reset(mark)
        return None

    @memoize
    def _tmp_283(self) -> Optional[Any]:
        # _tmp_283: param_no_default | ','
        mark = self._mark()
        if param_no_default := self.param_no_default():
            return param_no_default
        self._reset(mark)
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_284(self) -> Optional[Any]:
        # _loop0_284: param_maybe_default
        mark = self._mark()
        children = []
        while param_maybe_default := self.param_maybe_default():
            children.append(param_maybe_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_285(self) -> Optional[Any]:
        # _tmp_285: param_no_default | ','
        mark = self._mark()
        if param_no_default := self.param_no_default():
            return param_no_default
        self._reset(mark)
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_286(self) -> Optional[Any]:
        # _tmp_286: '*' | '**' | '/'
        mark = self._mark()
        if literal := self.expect("*"):
            return literal
        self._reset(mark)
        if literal := self.expect("**"):
            return literal
        self._reset(mark)
        if literal := self.expect("/"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop1_287(self) -> Optional[Any]:
        # _loop1_287: param_with_default
        mark = self._mark()
        children = []
        while param_with_default := self.param_with_default():
            children.append(param_with_default)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_288(self) -> Optional[Any]:
        # _tmp_288: ',' | ')' | ':'
        mark = self._mark()
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if literal := self.expect(":"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_290(self) -> Optional[Any]:
        # _loop0_290: ',' dotted_name
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.dotted_name()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_289(self) -> Optional[Any]:
        # _gather_289: dotted_name _loop0_290
        mark = self._mark()
        if (elem := self.dotted_name()) is not None and (
            seq := self._loop0_290()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_291(self) -> Optional[Any]:
        # _tmp_291: '(' | decl_keyword
        mark = self._mark()
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        if decl_keyword := self.decl_keyword():
            return decl_keyword
        self._reset(mark)
        return None

    @memoize
    def _loop0_292(self) -> Optional[Any]:
        # _loop0_292: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_293(self) -> Optional[Any]:
        # _tmp_293: 'except' | 'finally'
        mark = self._mark()
        if literal := self.expect("except"):
            return literal
        self._reset(mark)
        if literal := self.expect("finally"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_294(self) -> Optional[Any]:
        # _loop0_294: block
        mark = self._mark()
        children = []
        while block := self.block():
            children.append(block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_295(self) -> Optional[Any]:
        # _loop1_295: except_block
        mark = self._mark()
        children = []
        while except_block := self.except_block():
            children.append(except_block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_296(self) -> Optional[Any]:
        # _loop0_296: block
        mark = self._mark()
        children = []
        while block := self.block():
            children.append(block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop1_297(self) -> Optional[Any]:
        # _loop1_297: except_star_block
        mark = self._mark()
        children = []
        while except_star_block := self.except_star_block():
            children.append(except_star_block)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_298(self) -> Optional[Any]:
        # _tmp_298: 'as' NAME
        mark = self._mark()
        if (literal := self.expect("as")) and (name := self.name()):
            return [literal, name]
        self._reset(mark)
        return None

    @memoize
    def _tmp_299(self) -> Optional[Any]:
        # _tmp_299: 'as' NAME
        mark = self._mark()
        if (literal := self.expect("as")) and (name := self.name()):
            return [literal, name]
        self._reset(mark)
        return None

    @memoize
    def _loop0_300(self) -> Optional[Any]:
        # _loop0_300: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_301(self) -> Optional[Any]:
        # _tmp_301: '{' | '('
        mark = self._mark()
        if literal := self.expect("{"):
            return literal
        self._reset(mark)
        if literal := self.expect("("):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_302(self) -> Optional[Any]:
        # _loop0_302: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_303(self) -> Optional[Any]:
        # _loop0_303: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_304(self) -> Optional[Any]:
        # _loop0_304: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_305(self) -> Optional[Any]:
        # _loop0_305: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_306(self) -> Optional[Any]:
        # _tmp_306: positional_patterns ','
        mark = self._mark()
        if (positional_patterns := self.positional_patterns()) and (
            literal := self.expect(",")
        ):
            return [positional_patterns, literal]
        self._reset(mark)
        return None

    @memoize
    def _loop0_307(self) -> Optional[Any]:
        # _loop0_307: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_309(self) -> Optional[Any]:
        # _loop0_309: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_308(self) -> Optional[Any]:
        # _gather_308: pattern_assignment _loop0_309
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_309()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_310(self) -> Optional[Any]:
        # _tmp_310: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_311(self) -> Optional[Any]:
        # _loop0_311: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_312(self) -> Optional[Any]:
        # _loop0_312: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_314(self) -> Optional[Any]:
        # _loop0_314: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_313(self) -> Optional[Any]:
        # _gather_313: pattern_assignment _loop0_314
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_314()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_315(self) -> Optional[Any]:
        # _tmp_315: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_316(self) -> Optional[Any]:
        # _loop0_316: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_317(self) -> Optional[Any]:
        # _loop0_317: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_318(self) -> Optional[Any]:
        # _loop0_318: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_320(self) -> Optional[Any]:
        # _loop0_320: ',' pattern_assignment
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.pattern_assignment()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_319(self) -> Optional[Any]:
        # _gather_319: pattern_assignment _loop0_320
        mark = self._mark()
        if (elem := self.pattern_assignment()) is not None and (
            seq := self._loop0_320()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_321(self) -> Optional[Any]:
        # _tmp_321: ';' named_expression
        mark = self._mark()
        if (self.expect(";")) and (a := self.named_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _loop0_322(self) -> Optional[Any]:
        # _loop0_322: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_323(self) -> Optional[Any]:
        # _loop0_323: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_324(self) -> Optional[Any]:
        # _tmp_324: '{' | '->'
        mark = self._mark()
        if literal := self.expect("{"):
            return literal
        self._reset(mark)
        if literal := self.expect("->"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_325(self) -> Optional[Any]:
        # _tmp_325: '(' arguments? ')'
        mark = self._mark()
        if (
            (literal := self.expect("("))
            and (opt := self.arguments(),)
            and (literal_1 := self.expect(")"))
        ):
            return [literal, opt, literal_1]
        self._reset(mark)
        return None

    @memoize
    def _loop0_326(self) -> Optional[Any]:
        # _loop0_326: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_328(self) -> Optional[Any]:
        # _loop0_328: ',' double_starred_kvpair
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self.double_starred_kvpair()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_327(self) -> Optional[Any]:
        # _gather_327: double_starred_kvpair _loop0_328
        mark = self._mark()
        if (elem := self.double_starred_kvpair()) is not None and (
            seq := self._loop0_328()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_329(self) -> Optional[Any]:
        # _tmp_329: '}' | ','
        mark = self._mark()
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_330(self) -> Optional[Any]:
        # _tmp_330: '}' | ','
        mark = self._mark()
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        if literal := self.expect(","):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_331(self) -> Optional[Any]:
        # _tmp_331: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_332(self) -> Optional[Any]:
        # _tmp_332: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_333(self) -> Optional[Any]:
        # _tmp_333: '=' | '!' | ':' | '}'
        mark = self._mark()
        if literal := self.expect("="):
            return literal
        self._reset(mark)
        if literal := self.expect("!"):
            return literal
        self._reset(mark)
        if literal := self.expect(":"):
            return literal
        self._reset(mark)
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_334(self) -> Optional[Any]:
        # _tmp_334: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_335(self) -> Optional[Any]:
        # _tmp_335: '!' | ':' | '}'
        mark = self._mark()
        if literal := self.expect("!"):
            return literal
        self._reset(mark)
        if literal := self.expect(":"):
            return literal
        self._reset(mark)
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_336(self) -> Optional[Any]:
        # _tmp_336: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_337(self) -> Optional[Any]:
        # _tmp_337: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_338(self) -> Optional[Any]:
        # _tmp_338: '!' NAME
        mark = self._mark()
        if (literal := self.expect("!")) and (name := self.name()):
            return [literal, name]
        self._reset(mark)
        return None

    @memoize
    def _tmp_339(self) -> Optional[Any]:
        # _tmp_339: ':' | '}'
        mark = self._mark()
        if literal := self.expect(":"):
            return literal
        self._reset(mark)
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_340(self) -> Optional[Any]:
        # _tmp_340: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_341(self) -> Optional[Any]:
        # _tmp_341: '!' NAME
        mark = self._mark()
        if (literal := self.expect("!")) and (name := self.name()):
            return [literal, name]
        self._reset(mark)
        return None

    @memoize
    def _loop0_342(self) -> Optional[Any]:
        # _loop0_342: fstring_format_spec
        mark = self._mark()
        children = []
        while fstring_format_spec := self.fstring_format_spec():
            children.append(fstring_format_spec)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_343(self) -> Optional[Any]:
        # _tmp_343: yield_expr | star_expressions
        mark = self._mark()
        if yield_expr := self.yield_expr():
            return yield_expr
        self._reset(mark)
        if star_expressions := self.star_expressions():
            return star_expressions
        self._reset(mark)
        return None

    @memoize
    def _tmp_344(self) -> Optional[Any]:
        # _tmp_344: '!' NAME
        mark = self._mark()
        if (literal := self.expect("!")) and (name := self.name()):
            return [literal, name]
        self._reset(mark)
        return None

    @memoize
    def _tmp_345(self) -> Optional[Any]:
        # _tmp_345: ':' | '}'
        mark = self._mark()
        if literal := self.expect(":"):
            return literal
        self._reset(mark)
        if literal := self.expect("}"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_346(self) -> Optional[Any]:
        # _tmp_346: star_targets '='
        mark = self._mark()
        if (z := self.star_targets()) and (self.expect("=")):
            return z
        self._reset(mark)
        return None

    @memoize
    def _tmp_347(self) -> Optional[Any]:
        # _tmp_347: '.' | '...'
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("..."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_348(self) -> Optional[Any]:
        # _tmp_348: '.' | '...'
        mark = self._mark()
        if literal := self.expect("."):
            return literal
        self._reset(mark)
        if literal := self.expect("..."):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_349(self) -> Optional[Any]:
        # _tmp_349: '->' typing_arrow_single_param_type
        mark = self._mark()
        if (self.expect("->")) and (a := self.typing_arrow_single_param_type()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _tmp_350(self) -> Optional[Any]:
        # _tmp_350: '||' typing_conjunction
        mark = self._mark()
        if (self.expect("||")) and (c := self.typing_conjunction()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_351(self) -> Optional[Any]:
        # _tmp_351: '&&' typing_inversion
        mark = self._mark()
        if (self.expect("&&")) and (c := self.typing_inversion()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_352(self) -> Optional[Any]:
        # _tmp_352: ',' expression
        mark = self._mark()
        if (self.expect(",")) and (c := self.expression()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_353(self) -> Optional[Any]:
        # _tmp_353: ',' star_expression
        mark = self._mark()
        if (self.expect(",")) and (c := self.star_expression()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_354(self) -> Optional[Any]:
        # _tmp_354: ('|>' | '?|>') coalescing
        mark = self._mark()
        if (op := self._tmp_371()) and (c := self.coalescing()):
            return (op.string == "?|>", c)
        self._reset(mark)
        return None

    @memoize
    def _tmp_355(self) -> Optional[Any]:
        # _tmp_355: '??' arrow_single_param
        mark = self._mark()
        if (self.expect("??")) and (c := self.arrow_single_param()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_356(self) -> Optional[Any]:
        # _tmp_356: '->' typing_expression
        mark = self._mark()
        if (self.expect("->")) and (a := self.typing_expression()):
            return a
        self._reset(mark)
        return None

    @memoize
    def _tmp_357(self) -> Optional[Any]:
        # _tmp_357: '||' conjunction
        mark = self._mark()
        if (self.expect("||")) and (c := self.conjunction()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_358(self) -> Optional[Any]:
        # _tmp_358: '&&' comparison
        mark = self._mark()
        if (self.expect("&&")) and (c := self.comparison()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_359(self) -> Optional[Any]:
        # _tmp_359: slice | starred_expression
        mark = self._mark()
        if slice := self.slice():
            return slice
        self._reset(mark)
        if starred_expression := self.starred_expression():
            return starred_expression
        self._reset(mark)
        return None

    @memoize
    def _tmp_360(self) -> Optional[Any]:
        # _tmp_360: fstring | STRING
        mark = self._mark()
        if fstring := self.fstring():
            return fstring
        self._reset(mark)
        if string := self.string():
            return string
        self._reset(mark)
        return None

    @memoize
    def _tmp_361(self) -> Optional[Any]:
        # _tmp_361: 'if' '(' pipe_operator ')' NEWLINE*
        mark = self._mark()
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (z := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_372(),)
        ):
            return z
        self._reset(mark)
        return None

    @memoize
    def _tmp_362(self) -> Optional[Any]:
        # _tmp_362: 'if' '(' pipe_operator ')' NEWLINE*
        mark = self._mark()
        if (
            (self.expect("if"))
            and (self.expect("("))
            and (z := self.pipe_operator())
            and (self.expect(")"))
            and (self._loop0_373(),)
        ):
            return z
        self._reset(mark)
        return None

    @memoize
    def _tmp_363(self) -> Optional[Any]:
        # _tmp_363: starred_expression | (assignment_expression | expression !':=') !'='
        mark = self._mark()
        if starred_expression := self.starred_expression():
            return starred_expression
        self._reset(mark)
        if (_tmp_374 := self._tmp_374()) and (
            self.negative_lookahead(self.expect, "=")
        ):
            return _tmp_374
        self._reset(mark)
        return None

    @memoize
    def _tmp_364(self) -> Optional[Any]:
        # _tmp_364: ',' star_target
        mark = self._mark()
        if (self.expect(",")) and (c := self.star_target()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_365(self) -> Optional[Any]:
        # _tmp_365: ',' star_target_may_annot
        mark = self._mark()
        if (self.expect(",")) and (c := self.star_target_may_annot()):
            return c
        self._reset(mark)
        return None

    @memoize
    def _tmp_366(self) -> Optional[Any]:
        # _tmp_366: ','.(starred_expression | (assignment_expression | expression !':=') !'=')+ ',' kwargs
        mark = self._mark()
        if (
            (_gather_375 := self._gather_375())
            and (literal := self.expect(","))
            and (kwargs := self.kwargs())
        ):
            return [_gather_375, literal, kwargs]
        self._reset(mark)
        return None

    @memoize
    def _tmp_367(self) -> Optional[Any]:
        # _tmp_367: starred_expression !'='
        mark = self._mark()
        if (starred_expression := self.starred_expression()) and (
            self.negative_lookahead(self.expect, "=")
        ):
            return starred_expression
        self._reset(mark)
        return None

    @memoize
    def _tmp_368(self) -> Optional[Any]:
        # _tmp_368: star_targets '='
        mark = self._mark()
        if (star_targets := self.star_targets()) and (literal := self.expect("=")):
            return [star_targets, literal]
        self._reset(mark)
        return None

    @memoize
    def _tmp_369(self) -> Optional[Any]:
        # _tmp_369: star_targets '='
        mark = self._mark()
        if (star_targets := self.star_targets()) and (literal := self.expect("=")):
            return [star_targets, literal]
        self._reset(mark)
        return None

    @memoize
    def _tmp_370(self) -> Optional[Any]:
        # _tmp_370: ')' | '**'
        mark = self._mark()
        if literal := self.expect(")"):
            return literal
        self._reset(mark)
        if literal := self.expect("**"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _tmp_371(self) -> Optional[Any]:
        # _tmp_371: '|>' | '?|>'
        mark = self._mark()
        if literal := self.expect("|>"):
            return literal
        self._reset(mark)
        if literal := self.expect("?|>"):
            return literal
        self._reset(mark)
        return None

    @memoize
    def _loop0_372(self) -> Optional[Any]:
        # _loop0_372: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _loop0_373(self) -> Optional[Any]:
        # _loop0_373: NEWLINE
        mark = self._mark()
        children = []
        while _newline := self.expect("NEWLINE"):
            children.append(_newline)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _tmp_374(self) -> Optional[Any]:
        # _tmp_374: assignment_expression | expression !':='
        mark = self._mark()
        if assignment_expression := self.assignment_expression():
            return assignment_expression
        self._reset(mark)
        if (expression := self.expression()) and (
            self.negative_lookahead(self.expect, ":=")
        ):
            return expression
        self._reset(mark)
        return None

    @memoize
    def _loop0_376(self) -> Optional[Any]:
        # _loop0_376: ',' (starred_expression | (assignment_expression | expression !':=') !'=')
        mark = self._mark()
        children = []
        while (self.expect(",")) and (elem := self._tmp_377()):
            children.append(elem)
            mark = self._mark()
        self._reset(mark)
        return children

    @memoize
    def _gather_375(self) -> Optional[Any]:
        # _gather_375: (starred_expression | (assignment_expression | expression !':=') !'=') _loop0_376
        mark = self._mark()
        if (elem := self._tmp_377()) is not None and (
            seq := self._loop0_376()
        ) is not None:
            return [elem] + seq
        self._reset(mark)
        return None

    @memoize
    def _tmp_377(self) -> Optional[Any]:
        # _tmp_377: starred_expression | (assignment_expression | expression !':=') !'='
        mark = self._mark()
        if starred_expression := self.starred_expression():
            return starred_expression
        self._reset(mark)
        if (_tmp_378 := self._tmp_378()) and (
            self.negative_lookahead(self.expect, "=")
        ):
            return _tmp_378
        self._reset(mark)
        return None

    @memoize
    def _tmp_378(self) -> Optional[Any]:
        # _tmp_378: assignment_expression | expression !':='
        mark = self._mark()
        if assignment_expression := self.assignment_expression():
            return assignment_expression
        self._reset(mark)
        if (expression := self.expression()) and (
            self.negative_lookahead(self.expect, ":=")
        ):
            return expression
        self._reset(mark)
        return None

    KEYWORDS = (
        "False",
        "None",
        "True",
        "_typh_op_force_unwrap",
        "_typh_op_optional_question",
        "as",
        "assert",
        "async",
        "await",
        "break",
        "case",
        "class",
        "continue",
        "def",
        "del",
        "elif",
        "else",
        "except",
        "finally",
        "for",
        "from",
        "global",
        "if",
        "import",
        "in",
        "is",
        "let",
        "match",
        "nonlocal",
        "not",
        "pass",
        "raise",
        "return",
        "static",
        "try",
        "var",
        "while",
        "with",
        "yield",
    )
    SOFT_KEYWORDS = ("_", "case", "match", "type")


if __name__ == "__main__":
    from pegen.parser import simple_parser_main

    simple_parser_main(TyphonParser)
