Starting at position, advance past a run of pad characters, if any. Return the
index of the first character after position that is not a pad character. Result is
>= position.
488055
private final int skipPadding(String text, int position) {
        while (position < text.length() && text.charAt(position) == pad) {
            ++position;
        }
        return position;
    }
631163
@Override
  public int nextStartPosition() throws IOException {
    if (findMatches()) {
      currentMatch = queueMatches.get(0);
      currentPosition = currentMatch.startPosition();
      queueMatches.remove(0);
      return currentMatch.startPosition();
    } else {
      currentMatch = new Match(NO_MORE_POSITIONS, NO_MORE_POSITIONS);
      currentPosition = NO_MORE_POSITIONS;
      return NO_MORE_POSITIONS;
    }
  }
169668
function LocationIndex(string) {
        // ensure newline termination
        if (string[string.length - 1] !== '\n') {
            string += '\n';
        }
        this._stringLength = string.length;
        /*
         * Each triple in _lineStartEndTriples consists of:
         * [0], the 0-based line index of the line the triple represents
         * [1], the 0-based code unit index (into the string) of the start of the line (inclusive)
         * [2], the 0-based code unit index (into the string) of the start of the next line (or the length of the string, if it is the last line)
         * A line starts with a non-newline character,
         * and always ends in a newline character, unless it is the very last line in the string.
         */
        this._lineStartEndTriples = [[0, 0]];
        var nextLineIndex = 1;
        var charIndex = 0;
        while (charIndex < string.length) {
            charIndex = string.indexOf('\n', charIndex);
            if (charIndex === -1) {
                /* istanbul ignore next */
                break;
            }
            charIndex++;// go past the newline
            this._lineStartEndTriples[this._lineStartEndTriples.length - 1].push(charIndex);
            this._lineStartEndTriples.push([nextLineIndex, charIndex]);

            nextLineIndex++;
        }
        this._lineStartEndTriples.pop();
    }
1204310
private int getStartingPoint(String buffer) {
    for (int i = 0; i < buffer.length(); i++) {
      if (!Character.isWhitespace(buffer.charAt(i))) {
        return i;
      }
    }
    return buffer.length();
  }
1219167
def pad_after( length )
      before = stream_position
      pad = Padding.padding_for(length)
      pad.times do
        @stream.write_unsigned_int_8(0)
      end
      after = stream_position
      log.debug "padded 0x#{length.to_s(16)} with 0x#{pad.to_s(16)} stream #{before.to_s(16)}/#{after.to_s(16)}"
    end
982785
def indexOf(self, pattern, start_idx, bitlength):
        
        return StrIndexOf(self, pattern, start_idx, bitlength)
75946
@Override
  public int nextStartPosition() throws IOException {
    if (currentStartPosition < minPosition) {
      currentStartPosition = minPosition;
      currentEndPosition = currentStartPosition + 1;
    } else {
      currentStartPosition++;
      currentEndPosition = currentStartPosition + 1;
      if (currentStartPosition > maxPosition) {
        currentStartPosition = NO_MORE_POSITIONS;
        currentEndPosition = NO_MORE_POSITIONS;
      }
    }
    return currentStartPosition;
  }
784841
def _afterpoint(string):
    
    if _isnumber(string):
        if _isint(string):
            return -1
        else:
            pos = string.rfind(".")
            pos = string.lower().rfind("e") if pos < 0 else pos
            if pos >= 0:
                return len(string) - pos - 1
            else:
                return -1  # no point
    else:
        return -1
461944
int findNextUsedLinePos(int pos) {

        try {
            int     firstPos   = pos;
            int     currentPos = pos;
            boolean wasCR      = false;

            dataFile.seek(pos);

            while (true) {
                int c = dataFile.read();

                currentPos++;

                switch (c) {

                    case CR_CHAR :
                        wasCR = true;
                        break;

                    case LF_CHAR :
                        wasCR = false;

                        ((RowInputText) rowIn).skippedLine();

                        firstPos = currentPos;
                        break;

                    case ' ' :
                        if (wasCR) {
                            wasCR = false;

                            ((RowInputText) rowIn).skippedLine();
                        }
                        break;

                    case -1 :
                        return -1;

                    default :
                        return firstPos;
                }
            }
        } catch (IOException e) {
            throw new HsqlException(e.getMessage(), "", 0);
        }
    }
