boolean (Editor editor, HighlighterIterator iterator, int offset) { final IElementType tokenType = iterator.getTokenType(); if (!getOpeningQuotesTokens().contains(tokenType)) { return false; } final CharSequence chars = iterator.getDocument().getCharsSequence(); int end = iterator.getEnd(); if (getLiteralStartOffset(chars, iterator.getStart()) >= end - 1) return true; char endSymbol = chars.charAt(end - 1); if (endSymbol != '"' && endSymbol != '\'') return true; //for triple quoted string if (end >= 3 && (endSymbol == chars.charAt(end - 2)) && (chars.charAt(end - 2) == chars.charAt(end - 3)) && (end < 4 || chars.charAt(end - 4) != endSymbol)) { return true; } return false; }