You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
NT break_stmt, continue_stmt -> break, continue...
to match AST
This commit is contained in:
@@ -62,8 +62,8 @@ class Python2Parser(PythonParser):
|
||||
|
||||
return_stmt_lambda ::= ret_expr RETURN_VALUE_LAMBDA
|
||||
|
||||
stmt ::= break_stmt
|
||||
break_stmt ::= BREAK_LOOP
|
||||
stmt ::= break
|
||||
break ::= BREAK_LOOP
|
||||
|
||||
stmt ::= continue
|
||||
continue ::= CONTINUE
|
||||
|
@@ -107,7 +107,7 @@ class Python26Parser(Python2Parser):
|
||||
assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 come_froms_pop
|
||||
assert2 ::= assert_expr jmp_true LOAD_ASSERT expr RAISE_VARARGS_2 come_froms_pop
|
||||
|
||||
break_stmt ::= BREAK_LOOP JUMP_BACK
|
||||
break ::= BREAK_LOOP JUMP_BACK
|
||||
|
||||
# Semantic actions want else_suitel to be at index 3
|
||||
ifelsestmtl ::= testexpr c_stmts_opt cf_jb_cf_pop else_suitel
|
||||
|
@@ -88,8 +88,8 @@ class Python3Parser(PythonParser):
|
||||
return_if_stmts ::= _stmts return_if_stmt
|
||||
return_if_stmt ::= ret_expr RETURN_END_IF
|
||||
|
||||
stmt ::= break_stmt
|
||||
break_stmt ::= BREAK_LOOP
|
||||
stmt ::= break
|
||||
break ::= BREAK_LOOP
|
||||
|
||||
stmt ::= continue
|
||||
continue ::= CONTINUE
|
||||
|
@@ -20,7 +20,7 @@ def checker(ast, in_loop, errors):
|
||||
errors.append(error_text)
|
||||
|
||||
for node in ast:
|
||||
if not in_loop and node.kind in ('continue', 'break_stmt'):
|
||||
if not in_loop and node.kind in ('continue', 'break'):
|
||||
text = str(node)
|
||||
error_text = '\n# not in loop:\n#\t' + '\n# '.join(text.split("\n"))
|
||||
errors.append(error_text)
|
||||
|
@@ -224,7 +224,7 @@ TABLE_DIRECT = {
|
||||
'print_to_items': ( '%C', (0, 2, ', ') ),
|
||||
|
||||
'call_stmt': ( '%|%p\n', (0, 200)),
|
||||
'break_stmt': ( '%|break\n', ),
|
||||
'break': ( '%|break\n', ),
|
||||
'continue': ( '%|continue\n', ),
|
||||
|
||||
'raise_stmt0': ( '%|raise\n', ),
|
||||
|
@@ -28,7 +28,7 @@ node 2 range information, it in %c, is copied to nodes 0 and 1.
|
||||
%r associates recursively location information for the string that follows
|
||||
|
||||
For example in:
|
||||
'break_stmt': ( '%|%rbreak\n', ),
|
||||
'break': ( '%|%rbreak\n', ),
|
||||
|
||||
The node will be associated with the text break, excluding the trailing newline.
|
||||
|
||||
@@ -84,7 +84,7 @@ ExtractInfo = namedtuple("ExtractInfo",
|
||||
"lineNo lineStartOffset markerLine selectedLine selectedText nonterminal")
|
||||
|
||||
TABLE_DIRECT_FRAGMENT = {
|
||||
'break_stmt': ( '%|%rbreak\n', ),
|
||||
'break': ( '%|%rbreak\n', ),
|
||||
'continue ': ( '%|%rcontinue\n', ),
|
||||
'passstmt': ( '%|%rpass\n', ),
|
||||
'raise_stmt0': ( '%|%rraise\n', ),
|
||||
|
Reference in New Issue
Block a user