You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Small changes
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
from and_check import *
|
from uncompyle6.parsers.reducecheck.and_check import *
|
||||||
from ifelsestmt import *
|
from uncompyle6.parsers.reducecheck.ifelsestmt import *
|
||||||
from iflaststmt import *
|
from uncompyle6.parsers.reducecheck.iflaststmt import *
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
# Copyright (c) 2020 Rocky Bernstein
|
||||||
|
|
||||||
|
|
||||||
def and_check(self, lhs, n, rule, ast, tokens, first, last):
|
def and_check(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
jmp = ast[1]
|
jmp = ast[1]
|
||||||
if jmp.kind.startswith("jmp_"):
|
if jmp.kind.startswith("jmp_"):
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
# Copyright (c) 2020 Rocky Bernstein
|
# Copyright (c) 2020 Rocky Bernstein
|
||||||
|
|
||||||
|
from uncompyle6.scanners.tok import Token
|
||||||
|
|
||||||
|
|
||||||
def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP":
|
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP":
|
||||||
# ifelsestmt jumped outside of loop. No good.
|
# ifelsestmt jumped outside of loop. No good.
|
||||||
@@ -22,7 +26,7 @@ def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
|||||||
"c_stmts_opt",
|
"c_stmts_opt",
|
||||||
"jump_forward_else",
|
"jump_forward_else",
|
||||||
"else_suite",
|
"else_suite",
|
||||||
'\\e__come_froms'
|
"\\e__come_froms",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -32,18 +36,12 @@ def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
|
|||||||
"c_stmts_opt",
|
"c_stmts_opt",
|
||||||
"jf_cfs",
|
"jf_cfs",
|
||||||
"else_suite",
|
"else_suite",
|
||||||
'\\e_opt_come_from_except',
|
"\\e_opt_come_from_except",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"ifelsestmt",
|
"ifelsestmt",
|
||||||
(
|
("testexpr", "c_stmts_opt", "come_froms", "else_suite", "come_froms",),
|
||||||
"testexpr",
|
|
||||||
"c_stmts_opt",
|
|
||||||
"come_froms",
|
|
||||||
"else_suite",
|
|
||||||
'come_froms',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"ifelsestmt",
|
"ifelsestmt",
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
|
# Copyright (c) 2020 Rocky Bernstein
|
||||||
|
|
||||||
|
|
||||||
def iflaststmt(self, lhs, n, rule, ast, tokens, first, last):
|
def iflaststmt(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
# FIXME: put in a routine somewhere
|
|
||||||
testexpr = ast[0]
|
testexpr = ast[0]
|
||||||
|
|
||||||
if testexpr[0] in ("testtrue", "testfalse"):
|
if testexpr[0] in ("testtrue", "testfalse"):
|
||||||
|
Reference in New Issue
Block a user