protected final int locateEscapeSequence(int start) {
    assert myBuffer.charAt(start) == '\\';
    int i = start;
    i++;
    if (isRaw()) return i;
    if (i == myBufferEnd) {
      return i;
    }

    // is octal?
    if (myBuffer.charAt(i) >= '0' && myBuffer.charAt(i) <= '7') {
      char first = myBuffer.charAt(i);
      i++;
      if (i < myBufferEnd && myBuffer.charAt(i) >= '0' && myBuffer.charAt(i) <= '7') {
        i++;
        if (i < myBufferEnd && first <= '3' && myBuffer.charAt(i) >= '0' && myBuffer.charAt(i) <= '7') {
          i++;
        }
      }
      return i;
    }

    // \xNN byte escape
    if (myBuffer.charAt(i) == 'x') {
      i++;
      for (; i < start + 4; i++) {
        if (isEscapeEnd(i)) {
          return i;
        }
      }
      return i;
    }

    // unicode escape
    if (myBuffer.charAt(i) == 'u' || myBuffer.charAt(i) == 'U') {
      final int width = myBuffer.charAt(i) == 'u' ? 4 : 8; // is it uNNNN or Unnnnnnnn
      i++;
      for (; i < start + width + 2; i++) {
        if (isEscapeEnd(i)) {
          return i;
        }
      }
      return i;
    }

    if (myBuffer.charAt(i) == 'N' && isUnicodeMode()) {
      i++;
      while (i < myBufferEnd && myBuffer.charAt(i) != '}' && myBuffer.charAt(i) != '\\') {
        i++;
      }
      if (i < myBufferEnd && myBuffer.charAt(i) == '}') {
        i++;
      }
      return i;
    }
    return i + 1;
  }
protected final int locateEscapeSequence(int start)