(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},
{"raise", 525},
{"yield", 585},
{"break", 527},
- {"async", 691},
- {"class", 694},
- {"while", 682},
+ {"async", 693},
+ {"class", 696},
+ {"while", 684},
{"False", 621},
{"await", 595},
{NULL, -1},
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
)
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
&&
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
&&
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
&&
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
&&
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
&&
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=':'
&&
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
&&
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)
&&
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)
&&
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'
&&
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'
&&
&&
(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
)
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
)
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
)
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
)
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
)
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)
&&
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)
&&
&&
(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
)
&&
(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)
)
&&
(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
)
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'"));
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
)
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'
&&
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'
&&
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'
&&
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'
&&
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
&&
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
&&
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)
{
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=':'
&&
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--;
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
&&
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
&&
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
&&
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
&&
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
&&
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
&&
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
&&
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
&&
&&
(_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
)
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
)
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'"));
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'"));
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'"));
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'"));
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'"));
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'"));
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'"));