boolean (@NotNull ASTNode stringNode, @NotNull String nodeText) { final char firstQuote = nodeText.charAt(0); final char lastChar = nodeText.charAt(nodeText.length() - 1); int precedingBackslashCount = 0; for (int i = nodeText.length() - 2; i >= 0; i--) { if (nodeText.charAt(i) == '\\') { precedingBackslashCount++; } else { break; } } if (nodeText.length() == 1 || lastChar != firstQuote || precedingBackslashCount % 2 != 0) { getHolder().newAnnotation(HighlightSeverity.ERROR, PyPsiBundle.message("ANN.missing.closing.quote", firstQuote)).range(stringNode).create(); return true; } return false; }