boolean (Editor editor, HighlighterIterator iterator, int offset) { try { Document doc = editor.getDocument(); CharSequence chars = doc.getCharsSequence(); int lineEnd = doc.getLineEndOffset(doc.getLineNumber(offset)); while (!iterator.atEnd() && iterator.getStart() < lineEnd) { if (isQuotedToken(iterator.getTokenType())) { if (iterator.getStart() >= iterator.getEnd() - 1 || chars.charAt(iterator.getEnd() - 1) != '\"' && chars.charAt(iterator.getEnd() - 1) != '\'') { return true; } } iterator.advance(); } } finally { while (!iterator.atEnd() && iterator.getStart() != offset) iterator.retreat(); } return false; }