Example #1
0
    def move_next(self):
        while True:
            if self._child_iterator_w is None:
                while True:
                    if self._idx == len(self._array_w):
                        self._current = nil
                        self._at_end = True
                        self._array_w = None
                        return self
                    key_or_none = self._array_w[self._idx]
                    val_or_node = self._array_w[self._idx + 1]

                    if key_or_none is not None:
                        self._idx += 2
                        self._current = rt.map_entry(key_or_none, val_or_node)
                        return self

                    elif val_or_node is not None:
                        iter = val_or_node.iter()
                        if iter.at_end():
                            self._idx += 1
                            continue
                        self._child_iterator_w = iter
                        self._current = self._child_iterator_w.current()
                        return self

                    self._idx += 2
            else:
                self._child_iterator_w.move_next()
                if self._child_iterator_w.at_end():
                    continue
                self._current = self._child_iterator_w.current()
                return self
Example #2
0
    def move_next(self):
        while True:
            if self._child_iterator_w is None:
                while True:
                    if self._idx == len(self._array_w):
                        self._current = nil
                        self._at_end = True
                        self._array_w = None
                        return self
                    key_or_none = self._array_w[self._idx]
                    val_or_node = self._array_w[self._idx + 1]

                    if key_or_none is not None:
                        self._idx += 2
                        self._current = rt.map_entry(key_or_none, val_or_node)
                        return self

                    elif val_or_node is not None:
                        iter = val_or_node.iter()
                        if iter.at_end():
                            self._idx += 1
                            continue
                        self._child_iterator_w = iter
                        self._current = self._child_iterator_w.current()
                        return self

                    self._idx += 2
            else:
                self._child_iterator_w.move_next()
                if self._child_iterator_w.at_end():
                    continue
                self._current = self._child_iterator_w.current()
                return self
Example #3
0
    def reduce_inode(self, f, init):
        for x in range(0, len(self._array), 2):
            key_or_nil = self._array[x]
            if key_or_nil is None:
                continue

            val = self._array[x + 1]
            init = f.invoke([init, rt.map_entry(key_or_nil, val)])
            if rt.reduced_QMARK_(init):
                return init
        return init
Example #4
0
 def reduce_inode(self, f, init):
     for x in range(0, len(self._array), 2):
         key_or_none = self._array[x]
         val_or_node = self._array[x + 1]
         if key_or_none is None and val_or_node is not None:
             init = val_or_node.reduce_inode(f, init)
         else:
             init = f.invoke([init, rt.map_entry(key_or_none, val_or_node)])
         if rt.reduced_QMARK_(init):
             return init
     return init
Example #5
0
 def reduce_inode(self, f, init):
     for x in range(0, len(self._array), 2):
         key_or_none = self._array[x]
         val_or_node = self._array[x + 1]
         if key_or_none is None and val_or_node is not None:
             init = val_or_node.reduce_inode(f, init)
         else:
             init = f.invoke([init, rt.map_entry(key_or_none, val_or_node)])
         if rt.reduced_QMARK_(init):
             return init
     return init
Example #6
0
    def reduce_inode(self, f, init):
        for x in range(0, len(self._array), 2):
            key_or_nil = self._array[x]
            if key_or_nil is None:
                continue

            val = self._array[x + 1]
            init = f.invoke([init, rt.map_entry(key_or_nil, val)])
            if rt.reduced_QMARK_(init):
                return init
        return init
Example #7
0
    def move_next(self):
        while True:
            if self._w_idx == len(self._w_array):
                self._w_current = nil
                self._w_array = None
                return self

            key = self._w_array[self._w_idx]
            val = self._w_array[self._w_idx + 1]
            self._w_idx += 2
            if key is None:
                continue

            self._w_current = rt.map_entry(key, val)
            return
Example #8
0
    def move_next(self):
        while True:
            if self._w_idx == len(self._w_array):
                self._w_current = nil
                self._w_array = None
                return self

            key = self._w_array[self._w_idx]
            val = self._w_array[self._w_idx + 1]
            self._w_idx += 2
            if key is None:
                continue

            self._w_current = rt.map_entry(key, val)
            return
Example #9
0
 def reduce_vars(self, f, init):
     for k, v in os.environ.items():
         init = f.invoke([init, rt.map_entry(rt.wrap(k), rt.wrap(v))])
         if rt.reduced_QMARK_(init):
             return init
     return init
Example #10
0
 def reduce_vars(self, f, init):
     for k, v in os.environ.items():
         init = f.invoke([init, rt.map_entry(rt.wrap(k), rt.wrap(v))])
         if rt.reduced_QMARK_(init):
             return init
     return init