You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
NT continue_stmt -> continue to match AST
This commit is contained in:
@@ -65,11 +65,11 @@ class Python2Parser(PythonParser):
|
|||||||
stmt ::= break_stmt
|
stmt ::= break_stmt
|
||||||
break_stmt ::= BREAK_LOOP
|
break_stmt ::= BREAK_LOOP
|
||||||
|
|
||||||
stmt ::= continue_stmt
|
stmt ::= continue
|
||||||
continue_stmt ::= CONTINUE
|
continue ::= CONTINUE
|
||||||
continue_stmts ::= _stmts lastl_stmt continue_stmt
|
continues ::= _stmts lastl_stmt continue
|
||||||
continue_stmts ::= lastl_stmt continue_stmt
|
continues ::= lastl_stmt continue
|
||||||
continue_stmts ::= continue_stmt
|
continues ::= continue
|
||||||
|
|
||||||
stmt ::= assert2
|
stmt ::= assert2
|
||||||
stmt ::= raise_stmt0
|
stmt ::= raise_stmt0
|
||||||
@@ -339,7 +339,7 @@ class Python2Parser(PythonParser):
|
|||||||
rule = 'call ::= expr ' + 'expr '*args_pos + 'kwarg '*args_kw \
|
rule = 'call ::= expr ' + 'expr '*args_pos + 'kwarg '*args_kw \
|
||||||
+ 'expr ' * nak + opname
|
+ 'expr ' * nak + opname
|
||||||
elif opname == 'CONTINUE_LOOP':
|
elif opname == 'CONTINUE_LOOP':
|
||||||
self.add_unique_rule('continue_stmt ::= CONTINUE_LOOP',
|
self.add_unique_rule('continue ::= CONTINUE_LOOP',
|
||||||
opname, v, customize)
|
opname, v, customize)
|
||||||
continue
|
continue
|
||||||
elif opname_base in ('DUP_TOPX', 'RAISE_VARARGS'):
|
elif opname_base in ('DUP_TOPX', 'RAISE_VARARGS'):
|
||||||
|
@@ -91,12 +91,12 @@ class Python3Parser(PythonParser):
|
|||||||
stmt ::= break_stmt
|
stmt ::= break_stmt
|
||||||
break_stmt ::= BREAK_LOOP
|
break_stmt ::= BREAK_LOOP
|
||||||
|
|
||||||
stmt ::= continue_stmt
|
stmt ::= continue
|
||||||
continue_stmt ::= CONTINUE
|
continue ::= CONTINUE
|
||||||
continue_stmt ::= CONTINUE_LOOP
|
continue ::= CONTINUE_LOOP
|
||||||
continue_stmts ::= _stmts lastl_stmt continue_stmt
|
continues ::= _stmts lastl_stmt continue
|
||||||
continue_stmts ::= lastl_stmt continue_stmt
|
continues ::= lastl_stmt continue
|
||||||
continue_stmts ::= continue_stmt
|
continues ::= continue
|
||||||
|
|
||||||
del_stmt ::= delete_subscr
|
del_stmt ::= delete_subscr
|
||||||
delete_subscr ::= expr expr DELETE_SUBSCR
|
delete_subscr ::= expr expr DELETE_SUBSCR
|
||||||
|
@@ -20,7 +20,7 @@ def checker(ast, in_loop, errors):
|
|||||||
errors.append(error_text)
|
errors.append(error_text)
|
||||||
|
|
||||||
for node in ast:
|
for node in ast:
|
||||||
if not in_loop and node.kind in ('continue_stmt', 'break_stmt'):
|
if not in_loop and node.kind in ('continue', 'break_stmt'):
|
||||||
text = str(node)
|
text = str(node)
|
||||||
error_text = '\n# not in loop:\n#\t' + '\n# '.join(text.split("\n"))
|
error_text = '\n# not in loop:\n#\t' + '\n# '.join(text.split("\n"))
|
||||||
errors.append(error_text)
|
errors.append(error_text)
|
||||||
|
@@ -225,7 +225,7 @@ TABLE_DIRECT = {
|
|||||||
|
|
||||||
'call_stmt': ( '%|%p\n', (0, 200)),
|
'call_stmt': ( '%|%p\n', (0, 200)),
|
||||||
'break_stmt': ( '%|break\n', ),
|
'break_stmt': ( '%|break\n', ),
|
||||||
'continue_stmt': ( '%|continue\n', ),
|
'continue': ( '%|continue\n', ),
|
||||||
|
|
||||||
'raise_stmt0': ( '%|raise\n', ),
|
'raise_stmt0': ( '%|raise\n', ),
|
||||||
'raise_stmt1': ( '%|raise %c\n', 0),
|
'raise_stmt1': ( '%|raise %c\n', 0),
|
||||||
|
@@ -85,7 +85,7 @@ ExtractInfo = namedtuple("ExtractInfo",
|
|||||||
|
|
||||||
TABLE_DIRECT_FRAGMENT = {
|
TABLE_DIRECT_FRAGMENT = {
|
||||||
'break_stmt': ( '%|%rbreak\n', ),
|
'break_stmt': ( '%|%rbreak\n', ),
|
||||||
'continue_stmt': ( '%|%rcontinue\n', ),
|
'continue ': ( '%|%rcontinue\n', ),
|
||||||
'passstmt': ( '%|%rpass\n', ),
|
'passstmt': ( '%|%rpass\n', ),
|
||||||
'raise_stmt0': ( '%|%rraise\n', ),
|
'raise_stmt0': ( '%|%rraise\n', ),
|
||||||
'import': ( '%|import %c%x\n', 2, (2, (0, 1)), ),
|
'import': ( '%|import %c%x\n', 2, (2, (0, 1)), ),
|
||||||
|
Reference in New Issue
Block a user