Misc bugs

This commit is contained in:
rocky
2016-12-28 20:16:13 -05:00
parent 970774ab95
commit 39814fab8b
2 changed files with 6 additions and 3 deletions

View File

@@ -705,10 +705,12 @@ class Python3Parser(PythonParser):
if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and': if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and':
return True return True
elif lhs == 'while1elsestmt': elif lhs == 'while1elsestmt':
# if SETUP_LOOP target spans the else part, then this is
# not while1else. Also do for whileTrue?
last += 1 last += 1
while isinstance(tokens[last], str): while isinstance(tokens[last].offset, str):
last += 1 last += 1
return tokens[first].attr != tokens[last].offset return tokens[first].attr == tokens[last].offset
elif lhs == 'while1stmt': elif lhs == 'while1stmt':
if tokens[last] in ('COME_FROM_LOOP', 'JUMP_BACK'): if tokens[last] in ('COME_FROM_LOOP', 'JUMP_BACK'):
# jump_back should be right afer SETUP_LOOP. Test? # jump_back should be right afer SETUP_LOOP. Test?

View File

@@ -66,6 +66,7 @@ class Token:
pattr = self.pattr pattr = self.pattr
if self.opc: if self.opc:
if self.op in self.opc.hasjrel: if self.op in self.opc.hasjrel:
if not self.pattr.startswith('to '):
pattr = "to " + self.pattr pattr = "to " + self.pattr
elif self.op in self.opc.hasjabs: elif self.op in self.opc.hasjabs:
self.pattr= str(self.pattr) self.pattr= str(self.pattr)