Пример #1
0
 def execute(self, stack, exec_env):
     # Only works if at least 2 items in the stack
     if len(stack) >= 2:
         r = stack.pop()
         l = stack.pop()
         stack = common.stack_push(stack, r)
         stack = common.stack_push(stack, l)
     instr_t.execute(self, stack, exec_env)
Пример #2
0
 def execute(self, stack, exec_env):
     # Only works if something in the stack
     if len(stack) >= 1:
         a = stack.pop()
         b = copy.deepcopy(a)
         stack = common.stack_push(stack, a)
         stack = common.stack_push(stack, b)
     instr_t.execute(self, stack, exec_env)
Пример #3
0
 def execute(self, stack, exec_env):
     if len(stack) >= 2:
         r = stack.pop()
         l = stack.pop()
         outer = (execflags.OUTEROP in exec_env.flgs)
         stack = common.stack_push(stack, vindex_get(l, r, outer))
     instr_t.execute(self, stack, exec_env)
Пример #4
0
 def execute(self, stack, exec_env):
     if len(stack) >= 3:
         r = stack.pop()
         m = stack.pop()
         l = stack.pop()
         stack = common.stack_push(stack, vindex_set(l, m, r))
     instr_t.execute(self, stack, exec_env)
Пример #5
0
 def execute(self, stack, exec_env):
     if len(stack) >= 2:
         r = stack.pop()
         l = stack.pop()
         outer = (execflags.OUTEROP in exec_env.flgs)
         stack = common.stack_push(stack,
                                   binary_operator(l, r, self.op, outer))
     instr_t.execute(self, stack, exec_env)
Пример #6
0
 def execute(self, stack, exec_env):
     """
     Appends last item on stack to item before if it is a list,
     if the stack only contains 1 item, make this item into a list
     if the penultimate stack item isn't a list, make it so before appending the
     item
     """
     if len(stack) < 1:
         instr_t.execute(self, stack, exec_env)
         return
     x = stack.pop()
     if len(stack) == 0:
         stack = common.stack_push(stack, [x])
         instr_t.execute(self, stack, exec_env)
         return
     y = stack.pop()
     outer = (execflags.OUTEROP in exec_env.flgs)
     y = listpush(y, x, outer)
     stack = common.stack_push(stack, y)
     instr_t.execute(self, stack, exec_env)
Пример #7
0
 def execute(self, stack, exec_env):
     if len(stack) >= 1:
         a = stack.pop()
         stack = common.stack_push(stack, unary_operator(a, self.op))
     instr_t.execute(self, stack, exec_env)
Пример #8
0
 def execute(self, stack, exec_env):
     if len(stack) < 1:
         instr_t.execute(self, stack, exec_env)
         return
     stack = common.stack_push(stack, -1)
     indexing.getat_t.execute(self, stack, exec_env)