def visitWhile_stmt(self, ctx: MPParser.While_stmtContext): log('visitWhile_stmt') exp = self.visit(ctx.exp_bool()) log1(exp) stmtsList = self.visit(ctx.stmt()) log1(stmtsList) if not isinstance(stmtsList, list): stmtsList = [stmtsList] return While(exp, stmtsList)
def visitWhile_stmt(self, ctx: MPParser.While_stmtContext): #while_stmt : WHILE exp DO stmt; return While(self.visit(ctx.exp()), self.visit(ctx.stmt()))
def visitWhile_stmt(self, ctx: MPParser.While_stmtContext): if ctx.stmt().compound_stmt() is None: while_body = [self.visit(ctx.stmt())] else: while_body = self.visit(ctx.stmt()) return While(self.visit(ctx.exp()), while_body)
def visitWhile_stmt(self, ctx: MPParser.While_stmtContext): return [While(self.visit(ctx.exp()), self.visit(ctx.statement()))]