boolean (@NotNull CharSequence text, int startOffset, int backslashOffset) { if (text.charAt(backslashOffset) != '\\') { return true; } boolean escaped = false; for (int i = startOffset; i < backslashOffset; i++) { if (text.charAt(i) == '\\') { escaped = !escaped; } else { escaped = false; } } return escaped; }