You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Adjust ifelsestmtr grammer
This commit is contained in:
@@ -102,6 +102,8 @@ class Python26Parser(Python2Parser):
|
||||
|
||||
def p_stmt26(self, args):
|
||||
"""
|
||||
stmt ::= ifelsestmtr
|
||||
|
||||
# We use filler as a placeholder to keep nonterminal positions
|
||||
# the same across different grammars so that the same semantic actions
|
||||
# can be used
|
||||
@@ -173,6 +175,8 @@ class Python26Parser(Python2Parser):
|
||||
iflaststmt ::= testexpr_then c_stmts_opt JUMP_ABSOLUTE come_froms POP_TOP
|
||||
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE come_froms POP_TOP
|
||||
|
||||
ifelsestmtr ::= testexpr_then return_if_stmts returns
|
||||
|
||||
testexpr_then ::= testtrue_then
|
||||
testexpr_then ::= testfalse_then
|
||||
testtrue_then ::= expr jmp_true_then
|
||||
|
@@ -127,6 +127,8 @@ class Python27Parser(Python2Parser):
|
||||
|
||||
def p_stmt27(self, args):
|
||||
"""
|
||||
stmt ::= ifelsestmtr
|
||||
|
||||
# assert condition
|
||||
assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1
|
||||
|
||||
@@ -178,6 +180,7 @@ class Python27Parser(Python2Parser):
|
||||
ifelsestmtc ::= testexpr c_stmts_opt JUMP_ABSOLUTE else_suitec
|
||||
ifelsestmtl ::= testexpr c_stmts_opt JUMP_BACK else_suitel
|
||||
ifelsestmtl ::= testexpr c_stmts_opt CONTINUE else_suitel
|
||||
ifelsestmtr ::= testexpr return_if_stmts COME_FROM returns
|
||||
|
||||
# Common with 2.6
|
||||
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
|
||||
|
@@ -95,7 +95,7 @@ class Python3Parser(PythonParser):
|
||||
def p_grammar(self, args):
|
||||
"""
|
||||
sstmt ::= stmt
|
||||
sstmt ::= ifelsestmtr
|
||||
stmt ::= ifelsestmtr
|
||||
sstmt ::= return RETURN_LAST
|
||||
|
||||
return_if_stmts ::= return_if_stmt come_from_opt
|
||||
|
Reference in New Issue
Block a user