You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Simpilfy grammar via ending_return
This commit is contained in:
@@ -304,6 +304,9 @@ class PythonParser(GenericASTBuilder):
|
|||||||
c_stmts ::= lastc_stmt
|
c_stmts ::= lastc_stmt
|
||||||
c_stmts ::= continues
|
c_stmts ::= continues
|
||||||
|
|
||||||
|
ending_return ::= RETURN_VALUE RETURN_LAST
|
||||||
|
ending_return ::= RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
||||||
|
|
||||||
lastc_stmt ::= iflaststmt
|
lastc_stmt ::= iflaststmt
|
||||||
lastc_stmt ::= forelselaststmt
|
lastc_stmt ::= forelselaststmt
|
||||||
lastc_stmt ::= ifelsestmtc
|
lastc_stmt ::= ifelsestmtc
|
||||||
|
@@ -39,14 +39,10 @@ class Python27Parser(Python2Parser):
|
|||||||
stmt ::= dict_comp_func
|
stmt ::= dict_comp_func
|
||||||
|
|
||||||
dict_comp_func ::= BUILD_MAP_0 LOAD_FAST FOR_ITER store
|
dict_comp_func ::= BUILD_MAP_0 LOAD_FAST FOR_ITER store
|
||||||
comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST
|
comp_iter JUMP_BACK ending_return
|
||||||
dict_comp_func ::= BUILD_MAP_0 LOAD_FAST FOR_ITER store
|
|
||||||
comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
JUMP_BACK ending_return
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
|
||||||
JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
comp_iter ::= comp_if_not
|
comp_iter ::= comp_if_not
|
||||||
comp_if_not ::= expr jmp_true comp_iter
|
comp_if_not ::= expr jmp_true comp_iter
|
||||||
|
@@ -79,19 +79,13 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
stmt ::= set_comp_func
|
stmt ::= set_comp_func
|
||||||
|
|
||||||
|
# TODO this can be simplified
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
JUMP_BACK ending_return
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
|
||||||
JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
JUMP_BACK ending_return
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter
|
|
||||||
JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
||||||
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
|
COME_FROM JUMP_BACK ending_return
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter
|
|
||||||
COME_FROM JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
comp_body ::= dict_comp_body
|
comp_body ::= dict_comp_body
|
||||||
comp_body ::= set_comp_body
|
comp_body ::= set_comp_body
|
||||||
|
@@ -77,12 +77,8 @@ class Python30Parser(Python31Parser):
|
|||||||
|
|
||||||
set_comp_func ::= set_comp_header
|
set_comp_func ::= set_comp_header
|
||||||
LOAD_ARG FOR_ITER store comp_iter
|
LOAD_ARG FOR_ITER store comp_iter
|
||||||
JUMP_BACK
|
JUMP_BACK ending_return
|
||||||
RETURN_VALUE RETURN_LAST
|
RETURN_VALUE RETURN_LAST
|
||||||
set_comp_func ::= set_comp_header
|
|
||||||
LOAD_ARG FOR_ITER store comp_iter
|
|
||||||
JUMP_BACK
|
|
||||||
RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
list_comp_header ::= BUILD_LIST_0 DUP_TOP STORE_FAST
|
list_comp_header ::= BUILD_LIST_0 DUP_TOP STORE_FAST
|
||||||
list_comp ::= list_comp_header
|
list_comp ::= list_comp_header
|
||||||
@@ -112,11 +108,7 @@ class Python30Parser(Python31Parser):
|
|||||||
dict_comp_func ::= BUILD_MAP_0
|
dict_comp_func ::= BUILD_MAP_0
|
||||||
DUP_TOP STORE_FAST
|
DUP_TOP STORE_FAST
|
||||||
LOAD_ARG FOR_ITER store
|
LOAD_ARG FOR_ITER store
|
||||||
dict_comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST
|
dict_comp_iter JUMP_BACK ending_return
|
||||||
dict_comp_func ::= BUILD_MAP_0
|
|
||||||
DUP_TOP STORE_FAST
|
|
||||||
LOAD_ARG FOR_ITER store
|
|
||||||
dict_comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
stmt ::= try_except30
|
stmt ::= try_except30
|
||||||
try_except30 ::= SETUP_EXCEPT suite_stmts_opt
|
try_except30 ::= SETUP_EXCEPT suite_stmts_opt
|
||||||
|
@@ -62,6 +62,9 @@ class Python37Parser(Python37BaseParser):
|
|||||||
c_stmts ::= lastc_stmt
|
c_stmts ::= lastc_stmt
|
||||||
c_stmts ::= continues
|
c_stmts ::= continues
|
||||||
|
|
||||||
|
ending_return ::= RETURN_VALUE RETURN_LAST
|
||||||
|
ending_return ::= RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
||||||
|
|
||||||
lastc_stmt ::= iflaststmt
|
lastc_stmt ::= iflaststmt
|
||||||
lastc_stmt ::= forelselaststmt
|
lastc_stmt ::= forelselaststmt
|
||||||
lastc_stmt ::= ifelsestmtc
|
lastc_stmt ::= ifelsestmtc
|
||||||
@@ -739,15 +742,11 @@ class Python37Parser(Python37BaseParser):
|
|||||||
|
|
||||||
stmt ::= set_comp_func
|
stmt ::= set_comp_func
|
||||||
|
|
||||||
|
# TODO: simplify this
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE RETURN_LAST
|
JUMP_BACK ending_return
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
||||||
JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
COME_FROM JUMP_BACK ending_return
|
||||||
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
|
||||||
COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST
|
|
||||||
set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter
|
|
||||||
COME_FROM JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
comp_body ::= dict_comp_body
|
comp_body ::= dict_comp_body
|
||||||
comp_body ::= set_comp_body
|
comp_body ::= set_comp_body
|
||||||
@@ -763,9 +762,7 @@ class Python37Parser(Python37BaseParser):
|
|||||||
stmt ::= dict_comp_func
|
stmt ::= dict_comp_func
|
||||||
|
|
||||||
dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store
|
dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store
|
||||||
comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST
|
comp_iter JUMP_BACK ending_return
|
||||||
dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store
|
|
||||||
comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER
|
|
||||||
|
|
||||||
comp_iter ::= comp_if
|
comp_iter ::= comp_if
|
||||||
comp_iter ::= comp_if_not
|
comp_iter ::= comp_if_not
|
||||||
|
@@ -121,7 +121,8 @@ class Python38Parser(Python37Parser):
|
|||||||
for38 ::= expr get_for_iter store for_block
|
for38 ::= expr get_for_iter store for_block
|
||||||
|
|
||||||
forelsestmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suite
|
forelsestmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suite
|
||||||
forelsestmt38 ::= expr get_for_iter store for_block JUMP_BACK _come_froms else_suite
|
forelsestmt38 ::= expr get_for_iter store for_block JUMP_BACK _come_froms
|
||||||
|
else_suite
|
||||||
|
|
||||||
forelselaststmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suitec
|
forelselaststmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suitec
|
||||||
forelselaststmtl38 ::= expr get_for_iter store for_block POP_BLOCK else_suitel
|
forelselaststmtl38 ::= expr get_for_iter store for_block POP_BLOCK else_suitel
|
||||||
@@ -130,7 +131,8 @@ class Python38Parser(Python37Parser):
|
|||||||
except_return_value ::= POP_BLOCK return
|
except_return_value ::= POP_BLOCK return
|
||||||
except_return_value ::= expr POP_BLOCK RETURN_VALUE
|
except_return_value ::= expr POP_BLOCK RETURN_VALUE
|
||||||
|
|
||||||
whilestmt38 ::= _come_froms testexpr l_stmts_opt COME_FROM JUMP_BACK POP_BLOCK
|
whilestmt38 ::= _come_froms testexpr l_stmts_opt COME_FROM JUMP_BACK
|
||||||
|
POP_BLOCK
|
||||||
whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||||
whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK come_froms
|
whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK come_froms
|
||||||
whilestmt38 ::= _come_froms testexpr returns POP_BLOCK
|
whilestmt38 ::= _come_froms testexpr returns POP_BLOCK
|
||||||
|
Reference in New Issue
Block a user