You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Grammar isolation
This commit is contained in:
@@ -419,7 +419,6 @@ class PythonParser(GenericASTBuilder):
|
|||||||
gen_comp_body ::= expr YIELD_VALUE POP_TOP
|
gen_comp_body ::= expr YIELD_VALUE POP_TOP
|
||||||
|
|
||||||
comp_if ::= expr jmp_false comp_iter
|
comp_if ::= expr jmp_false comp_iter
|
||||||
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_expr(self, args):
|
def p_expr(self, args):
|
||||||
@@ -478,9 +477,6 @@ class PythonParser(GenericASTBuilder):
|
|||||||
expr ::= conditional
|
expr ::= conditional
|
||||||
conditional ::= expr jmp_false expr JUMP_FORWARD expr COME_FROM
|
conditional ::= expr jmp_false expr JUMP_FORWARD expr COME_FROM
|
||||||
|
|
||||||
expr ::= conditionalTrue
|
|
||||||
conditionalTrue ::= expr JUMP_FORWARD expr COME_FROM
|
|
||||||
|
|
||||||
ret_expr ::= expr
|
ret_expr ::= expr
|
||||||
ret_expr ::= ret_and
|
ret_expr ::= ret_and
|
||||||
ret_expr ::= ret_or
|
ret_expr ::= ret_or
|
||||||
|
@@ -90,7 +90,6 @@ class Python2Parser(PythonParser):
|
|||||||
stmt ::= exec_stmt
|
stmt ::= exec_stmt
|
||||||
|
|
||||||
del_stmt ::= expr DELETE_SLICE+0
|
del_stmt ::= expr DELETE_SLICE+0
|
||||||
del_stmt ::= expr expr DELETE_SLICE+1
|
|
||||||
del_stmt ::= expr expr DELETE_SLICE+2
|
del_stmt ::= expr expr DELETE_SLICE+2
|
||||||
del_stmt ::= expr expr expr DELETE_SLICE+3
|
del_stmt ::= expr expr expr DELETE_SLICE+3
|
||||||
del_stmt ::= delete_subscr
|
del_stmt ::= delete_subscr
|
||||||
|
@@ -33,6 +33,8 @@ class Python27Parser(Python2Parser):
|
|||||||
|
|
||||||
comp_body ::= dict_comp_body
|
comp_body ::= dict_comp_body
|
||||||
comp_body ::= set_comp_body
|
comp_body ::= set_comp_body
|
||||||
|
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||||
|
|
||||||
dict_comp_body ::= expr expr MAP_ADD
|
dict_comp_body ::= expr expr MAP_ADD
|
||||||
set_comp_body ::= expr SET_ADD
|
set_comp_body ::= expr SET_ADD
|
||||||
|
|
||||||
@@ -84,6 +86,9 @@ class Python27Parser(Python2Parser):
|
|||||||
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP JUMP_IF_FALSE_OR_POP
|
compare_chained1 ::= expr DUP_TOP ROT_THREE COMPARE_OP JUMP_IF_FALSE_OR_POP
|
||||||
compare_chained2 COME_FROM
|
compare_chained2 COME_FROM
|
||||||
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE
|
compare_chained2 ::= expr COMPARE_OP RETURN_VALUE
|
||||||
|
|
||||||
|
expr ::= conditionalTrue
|
||||||
|
conditionalTrue ::= expr JUMP_FORWARD expr COME_FROM
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_stmt27(self, args):
|
def p_stmt27(self, args):
|
||||||
@@ -94,6 +99,7 @@ class Python27Parser(Python2Parser):
|
|||||||
# assert condition, expr
|
# assert condition, expr
|
||||||
assert2 ::= assert_expr jmp_true LOAD_ASSERT expr CALL_FUNCTION_1 RAISE_VARARGS_1
|
assert2 ::= assert_expr jmp_true LOAD_ASSERT expr CALL_FUNCTION_1 RAISE_VARARGS_1
|
||||||
|
|
||||||
|
del_stmt ::= expr expr DELETE_SLICE+1
|
||||||
|
|
||||||
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
withstmt ::= expr SETUP_WITH POP_TOP suite_stmts_opt
|
||||||
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
POP_BLOCK LOAD_CONST COME_FROM_WITH
|
||||||
|
@@ -42,6 +42,7 @@ class Python3Parser(PythonParser):
|
|||||||
# as a CONTINUE. The two are kind of the same in a comprehension.
|
# as a CONTINUE. The two are kind of the same in a comprehension.
|
||||||
|
|
||||||
comp_for ::= expr _for designator comp_iter CONTINUE
|
comp_for ::= expr _for designator comp_iter CONTINUE
|
||||||
|
comp_for ::= expr _for designator comp_iter JUMP_BACK
|
||||||
|
|
||||||
list_for ::= expr FOR_ITER designator list_iter jb_or_c
|
list_for ::= expr FOR_ITER designator list_iter jb_or_c
|
||||||
|
|
||||||
@@ -279,6 +280,9 @@ class Python3Parser(PythonParser):
|
|||||||
for_block ::= l_stmts_opt opt_come_from_loop JUMP_BACK
|
for_block ::= l_stmts_opt opt_come_from_loop JUMP_BACK
|
||||||
for_block ::= l_stmts
|
for_block ::= l_stmts
|
||||||
iflaststmtl ::= testexpr c_stmts_opt
|
iflaststmtl ::= testexpr c_stmts_opt
|
||||||
|
|
||||||
|
expr ::= conditionalTrue
|
||||||
|
conditionalTrue ::= expr JUMP_FORWARD expr COME_FROM
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_def_annotations3(self, args):
|
def p_def_annotations3(self, args):
|
||||||
|
Reference in New Issue
Block a user