mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-42218: Correctly handle errors in left-recursive rules (GH-23065)
Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
d21cb2d5ee
commit
02cdfc93f8
4 changed files with 32 additions and 0 deletions
|
|
@ -502,6 +502,9 @@ class CParserGenerator(ParserGenerator, GrammarVisitor):
|
|||
)
|
||||
self.print("p->mark = _mark;")
|
||||
self.print(f"void *_raw = {node.name}_raw(p);")
|
||||
self.print("if (p->error_indicator)")
|
||||
with self.indent():
|
||||
self.print("return NULL;")
|
||||
self.print("if (_raw == NULL || p->mark <= _resmark)")
|
||||
with self.indent():
|
||||
self.print("break;")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue