public int scanForward(int start, int bound, StopCondition condition) {
        assert (start >= 0);

        if (bound == UNBOUND) {
            bound = document.getLength();
        }

        assert (bound <= document.getLength());

        try {
            lastPos = start;
            while (lastPos < bound) {

                lastChar = document.getChar(lastPos);
                if (condition.stop(lastChar, lastPos, true)) {
                    return lastPos;
                }

                lastPos++;
            }
        } catch (BadLocationException e) {
//            _log.debug(EditorMessages.error_badLocationException, e);
        }
        return NOT_FOUND;
    }
Finds the lowest position <code>p</code> in <code>fDocument</code> such that <code>start</code> &lt;= p
&lt; <code>bound</code> and <code>condition.stop(fDocument.getChar(p), p)</code> evaluates to
<code>true</code>.

@param start     the first character position in <code>fDocument</code> to be considered
@param bound     the first position in <code>fDocument</code> to not consider any more, with <code>bound</code>
                 &gt; <code>start</code>, or <code>UNBOUND</code>
@param condition the <code>StopCondition</code> to check
@return the lowest position in [<code>start</code>,<code>bound</code>) for which <code>condition</code>
holds, or <code>NOT_FOUND</code> if none can be found
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/indent/SQLHeuristicScanner.java