diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2021-08-12 16:37:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 16:37:30 (GMT) |
commit | 953d27261e455066b17a106d9e07bab3bf12983b (patch) | |
tree | 98739da681414ff6117897a56eb90120d3dad069 /Parser/pegen.c | |
parent | 8e832fb2a2cb54d7262148b6ec15563dffb48d63 (diff) | |
download | cpython-953d27261e455066b17a106d9e07bab3bf12983b.zip cpython-953d27261e455066b17a106d9e07bab3bf12983b.tar.gz cpython-953d27261e455066b17a106d9e07bab3bf12983b.tar.bz2 |
Update pegen to use the latest upstream developments (GH-27586)
Diffstat (limited to 'Parser/pegen.c')
-rw-r--r-- | Parser/pegen.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c index f697f00..c77c534 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -897,6 +897,19 @@ _PyPegen_expect_token(Parser *p, int type) return t; } +void* +_PyPegen_expect_forced_result(Parser *p, void* result, const char* expected) { + + if (p->error_indicator == 1) { + return NULL; + } + if (result == NULL) { + RAISE_SYNTAX_ERROR("expected (%s)", expected); + return NULL; + } + return result; +} + Token * _PyPegen_expect_forced_token(Parser *p, int type, const char* expected) { |