The following functions are needed only when the option to preserve the comments is active.
12000
function addComment(start, end, type, value) {
        assert(typeof start === 'number', 'Comment must have valid position');

        // Because the way the actual token is scanned, often the comments
        // (if any) are skipped twice during the lexical analysis.
        // Thus, we need to skip adding a comment if the comment array already
        // handled it.
        if (extra.comments.length > 0) {
            if (extra.comments[extra.comments.length - 1].range[1] > start) {
                return;
            }
        }

        extra.comments.push({
            range: [start, end],
            type: type,
            value: value
        });
    }
219956
function (text) {
            if (isConditionalComment(text)) {
                text = cleanConditionalComment(text);
                MinifyWriter.superclass.comment.call(this, text);
            }
        }
975941
def save(self, *args, **kwargs):
        
        if not self.id:
            self.is_public = settings.COMMENTS_DEFAULT_APPROVED
            self.site_id = current_site_id()
        super(ThreadedComment, self).save(*args, **kwargs)
582019
def _add_comments(
        self,
        comments: Optional[Sequence[str]],
        original_string: str = ""
    ) -> str:
        
        if self.config['ignore_comments']:
            return self._strip_comments(original_string)[0]

        if not comments:
            return original_string
        else:
            return "{0}{1} {2}".format(self._strip_comments(original_string)[0],
                                       self.config['comment_prefix'],
                                       "; ".join(comments))
141754
def allow(self, comment, content_object, request):
        """"""
        # Tests for cookie:
        if settings.COOKIE_KEY not in request.COOKIES \
            and (settings.DISCARD_SPAM or settings.DISCARD_NO_COOKIE):
                return False
        elif settings.COOKIE_KEY not in request.COOKIES:
            comment.is_removed = True
            comment.is_public = False
            return True
        return True
929708
function removeComments(str) {
  str = ('__' + str + '__').split('');
  var mode = {
    singleQuote: false,
    doubleQuote: false,
    regex: false,
    blockComment: false,
    lineComment: false,
    condComp: false
  };
  for (var i = 0, l = str.length; i < l; i++) {

    if (mode.regex) {
      if (str[i] === '/' && str[i - 1] !== '\\') {
        mode.regex = false;
      }
      continue;
    }

    if (mode.singleQuote) {
      if (str[i] === "'" && str[i - 1] !== '\\') {
        mode.singleQuote = false;
      }
      continue;
    }

    if (mode.doubleQuote) {
      if (str[i] === '"' && str[i - 1] !== '\\') {
        mode.doubleQuote = false;
      }
      continue;
    }

    if (mode.blockComment) {
      if (str[i] === '*' && str[i + 1] === '/') {
        str[i + 1] = '';
        mode.blockComment = false;
      }
      str[i] = '';
      continue;
    }

    if (mode.lineComment) {
      if (str[i + 1] === '\n' || str[i + 1] === '\r') {
        mode.lineComment = false;
      }
      str[i] = '';
      continue;
    }

    if (mode.condComp) {
      if (str[i - 2] === '@' && str[i - 1] === '*' && str[i] === '/') {
        mode.condComp = false;
      }
      continue;
    }

    mode.doubleQuote = str[i] === '"';
    mode.singleQuote = str[i] === "'";

    if (str[i] === '/') {

      if (str[i + 1] === '*' && str[i + 2] === '@') {
        mode.condComp = true;
        continue;
      }
      if (str[i + 1] === '*') {
        str[i] = '';
        mode.blockComment = true;
        continue;
      }
      if (str[i + 1] === '/') {
        str[i] = '';
        mode.lineComment = true;
        continue;
      }
      mode.regex = true;

    }

  }
  return str.join('').slice(2, - 2);
}
888687
public function sanitizeComments($comments)
    {
        $sanitizers = $this->_comment_sanitizer;

        if (isset($sanitizers['format'])) {
            $sanitizers['format'] = $this->_repository
                                         ->getValidator()
                                         ->getFilter($sanitizers['format']);
        }

        foreach ($comments as $comment) {
            $comment->sanitizeData('body', $sanitizers);
        }
    }
