def createBreak(self, breakStatement, lineno): n = Jump(Token.BREAK, lineno) jumpStatement = None#Jump() t = breakStatement.getType() if (t == Token.LOOP) or (t == Token.LABEL): jumpStatement = breakStatement else: if (t == Token.BLOCK) and (breakStatement.getFirstChild().getType() == Token.SWITCH): jumpStatement = breakStatement.getFirstChild() else: raise Kit.codeBug() n.setJumpStatement(jumpStatement) return n
def createContinue(self, loop, lineno): if (loop.getType() != Token.LOOP): Kit.codeBug() n = Jump(Token.CONTINUE, lineno) n.setJumpStatement(loop) return n