773628
private void nextChar() {
        if (pos < line.length()) {
            c = line.charAt(pos);
            pos++;
        } else {
            c = '\n';
        }
    }
1298913
@Override
  public int nextStartPosition() throws IOException {
    if (findMatches()) {
      currentMatch = queueMatches.get(0);
      queueMatches.remove(0);
      noMorePositions = false;
      return currentMatch.startPosition();
    } else {
      currentMatch = null;
      noMorePositions = true;
      return NO_MORE_POSITIONS;
    }
  }
982230
private static int indexInUpperAlphaRange(final CharSequence sequence, final int start)
    {
        final int length = sequence.length();
        if (start < 0 || start > length)
        {
            throw new IndexOutOfBoundsException();
        }

        for (int i = start; i < length; i++)
        {
            final char c = sequence.charAt(i);
            if ('A' <= c && c <= 'Z')
            {
                return i;
            }
        }

        return -1;
    }
146111
def position_after_whitespace(self, body: str, start_position: int) -> int:
        
        body_length = len(body)
        position = start_position
        while position < body_length:
            char = body[position]
            if char in " \t,\ufeff":
                position += 1
            elif char == "\n":
                position += 1
                self.line += 1
                self.line_start = position
            elif char == "\r":
                if body[position + 1 : position + 2] == "\n":
                    position += 2
                else:
                    position += 1
                self.line += 1
                self.line_start = position
            else:
                break
        return position
218625
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) {
        int first = -1;
        boolean atomBoundary = true;
        for (int i = beginIndex; i >= rewindIndex; i--) {
            char c = input.charAt(i);
            if (localAtomAllowed(c)) {
                first = i;
                atomBoundary = false;
            } else if (c == '.') {
                if (atomBoundary) {
                    break;
                }
                atomBoundary = true;
            } else {
                break;
            }
        }
        return first;
    }
649221
private int scanToken(int startPos) {
        int position = startPos;
        while (position < maxPosition) {
            if (!hasSurrogates) {
                char c = str.charAt(position);
                if ((c <= maxDelimCodePoint) && (delimiters.indexOf(c) >= 0))
                    break;
                position++;
            } else {
                int c = str.codePointAt(position);
                if ((c <= maxDelimCodePoint) && isDelimiter(c))
                    break;
                position += Character.charCount(c);
            }
        }
        if (retDelims && (startPos == position)) {
            if (!hasSurrogates) {
                char c = str.charAt(position);
                if ((c <= maxDelimCodePoint) && (delimiters.indexOf(c) >= 0))
                    position++;
            } else {
                int c = str.codePointAt(position);
                if ((c <= maxDelimCodePoint) && isDelimiter(c))
                    position += Character.charCount(c);
            }
        }
        return position;
    }
231836
def follow_bytes(self, s, index):
        ""
        for ch in s:
            index = self.follow_char(int_from_byte(ch), index)
            if index is None:
                return None

        return index
1131457
def find_next(start, stop, i2hits):
    
    if start not in i2hits and stop in i2hits:
        index = stop
    elif stop not in i2hits and start in i2hits:
        index = start
    elif start not in i2hits and stop not in i2hits:
        index = choice([start, stop])
        i2hits[index] = [[False]]
    else:
        A, B = i2hits[start][0], i2hits[stop][0]
        if B[10] <= A[10]:
            index = stop
        else:
            index = start
    if index == start:
        nstart = start - 1
        nstop = stop
    else:
        nstop = stop + 1
        nstart = start
    match = i2hits[index][0]
    rp = match[-1]
    return index, nstart, nstop, rp, match