You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Ned custom 3.7+ IfExp rules
This commit is contained in:
@@ -110,13 +110,17 @@ class Python37Parser(Python36Parser):
|
||||
jf_cfs ::= JUMP_FORWARD come_froms
|
||||
ifelsestmt ::= testexpr c_stmts_opt jf_cfs else_suite opt_come_from_except
|
||||
|
||||
jmp_false37 ::= POP_JUMP_IF_FALSE COME_FROM
|
||||
list_if ::= expr jmp_false37 list_iter
|
||||
|
||||
_ifstmts_jump ::= c_stmts_opt come_froms
|
||||
|
||||
and_not ::= expr jmp_false expr POP_JUMP_IF_TRUE
|
||||
|
||||
expr ::= conditional37
|
||||
conditional37 ::= and_not expr JUMP_FORWARD COME_FROM expr COME_FROM
|
||||
|
||||
expr ::= ifexp_37a
|
||||
expr ::= ifexp_37b
|
||||
ifexp_37a ::= and_not expr JUMP_FORWARD COME_FROM expr COME_FROM
|
||||
ifexp_37b ::= expr jmp_false expr POP_JUMP_IF_FALSE jump_forward_else expr
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
|
@@ -56,6 +56,7 @@ def customize_for_version37(self, version):
|
||||
(0, 19 ) ),
|
||||
'compare_chained2c_37': (
|
||||
'%[3]{pattr.replace("-", " ")} %p %p', (0, 19), (6, 19) ),
|
||||
'conditional37': ( '%p if %p else %p', (1, 'expr', 27), (0, 27), (4, 'expr', 27) ),
|
||||
'ifexp_37a': ( '%p if %p else %p', (1, 'expr', 27), (0, 27), (4, 'expr', 27) ),
|
||||
'ifexp_37b': ( '%p if %p else %p', (2, 'expr', 27), (0, 'expr', 27), (5, 'expr', 27) ),
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user