isEscaped method

bool isEscaped(
  1. int index
)

Return whether the character at index is escaped.

An index is considered escaped if it is preceded by a non-escaped backslash character (\, ASCII 92).

Characters outside of buffer are considered non-escaped.

Escaped

Implementation

bool isEscaped(int index) {
  if (index == 0 || index >= end) {
    return false;
  } else {
    return buffer[index - 1] == r'\' && !isEscaped(index - 1);
  }
}