Small changes

This commit is contained in:
rocky
2020-01-08 20:43:32 -05:00
parent 6f6ef19e0a
commit b0d931b760
4 changed files with 153 additions and 150 deletions

View File

@@ -1,3 +1,3 @@
from and_check import *
from ifelsestmt import *
from iflaststmt import *
from uncompyle6.parsers.reducecheck.and_check import *
from uncompyle6.parsers.reducecheck.ifelsestmt import *
from uncompyle6.parsers.reducecheck.iflaststmt import *

View File

@@ -1,3 +1,6 @@
# Copyright (c) 2020 Rocky Bernstein
def and_check(self, lhs, n, rule, ast, tokens, first, last):
jmp = ast[1]
if jmp.kind.startswith("jmp_"):

View File

@@ -1,4 +1,8 @@
# Copyright (c) 2020 Rocky Bernstein
from uncompyle6.scanners.tok import Token
def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
if (last + 1) < n and tokens[last + 1] == "COME_FROM_LOOP":
# ifelsestmt jumped outside of loop. No good.
@@ -22,7 +26,7 @@ def ifelsestmt(self, lhs, n, rule, ast, tokens, first, last):
"c_stmts_opt",
"jump_forward_else",
"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",
"jf_cfs",
"else_suite",
'\\e_opt_come_from_except',
"\\e_opt_come_from_except",
),
),
(
"ifelsestmt",
(
"testexpr",
"c_stmts_opt",
"come_froms",
"else_suite",
'come_froms',
),
("testexpr", "c_stmts_opt", "come_froms", "else_suite", "come_froms",),
),
(
"ifelsestmt",

View File

@@ -1,5 +1,7 @@
# Copyright (c) 2020 Rocky Bernstein
def iflaststmt(self, lhs, n, rule, ast, tokens, first, last):
# FIXME: put in a routine somewhere
testexpr = ast[0]
if testexpr[0] in ("testtrue", "testfalse"):