You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
3.3. grammar cleanup ...
need build_list in for BUILD_TUPLE_0
This commit is contained in:
@@ -707,7 +707,7 @@ class Python3Parser(PythonParser):
|
||||
if is_LOAD_CLOSURE:
|
||||
rule = ('load_closure ::= %s%s' % (('LOAD_CLOSURE ' * v), opname))
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
if not is_LOAD_CLOSURE:
|
||||
if not is_LOAD_CLOSURE or v == 0:
|
||||
rule = ('build_list ::= ' + 'expr1024 ' * int(v//1024) +
|
||||
'expr32 ' * int((v//32) % 32) +
|
||||
'expr ' * (v % 32) + opname)
|
||||
|
@@ -35,5 +35,16 @@ class Python33Parser(Python32Parser):
|
||||
jump_excepts ::= jump_except+
|
||||
"""
|
||||
|
||||
def add_custom_rules(self, tokens, customize):
|
||||
self.remove_rules("""
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts JUMP_ABSOLUTE JUMP_BACK COME_FROM_LOOP
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP COME_FROM_LOOP
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK NOP COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK
|
||||
POP_BLOCK JUMP_ABSOLUTE COME_FROM_LOOP
|
||||
""")
|
||||
super(Python33Parser, self).add_custom_rules(tokens, customize)
|
||||
return
|
||||
|
||||
class Python33ParserSingle(Python33Parser, PythonParserSingle):
|
||||
pass
|
||||
|
@@ -24,13 +24,8 @@ class Python34Parser(Python33Parser):
|
||||
"""
|
||||
|
||||
def add_custom_rules(self, tokens, customize):
|
||||
self.remove_rules("""
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts JUMP_ABSOLUTE JUMP_BACK COME_FROM_LOOP
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK NOP COME_FROM_LOOP
|
||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK NOP COME_FROM_LOOP
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK
|
||||
POP_BLOCK JUMP_ABSOLUTE COME_FROM_LOOP
|
||||
""")
|
||||
# self.remove_rules("""
|
||||
# """)
|
||||
super(Python34Parser, self).add_custom_rules(tokens, customize)
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user