code: private String readComment() {
      if (pos == data.length || data[pos] != '/') throw new AssertionError();
      pos++;
      int commentType = pos < data.length ? data[pos++] : -1;
      if (commentType == '*') {
        StringBuilder result = new StringBuilder();
        boolean startOfLine = true;
  
        for (; pos + 1 < data.length; pos++) {
          char c = data[pos];
          if (c == '*' && data[pos + 1] == '/') {
            pos += 2;
            return result.toString().trim();
          }
          if (c == '\n') {
            result.append('\n');
            newline();
            startOfLine = true;
          } else if (!startOfLine) {
            result.append(c);
          } else if (c == '*') {
            if (data[pos + 1] == ' ') {
              pos += 1; // Skip a single leading space, if present.
            }
            startOfLine = false;
          } else if (!Character.isWhitespace(c)) {
            result.append(c);
            startOfLine = false;
          }
        }
        throw unexpected("unterminated comment");
      } else if (commentType == '/') {
        if (pos < data.length && data[pos] == ' ') {
          pos += 1; // Skip a single leading space, if present.
        }
        int start = pos;
        while (pos < data.length) {
          char c = data[pos++];
          if (c == '\n') {
            newline();
            break;
          }
        }
        return new String(data, start, pos - 1 - start);
      } else {
        throw unexpected("unexpected '/'");
      }
    }
docs: Reads a comment and returns its body.