You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Add triple compare from 3.3 into 3.2
This commit is contained in:
BIN
test/bytecode_3.2/01_triple_compare.pyc
Normal file
BIN
test/bytecode_3.2/01_triple_compare.pyc
Normal file
Binary file not shown.
@@ -11,6 +11,7 @@ class Python32Parser(Python3Parser):
|
|||||||
def p_32to35(self, args):
|
def p_32to35(self, args):
|
||||||
"""
|
"""
|
||||||
conditional ::= expr jmp_false expr jump_forward_else expr COME_FROM
|
conditional ::= expr jmp_false expr jump_forward_else expr COME_FROM
|
||||||
|
cmp_list2 ::= expr COMPARE_OP RETURN_VALUE
|
||||||
|
|
||||||
# Store locals is only in Python 3.0 to 3.3
|
# Store locals is only in Python 3.0 to 3.3
|
||||||
stmt ::= store_locals
|
stmt ::= store_locals
|
||||||
|
@@ -15,8 +15,6 @@ class Python33Parser(Python32Parser):
|
|||||||
expr ::= yield_from
|
expr ::= yield_from
|
||||||
yield_from ::= expr expr YIELD_FROM
|
yield_from ::= expr expr YIELD_FROM
|
||||||
|
|
||||||
cmp_list2 ::= expr COMPARE_OP RETURN_VALUE
|
|
||||||
|
|
||||||
# We do the grammar hackery below for semantics
|
# We do the grammar hackery below for semantics
|
||||||
# actions that want c_stmts_opt at index 1
|
# actions that want c_stmts_opt at index 1
|
||||||
|
|
||||||
@@ -33,7 +31,9 @@ class Python33Parser(Python32Parser):
|
|||||||
|
|
||||||
def add_custom_rules(self, tokens, customize):
|
def add_custom_rules(self, tokens, customize):
|
||||||
self.remove_rules("""
|
self.remove_rules("""
|
||||||
|
# 3.3+ adds POP_BLOCKS
|
||||||
whileTruestmt ::= SETUP_LOOP l_stmts JUMP_ABSOLUTE JUMP_BACK COME_FROM_LOOP
|
whileTruestmt ::= SETUP_LOOP l_stmts JUMP_ABSOLUTE JUMP_BACK COME_FROM_LOOP
|
||||||
|
whileTruestmt ::= SETUP_LOOP l_stmts_opt 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 NOP COME_FROM_LOOP
|
||||||
whileTruestmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK 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
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK
|
||||||
|
@@ -141,6 +141,10 @@ class Python35Parser(Python34Parser):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def add_custom_rules(self, tokens, customize):
|
def add_custom_rules(self, tokens, customize):
|
||||||
|
self.remove_rules("""
|
||||||
|
# FIXME: should this be in 3.3?
|
||||||
|
whileTruestmt ::= SETUP_LOOP return_stmts COME_FROM_LOOP
|
||||||
|
""")
|
||||||
super(Python35Parser, self).add_custom_rules(tokens, customize)
|
super(Python35Parser, self).add_custom_rules(tokens, customize)
|
||||||
for i, token in enumerate(tokens):
|
for i, token in enumerate(tokens):
|
||||||
opname = token.kind
|
opname = token.kind
|
||||||
|
Reference in New Issue
Block a user