public int previousToken(int start, int bound) {
        int pos = scanBackward(start, bound, _nonWSDefaultPart);
        if (pos == NOT_FOUND) {
            return TokenEOF;
        }

        lastPos--;

        if (Character.isJavaIdentifierPart(lastChar)) {
            // assume an indent or keyword
            int from, to = pos + 1;
            pos = scanBackward(pos - 1, bound, _nonIdent);
            if (pos == NOT_FOUND) {
                from = bound == UNBOUND ? 0 : bound + 1;
            } else {
                from = pos + 1;
            }

            try {
                lastToken = document.get(from, to - from);
            } catch (BadLocationException e) {
//                _log.debug(EditorMessages.error_badLocationException, e);
                return TokenEOF;
            }

            return getToken(lastToken);

        } else {
            // operators, number literals etc
            lastToken = String.valueOf(lastChar);
            return TokenOTHER;
        }

    }
Returns the next token in backward direction, starting at <code>start</code>, and not extending further than
<code>bound</code>. The return value is one of the constants defined in {@link SQLIndentSymbols}. After a call,
{@link #getPosition()}will return the position just before the scanned token starts (i.e. the next position that
will be scanned).

@param start the first character position in the document to consider
@param bound the first position not to consider any more
@return a constant from {@link SQLIndentSymbols}describing the previous token
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/indent/SQLHeuristicScanner.java