You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Extend "and" reduction-rule test to 2.4
This commit is contained in:
@@ -341,8 +341,7 @@ class Python26Parser(Python2Parser):
|
|||||||
WITH_CLEANUP END_FINALLY
|
WITH_CLEANUP END_FINALLY
|
||||||
""")
|
""")
|
||||||
super(Python26Parser, self).customize_grammar_rules(tokens, customize)
|
super(Python26Parser, self).customize_grammar_rules(tokens, customize)
|
||||||
if self.version >= 2.6:
|
self.check_reduce['and'] = 'AST'
|
||||||
self.check_reduce['and'] = 'AST'
|
|
||||||
self.check_reduce['assert_expr_and'] = 'AST'
|
self.check_reduce['assert_expr_and'] = 'AST'
|
||||||
self.check_reduce['list_for'] = 'AST'
|
self.check_reduce['list_for'] = 'AST'
|
||||||
self.check_reduce['try_except'] = 'tokens'
|
self.check_reduce['try_except'] = 'tokens'
|
||||||
@@ -380,6 +379,7 @@ class Python26Parser(Python2Parser):
|
|||||||
# or that it jumps to the same place as the end of "and"
|
# or that it jumps to the same place as the end of "and"
|
||||||
jmp_false = ast[1][0]
|
jmp_false = ast[1][0]
|
||||||
jmp_target = jmp_false.offset + jmp_false.attr + 3
|
jmp_target = jmp_false.offset + jmp_false.attr + 3
|
||||||
|
|
||||||
return not (jmp_target == tokens[test_index].offset or
|
return not (jmp_target == tokens[test_index].offset or
|
||||||
tokens[last].pattr == jmp_false.pattr)
|
tokens[last].pattr == jmp_false.pattr)
|
||||||
elif rule == (
|
elif rule == (
|
||||||
|
Reference in New Issue
Block a user