-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed as not planned
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
If I run PYTHONPATH=Tools/peg_generator ./python.exe -m pegen python Grammar/python.gram
on main
branch, the result file is broken.
There are lots of invalid syntax construct that come from C
directly.
Some examples:
@memoize
def interactive(self) -> Optional[mod_ty]:
# interactive: statement_newline
mark = self._mark()
if (
(a := self.statement_newline())
):
return _PyAST_Interactive ( a , p -> arena )
self._reset(mark)
return None
It also has this at the bottom:
return children
KEYWORDS = ('return', 'import', 'from', 'raise', 'pass', 'del', 'yield', 'assert', 'break', 'continue', 'global', 'nonlocal', 'def', 'if', 'class', 'with', 'for', 'try', 'while', 'as', 'elif', 'else', 'in', 'except', 'finally', 'None', 'True', 'False', 'or', 'and', 'not', 'is', 'lambda')
SOFT_KEYWORDS = ('match', 'case', '_')
void *
_PyPegen_parse(Parser *p)
{
// Initialize keywords
p->keywords = reserved_keywords;
p->n_keyword_lists = n_keyword_lists;
p->soft_keywords = soft_keywords;
// Run parser
void *result = NULL;
if (p->start_rule == Py_file_input) {
result = file_rule(p);
} else if (p->start_rule == Py_single_input) {
result = interactive_rule(p);
} else if (p->start_rule == Py_eval_input) {
result = eval_rule(p);
} else if (p->start_rule == Py_func_type_input) {
result = func_type_rule(p);
} else if (p->start_rule == Py_fstring_input) {
result = fstring_rule(p);
}
return result;
}
I am attaching full file to this issue: https://gist.github.com/sobolevn/37cfd12ad9d2c157e72e7589747f4ed2
Pinging @isidentical and @pablogsal
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error