コード例 #1
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     a = self.visit(ctx.statement())
     if (type(a) == list):
         a = a[0]
     return For(self.visit(ctx.expression(0)),
                self.visit(ctx.expression(1)),
                self.visit(ctx.expression(2)), a)
コード例 #2
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     '''for_statement: FOR LP exp_for SEMI exp_for SEMI exp_for RP statement ;'''
     exp0 = self.visit(ctx.exp_for(0))
     exp1 = self.visit(ctx.exp_for(1))
     exp2 = self.visit(ctx.exp_for(2))
     stmt = self.visit(ctx.statement())
     return For(exp0, exp1, exp2, stmt)
コード例 #3
0
 def visitFor_statement(self, ctx:MCParser.For_statementContext):
     expr1 = self.visit(ctx.exp(0))
     expr2 = self.visit(ctx.exp(1))
     expr3 = self.visit(ctx.exp(2))
     loopStmt = self.visit(ctx.statement())
     return For(expr1,expr2,expr3,loopStmt)
コード例 #4
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     exp1 = self.visit(ctx.expression(0))
     exp2 = self.visit(ctx.expression(1))
     exp3 = self.visit(ctx.expression(2))
     stmt = self.visit(ctx.statement())
     return For(exp1, exp2, exp3, stmt)
コード例 #5
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     return For(self.visit(ctx.exp(0)), self.visit(ctx.exp(1)),
                self.visit(ctx.exp(2)), self.visit(ctx.statement()))
コード例 #6
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     return For(*[self.visit(exp) for exp in ctx.expression()],
                self.visit(ctx.statement()))
コード例 #7
0
 def visitFor_statement(self, ctx: MCParser.For_statementContext):
     # for_statement: FOR LB exp SM exp SM exp RB statement;
     return For(self.visit(ctx.exp(0)), self.visit(ctx.exp(1)),
                self.visit(ctx.exp(2)), self.visit(ctx.statement()))