HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(offset);
boolean atEndOfDocument = offset == editor.getDocument().getTextLength();
if (!atEndOfDocument) iterator.retreat();
if (iterator.atEnd()) return;
BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator);
if (iterator.atEnd()) return;
IElementType braceTokenType = iterator.getTokenType();
CharSequence fileText = editor.getDocument().getCharsSequence();
if (!braceMatcher.isLBraceToken(iterator, fileText, fileType)) return;
if (!iterator.atEnd()) {
iterator.advance();
if (!iterator.atEnd()) {