https://github.com/python/cpython/commit/99b71efe8e9d59ce04b6d59ed166b57dff3e84d8 commit: 99b71efe8e9d59ce04b6d59ed166b57dff3e84d8 branch: main author: Steele Farnsworth <swfarnswo...@gmail.com> committer: pablogsal <pablog...@gmail.com> date: 2025-04-25T01:25:48Z summary:
gh-129858: Special syntax error for `elif` block after `else` (#129902) files: A Misc/NEWS.d/next/Core_and_Builtins/2025-02-12-01-36-13.gh-issue-129858.M-f7Gb.rst M Doc/whatsnew/3.14.rst M Grammar/python.gram M Lib/test/test_syntax.py M Parser/parser.c diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 379632bb62a179..3893060b153210 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -348,6 +348,21 @@ Improved error messages ^^^^^^^ ValueError: too many values to unpack (expected 3, got 4) +* :keyword:`elif` statements that follow an :keyword:`else` block now have a specific error message. + (Contributed by Steele Farnsworth in :gh:`129902`.) + + .. code-block:: pycon + + >>> if who == "me": + ... print("It's me!") + ... else: + ... print("It's not me!") + ... elif who is None: + ... print("Who is it?") + File "<stdin>", line 5 + elif who is None: + ^^^^ + SyntaxError: 'elif' block follows an 'else' block * If a statement (:keyword:`pass`, :keyword:`del`, :keyword:`return`, :keyword:`yield`, :keyword:`raise`, :keyword:`break`, :keyword:`continue`, diff --git a/Grammar/python.gram b/Grammar/python.gram index c02dfed59a3149..c7563aba0adaa7 100644 --- a/Grammar/python.gram +++ b/Grammar/python.gram @@ -1422,6 +1422,7 @@ invalid_elif_stmt: invalid_else_stmt: | a='else' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) } + | 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("'elif' block follows an 'else' block")} invalid_while_stmt: | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") } | a='while' named_expression ':' NEWLINE !INDENT { diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 8cae62459bb675..4c001f9c9b02e0 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -948,6 +948,18 @@ ... SyntaxError: 'break' outside loop +elif can't come after an else. + + >>> if a % 2 == 0: + ... pass + ... else: + ... pass + ... elif a % 2 == 1: + ... pass + Traceback (most recent call last): + ... + SyntaxError: 'elif' block follows an 'else' block + Misuse of the nonlocal and global statement can lead to a few unique syntax errors. >>> def f(): diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-02-12-01-36-13.gh-issue-129858.M-f7Gb.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-12-01-36-13.gh-issue-129858.M-f7Gb.rst new file mode 100644 index 00000000000000..2d2c88ba48dbf4 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-02-12-01-36-13.gh-issue-129858.M-f7Gb.rst @@ -0,0 +1 @@ +``elif`` statements that follow an ``else`` block now have a specific error message. diff --git a/Parser/parser.c b/Parser/parser.c index 35a057af37e9e9..0cc43cefa1b818 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -23,26 +23,26 @@ static KeywordToken *reserved_keywords[] = { (KeywordToken[]) { {"if", 677}, {"as", 675}, - {"in", 688}, + {"in", 690}, {"or", 586}, {"is", 594}, {NULL, -1}, }, (KeywordToken[]) { {"del", 622}, - {"def", 692}, - {"for", 687}, + {"def", 694}, + {"for", 689}, {"try", 651}, {"and", 587}, - {"not", 696}, + {"not", 698}, {NULL, -1}, }, (KeywordToken[]) { {"from", 630}, {"pass", 526}, {"with", 642}, - {"elif", 679}, - {"else", 680}, + {"elif", 682}, + {"else", 681}, {"None", 620}, {"True", 619}, {NULL, -1}, @@ -51,9 +51,9 @@ static KeywordToken *reserved_keywords[] = { {"raise", 525}, {"yield", 585}, {"break", 527}, - {"async", 691}, - {"class", 694}, - {"while", 682}, + {"async", 693}, + {"class", 696}, + {"while", 684}, {"False", 621}, {"await", 595}, {NULL, -1}, @@ -2013,7 +2013,7 @@ compound_stmt_rule(Parser *p) D(fprintf(stderr, "%*c> compound_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "&'while' while_stmt")); stmt_ty while_stmt_var; if ( - _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 682) // token='while' + _PyPegen_lookahead_with_int(1, _PyPegen_expect_token, p, 684) // token='while' && (while_stmt_var = while_stmt_rule(p)) // while_stmt ) @@ -4336,7 +4336,7 @@ class_def_raw_rule(Parser *p) asdl_stmt_seq* c; void *t; if ( - (_keyword = _PyPegen_expect_token(p, 694)) // token='class' + (_keyword = _PyPegen_expect_token(p, 696)) // token='class' && (a = _PyPegen_name_token(p)) // NAME && @@ -4503,7 +4503,7 @@ function_def_raw_rule(Parser *p) void *t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 692)) // token='def' + (_keyword = _PyPegen_expect_token(p, 694)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -4564,9 +4564,9 @@ function_def_raw_rule(Parser *p) void *t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' && - (_keyword_1 = _PyPegen_expect_token(p, 692)) // token='def' + (_keyword_1 = _PyPegen_expect_token(p, 694)) // token='def' && (n = _PyPegen_name_token(p)) // NAME && @@ -6044,7 +6044,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; stmt_ty c; if ( - (_keyword = _PyPegen_expect_token(p, 679)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 682)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -6089,7 +6089,7 @@ elif_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 679)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 682)) // token='elif' && (a = named_expression_rule(p)) // named_expression && @@ -6170,7 +6170,7 @@ else_block_rule(Parser *p) Token * _literal; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword = _PyPegen_expect_token(p, 681)) // token='else' && (_literal = _PyPegen_expect_forced_token(p, 11, ":")) // forced_token=':' && @@ -6249,7 +6249,7 @@ while_stmt_rule(Parser *p) asdl_stmt_seq* b; void *c; if ( - (_keyword = _PyPegen_expect_token(p, 682)) // token='while' + (_keyword = _PyPegen_expect_token(p, 684)) // token='while' && (a = named_expression_rule(p)) // named_expression && @@ -6349,11 +6349,11 @@ for_stmt_rule(Parser *p) expr_ty t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 690)) // token='in' && (_cut_var = 1) && @@ -6411,13 +6411,13 @@ for_stmt_rule(Parser *p) expr_ty t; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' && - (_keyword_1 = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='for' && (t = star_targets_rule(p)) // star_targets && - (_keyword_2 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_2 = _PyPegen_expect_token(p, 690)) // token='in' && (_cut_var = 1) && @@ -6646,7 +6646,7 @@ with_stmt_rule(Parser *p) asdl_withitem_seq* a; asdl_stmt_seq* b; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' && (_keyword_1 = _PyPegen_expect_token(p, 642)) // token='with' && @@ -6698,7 +6698,7 @@ with_stmt_rule(Parser *p) asdl_stmt_seq* b; void *tc; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' && (_keyword_1 = _PyPegen_expect_token(p, 642)) // token='with' && @@ -11254,7 +11254,7 @@ expression_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 681)) // token='else' && (c = expression_rule(p)) // expression ) @@ -12136,7 +12136,7 @@ inversion_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 696)) // token='not' + (_keyword = _PyPegen_expect_token(p, 698)) // token='not' && (a = inversion_rule(p)) // inversion ) @@ -12790,9 +12790,9 @@ notin_bitwise_or_rule(Parser *p) Token * _keyword_1; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 696)) // token='not' + (_keyword = _PyPegen_expect_token(p, 698)) // token='not' && - (_keyword_1 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 690)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12838,7 +12838,7 @@ in_bitwise_or_rule(Parser *p) Token * _keyword; expr_ty a; if ( - (_keyword = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword = _PyPegen_expect_token(p, 690)) // token='in' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -12887,7 +12887,7 @@ isnot_bitwise_or_rule(Parser *p) if ( (_keyword = _PyPegen_expect_token(p, 594)) // token='is' && - (_keyword_1 = _PyPegen_expect_token(p, 696)) // token='not' + (_keyword_1 = _PyPegen_expect_token(p, 698)) // token='not' && (a = bitwise_or_rule(p)) // bitwise_or ) @@ -17058,13 +17058,13 @@ for_if_clause_rule(Parser *p) expr_ty b; asdl_expr_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' && - (_keyword_1 = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword_1 = _PyPegen_expect_token(p, 689)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_2 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_2 = _PyPegen_expect_token(p, 690)) // token='in' && (_cut_var = 1) && @@ -17103,11 +17103,11 @@ for_if_clause_rule(Parser *p) expr_ty b; asdl_expr_seq* c; if ( - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' && (a = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 690)) // token='in' && (_cut_var = 1) && @@ -20412,7 +20412,7 @@ expression_without_invalid_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 681)) // token='else' && (c = expression_rule(p)) // expression ) @@ -20748,7 +20748,7 @@ invalid_expression_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 681)) // token='else' && _PyPegen_lookahead(0, (void *(*)(Parser *)) expression_rule, p) ) @@ -20784,7 +20784,7 @@ invalid_expression_rule(Parser *p) && (b = disjunction_rule(p)) // disjunction && - (_keyword_1 = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword_1 = _PyPegen_expect_token(p, 681)) // token='else' && (c = simple_stmt_rule(p)) // simple_stmt ) @@ -22770,13 +22770,13 @@ invalid_for_if_clause_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings void *_tmp_133_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' && (_tmp_133_var = _tmp_133_rule(p)) // bitwise_or ((',' bitwise_or))* ','? && - _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 688) // token='in' + _PyPegen_lookahead_with_int(0, _PyPegen_expect_token, p, 690) // token='in' ) { D(fprintf(stderr, "%*c+ invalid_for_if_clause[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'? 'for' (bitwise_or ((',' bitwise_or))* ','?) !'in'")); @@ -22822,9 +22822,9 @@ invalid_for_target_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings expr_ty a; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' && (a = star_expressions_rule(p)) // star_expressions ) @@ -23109,7 +23109,7 @@ invalid_with_stmt_rule(Parser *p) UNUSED(_opt_var); // Silence compiler warnings Token * newline_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && (_keyword = _PyPegen_expect_token(p, 642)) // token='with' && @@ -23147,7 +23147,7 @@ invalid_with_stmt_rule(Parser *p) UNUSED(_opt_var_1); // Silence compiler warnings Token * newline_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && (_keyword = _PyPegen_expect_token(p, 642)) // token='with' && @@ -23209,7 +23209,7 @@ invalid_with_stmt_indent_rule(Parser *p) Token * a; Token * newline_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && (a = _PyPegen_expect_token(p, 642)) // token='with' && @@ -23252,7 +23252,7 @@ invalid_with_stmt_indent_rule(Parser *p) Token * a; Token * newline_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && (a = _PyPegen_expect_token(p, 642)) // token='with' && @@ -24477,7 +24477,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 679)) // token='elif' + (_keyword = _PyPegen_expect_token(p, 682)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -24508,7 +24508,7 @@ invalid_elif_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 679)) // token='elif' + (a = _PyPegen_expect_token(p, 682)) // token='elif' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -24538,7 +24538,7 @@ invalid_elif_stmt_rule(Parser *p) return _res; } -// invalid_else_stmt: 'else' ':' NEWLINE !INDENT +// invalid_else_stmt: 'else' ':' NEWLINE !INDENT | 'else' ':' block 'elif' static void * invalid_else_stmt_rule(Parser *p) { @@ -24561,7 +24561,7 @@ invalid_else_stmt_rule(Parser *p) Token * a; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 680)) // token='else' + (a = _PyPegen_expect_token(p, 681)) // token='else' && (_literal = _PyPegen_expect_token(p, 11)) // token=':' && @@ -24583,6 +24583,39 @@ invalid_else_stmt_rule(Parser *p) D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ', p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' NEWLINE !INDENT")); } + { // 'else' ':' block 'elif' + if (p->error_indicator) { + p->level--; + return NULL; + } + D(fprintf(stderr, "%*c> invalid_else_stmt[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else' ':' block 'elif'")); + Token * _keyword; + Token * _keyword_1; + Token * _literal; + asdl_stmt_seq* block_var; + if ( + (_keyword = _PyPegen_expect_token(p, 681)) // token='else' + && + (_literal = _PyPegen_expect_token(p, 11)) // token=':' + && + (block_var = block_rule(p)) // block + && + (_keyword_1 = _PyPegen_expect_token(p, 682)) // token='elif' + ) + { + D(fprintf(stderr, "%*c+ invalid_else_stmt[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else' ':' block 'elif'")); + _res = RAISE_SYNTAX_ERROR ( "'elif' block follows an 'else' block" ); + if (_res == NULL && PyErr_Occurred()) { + p->error_indicator = 1; + p->level--; + return NULL; + } + goto done; + } + p->mark = _mark; + D(fprintf(stderr, "%*c%s invalid_else_stmt[%d-%d]: %s failed!\n", p->level, ' ', + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'else' ':' block 'elif'")); + } _res = NULL; done: p->level--; @@ -24614,7 +24647,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 682)) // token='while' + (_keyword = _PyPegen_expect_token(p, 684)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -24645,7 +24678,7 @@ invalid_while_stmt_rule(Parser *p) expr_ty named_expression_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 682)) // token='while' + (a = _PyPegen_expect_token(p, 684)) // token='while' && (named_expression_var = named_expression_rule(p)) // named_expression && @@ -24704,13 +24737,13 @@ invalid_for_stmt_rule(Parser *p) expr_ty star_expressions_var; expr_ty star_targets_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' && (star_targets_var = star_targets_rule(p)) // star_targets && - (_keyword_1 = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword_1 = _PyPegen_expect_token(p, 690)) // token='in' && (star_expressions_var = star_expressions_rule(p)) // star_expressions && @@ -24745,13 +24778,13 @@ invalid_for_stmt_rule(Parser *p) expr_ty star_expressions_var; expr_ty star_targets_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (a = _PyPegen_expect_token(p, 687)) // token='for' + (a = _PyPegen_expect_token(p, 689)) // token='for' && (star_targets_var = star_targets_rule(p)) // star_targets && - (_keyword = _PyPegen_expect_token(p, 688)) // token='in' + (_keyword = _PyPegen_expect_token(p, 690)) // token='in' && (star_expressions_var = star_expressions_rule(p)) // star_expressions && @@ -24817,9 +24850,9 @@ invalid_def_raw_rule(Parser *p) expr_ty name_var; Token * newline_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (a = _PyPegen_expect_token(p, 692)) // token='def' + (a = _PyPegen_expect_token(p, 694)) // token='def' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -24876,9 +24909,9 @@ invalid_def_raw_rule(Parser *p) asdl_stmt_seq* block_var; expr_ty name_var; if ( - (_opt_var = _PyPegen_expect_token(p, 691), !p->error_indicator) // 'async'? + (_opt_var = _PyPegen_expect_token(p, 693), !p->error_indicator) // 'async'? && - (_keyword = _PyPegen_expect_token(p, 692)) // token='def' + (_keyword = _PyPegen_expect_token(p, 694)) // token='def' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -24942,7 +24975,7 @@ invalid_class_def_raw_rule(Parser *p) expr_ty name_var; Token * newline_var; if ( - (_keyword = _PyPegen_expect_token(p, 694)) // token='class' + (_keyword = _PyPegen_expect_token(p, 696)) // token='class' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -24981,7 +25014,7 @@ invalid_class_def_raw_rule(Parser *p) expr_ty name_var; Token * newline_var; if ( - (a = _PyPegen_expect_token(p, 694)) // token='class' + (a = _PyPegen_expect_token(p, 696)) // token='class' && (name_var = _PyPegen_name_token(p)) // NAME && @@ -25799,7 +25832,7 @@ invalid_arithmetic_rule(Parser *p) && (_tmp_150_var = _tmp_150_rule(p)) // '+' | '-' | '*' | '/' | '%' | '//' | '@' && - (a = _PyPegen_expect_token(p, 696)) // token='not' + (a = _PyPegen_expect_token(p, 698)) // token='not' && (b = inversion_rule(p)) // inversion ) @@ -25848,7 +25881,7 @@ invalid_factor_rule(Parser *p) if ( (_tmp_151_var = _tmp_151_rule(p)) // '+' | '-' | '~' && - (a = _PyPegen_expect_token(p, 696)) // token='not' + (a = _PyPegen_expect_token(p, 698)) // token='not' && (b = factor_rule(p)) // factor ) @@ -26252,7 +26285,7 @@ _tmp_6_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'def'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 692)) // token='def' + (_keyword = _PyPegen_expect_token(p, 694)) // token='def' ) { D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'def'")); @@ -26290,7 +26323,7 @@ _tmp_6_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_6[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' ) { D(fprintf(stderr, "%*c+ _tmp_6[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); @@ -26328,7 +26361,7 @@ _tmp_7_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_7[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'class'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 694)) // token='class' + (_keyword = _PyPegen_expect_token(p, 696)) // token='class' ) { D(fprintf(stderr, "%*c+ _tmp_7[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'class'")); @@ -26404,7 +26437,7 @@ _tmp_8_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_8[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' ) { D(fprintf(stderr, "%*c+ _tmp_8[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); @@ -26442,7 +26475,7 @@ _tmp_9_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'for'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 687)) // token='for' + (_keyword = _PyPegen_expect_token(p, 689)) // token='for' ) { D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'for'")); @@ -26461,7 +26494,7 @@ _tmp_9_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_9[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'async'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 691)) // token='async' + (_keyword = _PyPegen_expect_token(p, 693)) // token='async' ) { D(fprintf(stderr, "%*c+ _tmp_9[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'async'")); @@ -32819,7 +32852,7 @@ _tmp_113_rule(Parser *p) D(fprintf(stderr, "%*c> _tmp_113[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'else'")); Token * _keyword; if ( - (_keyword = _PyPegen_expect_token(p, 680)) // token='else' + (_keyword = _PyPegen_expect_token(p, 681)) // token='else' ) { D(fprintf(stderr, "%*c+ _tmp_113[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'else'")); _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com