public int scanBackward(int start, int bound, StopCondition condition) {
        if (bound == UNBOUND) {
            bound = -1;
        }

        assert (bound >= -1);
        assert (start < document.getLength());

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

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

                lastPos--;
            }
        } catch (BadLocationException e) {
//            _log.debug(EditorMessages.error_badLocationException, e);
        }
        return NOT_FOUND;
    }
Finds the highest position <code>p</code> in <code>fDocument</code> such that <code>bound</code> &lt;
<code>p</code> &lt;= <code>start</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>
                 &lt; <code>start</code>, or <code>UNBOUND</code>
@param condition the <code>StopCondition</code> to check
@return the highest position in (<code>bound</code>,<code>start</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