36301
function collectComments(content, comments) {

    const table = []

    let from = 0
    let end

    while (true) {

        let start = content.indexOf('/*', from)

        if (start > -1) {

            end = content.indexOf('*/', start + 2)

            if (end > -1) {
                comments.push(content.slice(start + 2, end))
                table.push(content.slice(from, start))
                table.push('/*___PRESERVE_CANDIDATE_COMMENT_' + (comments.length - 1) + '___*/')
                from = end + 2

            } else {
                // unterminated comment
                end = -2
                break
            }

        } else {
            break
        }
    }

    table.push(content.slice(end + 2))

    return table.join('')
}
1270500
function insertComment(comment) {
    var div = createCommentDiv(comment);

    // To avoid stagnating data, don't store the comments children in data.
    comment.children = null;
    div.data('comment', comment);

    var ul = $('#cl' + (comment.node || comment.parent));
    var siblings = getChildren(ul);

    var li = $(document.createElement('li'));
    li.hide();

    // Determine where in the parents children list to insert this comment.
    for(i=0; i < siblings.length; i++) {
      if (comp(comment, siblings[i]) <= 0) {
        $('#cd' + siblings[i].id)
          .parent()
          .before(li.html(div));
        li.slideDown('fast');
        return;
      }
    }

    // If we get here, this comment rates lower than all the others,
    // or it is the only comment in the list.
    ul.append(li.html(div));
    li.slideDown('fast');
  }
635492
function emitTrailingCommentsOfPosition(pos) {
                if (compilerOptions.removeComments) {
                    return;
                }
                var trailingComments = ts.getTrailingCommentRanges(currentText, pos);
                // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/
                ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment);
            }
747848
def clean(self, *args, **kwargs):
        
        # check done only for new nodes!
        if not self.pk:
            node = self.node
            # ensure comments for this node are allowed
            if node.participation_settings.comments_allowed is False:
                raise ValidationError("Comments not allowed for this node")
            # ensure comments for this layer are allowed
            if 'nodeshot.core.layers' in settings.INSTALLED_APPS:
                layer = node.layer
                if layer.participation_settings.comments_allowed is False:
                    raise ValidationError("Comments not allowed for this layer")
364103
def CleanComments(line, quote=False):
    
    if line.find('#') == -1 and line.find('"') == -1:
        if quote:
            return '', quote
        else:
            return line, quote
    # else have to check for comment
    prior = []
    prev = ''
    for char in line:
        try:
            if char == '"':
                if prev != '\\':
                    quote = not quote
                    prior.append(char)
                continue
            elif char == '#' and not quote:
                break
            if not quote:
                prior.append(char)
        finally:
            prev = char

    # rstrip removes trailing space between end of command and the comment # start

    return ''.join(prior).rstrip(), quote
305080
function attachCommentReply(comment) {
    return function reply(body, callback) {
        github.replyToReviewComment(this.repo.data.owner.login, this.repo.data.name, this.data.number, comment.id, body, callback);
    }.bind(this);
}
783868
function isConsecutiveComment(comment) {
            const previousTokenOrComment = sourceCode.getTokenBefore(comment, { includeComments: true });

            return Boolean(
                previousTokenOrComment &&
                ["Block", "Line"].indexOf(previousTokenOrComment.type) !== -1
            );
        }
872760
function comment() {
        return wrap('comment', and(
            literal('('),
            star(and(opt(fws), ccontent)),
            opt(fws),
            literal(')')
        )());
    }
217317
function processComment(comment) {
            const options = normalizedOptions[comment.type],
                commentValid = isCommentValid(comment, options);

            if (!commentValid) {
                const messageId = capitalize === "always"
                    ? "unexpectedLowercaseComment"
                    : "unexpectedUppercaseComment";

                context.report({
                    node: null, // Intentionally using loc instead
                    loc: comment.loc,
                    messageId,
                    fix(fixer) {
                        const match = comment.value.match(LETTER_PATTERN);

                        return fixer.replaceTextRange(

                            // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*)
                            [comment.range[0] + match.index + 2, comment.range[0] + match.index + 3],
                            capitalize === "always" ? match[0].toLocaleUpperCase() : match[0].toLocaleLowerCase()
                        );
                    }
                });
            }
        }
624167
function(id, params, headers, callback) {
        var url;
        url = this.client.url() + ("comments/" + (id || ''));
        return this.client.del(url, params, headers, callback);
      }