boolean (HighlighterIterator iterator, int offset) { // don't assume an opening quote unless we're in an explicitly "blank" context final Document document = iterator.getDocument(); if (document == null) { return false; } CharSequence text = document.getCharsSequence(); boolean mayBeSingleQuote = offset + 1 >= text.length() || Arrays.binarySearch(ourAutoClosingChars, text.charAt(offset + 1)) >= 0; boolean mayBeTripleQuote = offset + 4 >= text.length() || Arrays.binarySearch(ourAutoClosingChars, text.charAt(offset + 4)) >= 0; if (mayBeTripleQuote) { if (isOpeningTripleQuote(iterator, offset)) return true; } if (mayBeSingleQuote) { if (isOpeningSingleQuote(iterator, offset)) { return true; } if (getOpeningQuotesTokens().contains(iterator.getTokenType())) { int start = iterator.getStart(); if (offset - start <= PyStringLiteralCoreUtil.MAX_PREFIX_LENGTH) { if (getLiteralStartOffset(text, start) == offset) return true; } } } return false; }