mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Fix lookahead of soft keywords in the PEG parser (GH-20436)
Automerge-Triggered-By: @gvanrossum
This commit is contained in:
parent
21fda91f8d
commit
404b23b85b
4 changed files with 31 additions and 2 deletions
|
@ -718,6 +718,15 @@ _PyPegen_lookahead_with_name(int positive, expr_ty (func)(Parser *), Parser *p)
|
|||
return (res != NULL) == positive;
|
||||
}
|
||||
|
||||
int
|
||||
_PyPegen_lookahead_with_string(int positive, expr_ty (func)(Parser *, const char*), Parser *p, const char* arg)
|
||||
{
|
||||
int mark = p->mark;
|
||||
void *res = func(p, arg);
|
||||
p->mark = mark;
|
||||
return (res != NULL) == positive;
|
||||
}
|
||||
|
||||
int
|
||||
_PyPegen_lookahead_with_int(int positive, Token *(func)(Parser *, int), Parser *p, int arg)
|
||||
{
|
||||
|
|
|
@ -119,6 +119,7 @@ int _PyPegen_is_memoized(Parser *p, int type, void *pres);
|
|||
|
||||
int _PyPegen_lookahead_with_name(int, expr_ty (func)(Parser *), Parser *);
|
||||
int _PyPegen_lookahead_with_int(int, Token *(func)(Parser *, int), Parser *, int);
|
||||
int _PyPegen_lookahead_with_string(int , expr_ty (func)(Parser *, const char*), Parser *, const char*);
|
||||
int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *);
|
||||
|
||||
Token *_PyPegen_expect_token(Parser *p, int type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue