Allow the parser to avoid nested processing of invalid rules (GH-31252)

This commit is contained in:
Pablo Galindo Salgado 2022-02-10 13:12:14 +00:00 committed by GitHub
parent 2cea8c29cf
commit 390459de6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 1998 additions and 1997 deletions

View file

@ -381,6 +381,7 @@ _PyPegen_expect_token(Parser *p, int type)
}
Token *t = p->tokens[p->mark];
if (t->type != type) {
if (Py_DebugFlag) fprintf(stderr, "Token = %s\n", PyBytes_AsString(t->bytes));
return NULL;
}
p->mark += 1;
@ -785,7 +786,6 @@ _PyPegen_Parser_New(struct tok_state *tok, int start_rule, int flags,
p->known_err_token = NULL;
p->level = 0;
p->call_invalid_rules = 0;
p->in_raw_rule = 0;
return p;
}