Fragment fixes (and workarounds)

fragments.py: add more parent offsets. blacken buffer
parser3.py: additional grammar rules for fragment parser

Misc small typos and corrections
This commit is contained in:
rocky
2019-10-12 12:22:27 -04:00
parent 0cf32f1b70
commit 163e47fb49
4 changed files with 620 additions and 473 deletions

View File

@@ -68,6 +68,11 @@ class Python3Parser(PythonParser):
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
JUMP_BACK RETURN_VALUE RETURN_LAST
# FIXME: This is used only in the fragment parser
# Fix the fragment parser so that it adds RETURN_LAST
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
JUMP_BACK RETURN_VALUE
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
@@ -341,6 +346,10 @@ class Python3Parser(PythonParser):
stmt ::= return_closure
return_closure ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
# FIXME: This is used only in the fragment parser
# Fix the fragment parser so that it adds RETURN_LAST
return_closure ::= LOAD_CLOSURE RETURN_VALUE
stmt ::= whileTruestmt
ifelsestmt ::= testexpr c_stmts_opt JUMP_FORWARD else_suite _come_froms
"""