Пример #1
0
 def visitAssign_stmt(self, ctx: MPParser.Assign_stmtContext):
     num_lhs = ctx.getChildCount() - 1
     result = ""
     while num_lhs > 1:
         result += "," + str(
             Assign(self.visit(ctx.getChild(num_lhs - 2)),
                    self.visit(ctx.getChild(num_lhs))))
         num_lhs -= 2
     return result[1:]
Пример #2
0
 def visitAssign_stmt(self, ctx: MPParser.Assign_stmtContext):
     #assign_stmt : lhs ASSIGN exp;
     reversed_lhs = ctx.lhs()[::-1]
     res = [Assign(self.visit(reversed_lhs[0]), self.visit(ctx.exp()))]
     for x in range(len(reversed_lhs) - 1):
         res = res + [
             Assign(self.visit(reversed_lhs[x + 1]),
                    self.visit(reversed_lhs[x]))
         ]
     return res
Пример #3
0
 def visitAssign_stmt(self, ctx: MPParser.Assign_stmtContext):
     return self.visit(ctx.assign_body())