Helper function used to handle next/previous when the loop function is 'modulo'
356056
function deltaModulo(arg, increment) {
  arg.idx = (arg.values.length + arg.idx + increment) % arg.values.length;
  return true;
}
764293
private int calculatePositionViaBreakingBackwards(int numOfBreaks, BreakIterator breakIterator, int position) {
        breakIterator.preceding(position);
        for (int i = 1; i < numOfBreaks; i++) {
            breakIterator.previous();
        }
        return breakIterator.current();
    }
1347205
function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) {
			if ( nextSiblingId ) {
				for ( var i = 0, item;
				( item = array[ i ] ); i++ ) {
					if ( item.id == nextSiblingId ) {
						array.splice( i, 0, newItem );
						return newItem;
					}

					if ( recurse && item[ recurse ] ) {
						var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
						if ( retval )
							return retval;
					}
				}

				if ( nullIfNotFound )
					return null;
			}

			array.push( newItem );
			return newItem;
		}
519183
def previous(time, base)
      current = time
      until match?(current, base) && current < time
        pot_prev = align(potential_previous(current, base), base)
        pot_prev -= min_step if pot_prev == current

        current = pot_prev
      end

      current
    end
1220955
function next(exp) {
		exp.lastIndex = index;
		const match = exp.exec(code)[0];
		index = exp.lastIndex;
		return match;
	}
1232537
function listNext(node, pred) {
  pred = pred || func.fail;

  const nodes = [];
  while (node) {
    if (pred(node)) { break; }
    nodes.push(node);
    node = node.nextSibling;
  }
  return nodes;
}
774292
private int skipForward() {
        int numSkips = 0;
        _next = null;
        while (_iterator.hasNext() && getBlock(_next = _iterator.next()) != 0) {
            numSkips++;
            _next = null;
        }
        return numSkips;
    }
1270461
function chainRecArrayNumber(next, done, x) {
  return [done (x), (x <= 1 ? done : next) (x - 1)];
}
350507
function positionAfter (arr, prevChild) {
    var idx
    if (prevChild === null) {
      return 0
    } else {
      idx = findIndex(arr, prevChild)
      return (idx === -1) ? arr.length : idx + 1
    }
  }
509033
def _check_loop(self, obj, check_mod_str):
        ''''''
        check_module = self._check_modules[check_mod_str]
        checks = self._config['checks'][check_mod_str]
        result = True
        summary = OrderedDict()
        for check in checks:
            ok = self._do_check(obj, check_module, check)
            summary[ok.title] = ok.status
            result &= ok.status

        return result, summary
1247651
def goto_next_frame(self):
        """"""
        marked = False
        while True:
            line = next(self._f)[:-1]
            if marked and len(line) > 0 and not line.startswith(" --------"):
                try:
                    step = int(line[:10])
                    return step, line
                except ValueError:
                    pass
            marked = (len(line) == 131 and line == self._marker)
1130325
@Override
	public long next(){
		long l;
		do{
			l = super.next();
		} while (l >= loopSpot);
		return offset + l % range;
	}
449994
def Next(self):
        
        stacktop = self.stack[-1]
        
        # Now we're iterating -- push a new mutable object onto the stack
        if stacktop.index == -1:
            stacktop = _Frame(None, index=0)
            self.stack.append(stacktop)
        
        context_array = self.stack[-2].context
        
        if stacktop.index == len(context_array):
            self.stack.pop()
            raise StopIteration
        
        stacktop.context = context_array[stacktop.index]
        stacktop.index += 1
        
        return True
323492
function SequentialParser(accumulators, callback) {
  var step = 0;
  var fields = {};
  return {
    fields: fields,
    addField: function(key, value) {
      this.fields[key] = value;
    },
    parseItem: function(item) {
      if (step >= accumulators.length) {
        return console.warn(
          "warning: skipping item, because SequentialParser is done."
        );
      }
      var current = accumulators[step];
      if (current.field) {
        this.addField(current.field, item);
        ++step;
      } else if (current.accumulator) {
        var doneAccumulating = current.accumulator(item, this);
        if (doneAccumulating) ++step;
      } // no action => skip item
      else ++step;
      if (!item || step >= accumulators.length) {
        callback && callback(null, this);
      }
    }
  };
}
92088
function next(err) {
      var fn = fns[++index]
      var params = slice.call(arguments, 0)
      var values = params.slice(1)
      var length = input.length
      var pos = -1

      if (err) {
        done(err)
        return
      }

      /* Copy non-nully input into values. */
      while (++pos < length) {
        if (values[pos] === null || values[pos] === undefined) {
          values[pos] = input[pos]
        }
      }

      input = values

      /* Next or done. */
      if (fn) {
        wrap(fn, next).apply(null, input)
      } else {
        done.apply(null, [null].concat(input))
      }
    }
146781
function(step, next) {
      var currentStep;
      step.steps = copyArray(step.steps);
      currentStep = -1;
      step.next = function() {
        var args;
        currentStep++;
        args = [step].concat(copyArray(arguments));
        if (currentStep >= step.steps.length) {
          return step.callback.apply(null, args);
        } else {
          return step.steps[currentStep].apply(null, args);
        }
      };
      return next();
    }
613445
def sequential(value)
      index = index_variable_for(value)
      index = (index ? index + 1 : 0)
      index = 0 if index == value.length
      set_index_variable(value, index)
      value[index]
    end