def visitForstmt(self,ctx:MCParser.ForstmtContext):
     list_exp = [self.visit(x) for x in ctx.expression()]
     exp1 = list_exp[0]
     exp2 = list_exp[1]
     exp3 = list_exp[2]
     loop = self.visit(ctx.statement())
     return For(exp1, exp2, exp3, loop)
示例#2
0
 def visitForstmt(self, ctx: MCParser.ForstmtContext):
     return For(self.visit(ctx.exp(0)), self.visit(ctx.exp(1)),
                self.visit(ctx.exp(2)), self.visit(ctx.stmt()))
示例#3
0
 def visitForstmt(self, ctx: MCParser.ForstmtContext):
     expr1 = self.visitExpr0(ctx.expr0(0))
     expr2 = self.visitExpr0(ctx.expr0(1))
     expr3 = self.visitExpr0(ctx.expr0(2))
     loop = self.visitStmt(ctx.stmt())
     return For(expr1, expr2, expr3, loop)