You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
handle newer parser reduction behavior
This commit is contained in:
@@ -395,8 +395,8 @@ class Python2Parser(PythonParser):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
||||||
if not tokens:
|
if tokens is None:
|
||||||
return
|
return False
|
||||||
lhs = rule[0]
|
lhs = rule[0]
|
||||||
if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and':
|
if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and':
|
||||||
return True
|
return True
|
||||||
|
@@ -55,7 +55,7 @@ class Python24Parser(Python25Parser):
|
|||||||
invalid = super(Python24Parser,
|
invalid = super(Python24Parser,
|
||||||
self).reduce_is_invalid(rule, ast,
|
self).reduce_is_invalid(rule, ast,
|
||||||
tokens, first, last)
|
tokens, first, last)
|
||||||
if invalid:
|
if invalid or tokens is None:
|
||||||
return invalid
|
return invalid
|
||||||
|
|
||||||
# FiXME: this code never gets called...
|
# FiXME: this code never gets called...
|
||||||
|
@@ -258,7 +258,7 @@ class Python26Parser(Python2Parser):
|
|||||||
invalid = super(Python26Parser,
|
invalid = super(Python26Parser,
|
||||||
self).reduce_is_invalid(rule, ast,
|
self).reduce_is_invalid(rule, ast,
|
||||||
tokens, first, last)
|
tokens, first, last)
|
||||||
if invalid:
|
if invalid or tokens is None:
|
||||||
return invalid
|
return invalid
|
||||||
if rule == ('and', ('expr', 'jmp_false', 'expr', '\\e_come_from_opt')):
|
if rule == ('and', ('expr', 'jmp_false', 'expr', '\\e_come_from_opt')):
|
||||||
# Test that jmp_false jumps to the end of "and"
|
# Test that jmp_false jumps to the end of "and"
|
||||||
|
Reference in New Issue
Block a user