Sanitizing iterator to run on each comment found during parsing
979308
function onComment(isBlock, text, _s, _e, sLoc, eLoc) {

  var tRegex = /test\s*>\s*(.*)/i;
  var aRegex = /#\s*(.*)/i;
  var isTest = R.test(tRegex);
  var extractTest = R.pipe(R.match(tRegex), R.last(), R.trim());
  var isAssertion = R.test(aRegex);
  var extractAssertion = R.pipe(R.match(aRegex), R.last(), R.trim());
  var lastTestFound = R.last(tests);
  var newTest;

  function belongToTest(locLine, test) {
    return (test === undefined) ? false : locLine - 1 === test.loc.endLine;
  }

  function createEmptyTest(title) {
    return {
      title: title || null,
      loc: { startLine: sLoc.line, endLine: eLoc.line },
      assertions: []
    };
  }

  function addAssertionToTest(assertion, test) {
    test.assertions.push(assertion);
    test.loc.endLine = eLoc.line;
    return test;
  }

  function setTestTitle(title, test) {
    test.title = title;
    return test;
  }

  function buildTest(test, string) {
    if (isTest(string)) {
      setTestTitle(extractTest(string), test);
    } else if (isAssertion(string)) {
      addAssertionToTest(extractAssertion(string), test);
    }
    return test;
  }

  if (!isBlock) {
    if (isTest(text)) {
      newTest = R.pipe(extractTest, createEmptyTest)(text);
      tests.push(newTest);
    } else if (isAssertion(text) && belongToTest(sLoc.line, lastTestFound)) {
      addAssertionToTest(extractAssertion(text), lastTestFound);
    }
  }

  if (isBlock && isTest(text)) {
    newTest = R.reduce(buildTest, createEmptyTest(), R.split('\n', text));
    tests.push(newTest);
  }
}
1044295
def __reset_parser(self):
        
        self.result = []
        self.hash_comments = []

        self.__cstate = None
        self.__curcommand = None
        self.__curstringlist = None
        self.__expected = None
        self.__opened_blocks = 0
        RequireCommand.loaded_extensions = []
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()
                        );
                    }
                });
            }
        }
1075675
def _strip_comments(
        line: str,
        comments: Optional[List[str]] = None
    ) -> Tuple[str, List[str], bool]:
        """"""
        if comments is None:
            comments = []

        new_comments = False
        comment_start = line.find("#")
        if comment_start != -1:
            comments.append(line[comment_start + 1:].strip())
            new_comments = True
            line = line[:comment_start]

        return line, comments, new_comments
415920
def process(inputLines: List[str]) -> str:
    """"""
    lines = separate_trailing_comments(inputLines)
    merge_continued_lines(lines)
    (lines, comments) = extract_comments(lines)
    actual_lines = [
        line[1]
        for line in lines
        if line[1] is not None and "i_g_n_o_r_e___m_e_" not in line[1]
    ]
    return "".join(actual_lines)
168451
def restore_yaml_comments(data, default_data):
    
    comment_map = dict()
    default_lines = iter(default_data.splitlines())
    for line in default_lines:
        if not line:
            comment = "\n"
        elif line.startswith("#"):
            comment = "{0}\n".format(line)
        else:
            continue
        while True:
            line = next(default_lines)
            if line and not line.startswith("#"):
                break
            comment += "{0}\n".format(line)
        key = line.split(':')[0].strip()
        comment_map[key] = comment
    out_lines = iter(data.splitlines())
    out_data = ""
    for line in out_lines:
        key = line.split(':')[0].strip()
        if key in comment_map:
            out_data += comment_map[key]
        out_data += "{0}\n".format(line)
    return out_data
637477
def split_comment(cls, code):
        
        if '#' not in code: return code
        #: Remove comments only (leave quoted strings as they are)
        subf = lambda m: '' if m.group(0)[0]=='#' else m.group(0)
        return re.sub(cls.re_pytokens, subf, code)
676019
function each(obj, iterator, context) {
    var i;

    if (!obj) {
        return;
    }

    if (obj.forEach) {
        obj.forEach(iterator, context);
    } else if (obj.length !== undefined) {
        i = 0;
        while (i < obj.length) {
            iterator.call(context, obj[i], i, obj);
            i++;
        }
    } else {
        for (i in obj) {
            obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
        }
    }
}
976915
function parseComment (comment) {
  const body = j('[' + comment + ']').nodes()[0].program.body
  const array = body[0].expression
  return array.elements
}
333581
def comment_handle(self, original, loc, tokens):
        """"""
        internal_assert(len(tokens) == 1, "invalid comment tokens", tokens)
        ln = self.adjust(lineno(loc, original))
        internal_assert(lambda: ln not in self.comments, "multiple comments on line", ln)
        self.comments[ln] = tokens[0]
        return ""
1315719
def iter_lines(self, warn_only=False):
        """"""
        remain = ""
        for data in self.iter_content(LINE_CHUNK_SIZE, warn_only=True):
            line_break_found = data[-1] in (b"\n", b"\r")
            lines = data.decode(self.codec).splitlines()
            lines[0] = remain + lines[0]
            if not line_break_found:
                remain = lines.pop()
            for line in lines:
                yield line
        if remain:
            yield remain

        self._state = FINISHED
        if not warn_only:
            self.raise_for_error()
188653
def _operatorOperands(tokenlist):
        ""
        it = iter(tokenlist)
        while 1:
            try:
                yield (it.next(), it.next())
            except StopIteration:
                break
276990
def parse(self):
        
        index_server = None
        for num, line in enumerate(self.iter_lines()):
            line = line.rstrip()
            if not line:
                continue
            if line.startswith('#'):
                # comments are lines that start with # only
                continue
            if line.startswith('-i') or \
                line.startswith('--index-url') or \
                line.startswith('--extra-index-url'):
                # this file is using a private index server, try to parse it
                index_server = self.parse_index_server(line)
                continue
            elif self.obj.path and (line.startswith('-r') or line.startswith('--requirement')):
                self.obj.resolved_files.append(self.resolve_file(self.obj.path, line))
            elif line.startswith('-f') or line.startswith('--find-links') or \
                line.startswith('--no-index') or line.startswith('--allow-external') or \
                line.startswith('--allow-unverified') or line.startswith('-Z') or \
                line.startswith('--always-unzip'):
                continue
            elif self.is_marked_line(line):
                continue
            else:
                try:

                    parseable_line = line

                    # multiline requirements are not parseable
                    if "\\" in line:
                        parseable_line = line.replace("\\", "")
                        for next_line in self.iter_lines(num + 1):
                            parseable_line += next_line.strip().replace("\\", "")
                            line += "\n" + next_line
                            if "\\" in next_line:
                                continue
                            break
                        # ignore multiline requirements if they are marked
                        if self.is_marked_line(parseable_line):
                            continue

                    hashes = []
                    if "--hash" in parseable_line:
                        parseable_line, hashes = Parser.parse_hashes(parseable_line)

                    req = RequirementsTXTLineParser.parse(parseable_line)
                    if req:
                        req.hashes = hashes
                        req.index_server = index_server
                        # replace the requirements line with the 'real' line
                        req.line = line
                        self.obj.dependencies.append(req)
                except ValueError:
                    continue
1221506
def parse(self, text):
        ''''''
        in_comment = False
        result = []
        for s in iter(text.splitlines()):
            self.log.debug('Parsing string: {}'.format(s))
            rsc = self.RE_START_COMMENT.match(s)
            if rsc:
                if in_comment:
                    self.log.debug('Double comment start!')
                in_comment = True
                comment = rsc.group(1)
                jdoc = JDOC('', '', comment)
            if in_comment:
                rcb = self.RE_COMMENT_BODY.match(s)
                rp = self.RE_PARAM.match(s)
                rec = self.RE_END_COMMENT.match(s)
                if rp:
                    if rsc:
                        self.log.debug('Comment start and param on same line!')
                    param_name = rp.group(1)
                    param_desc = rp.group(2)
                    if param_name in ['function', 'trigger', 'procedure']:
                        rso = self.RE_SCHEMA_OBJECT.match(param_desc)
                        jdoc.object_type = param_name
                        if rso:
                            jdoc.schema_name = rso.group(1)
                            if jdoc.schema_name:
                                jdoc.schema_name = jdoc.schema_name.strip(".")
                            if not jdoc.schema_name or jdoc.schema_name == "":
                                jdoc.schema_name = self.default_schema
                            jdoc.object_name = rso.group(2)
                    elif param_name in ['return',
                                        'returns',
                                        'returning',
                                        'result']:
                        jdoc.returns = param_desc
                    else:
                        jdoc.add_param(param_name, param_desc)
                    self.log.debug('Param {} = {}'.format(param_name, param_desc))
                if rcb:
                    comment = comment + ' ' + rcb.group(1)
                    jdoc.comment = comment
                if rec:
                    in_comment = False
                    result.append(copy.deepcopy(jdoc))
                    del jdoc
                    self.log.debug('Comment:' + comment)
        return result
100659
def _comment_handler(c, ctx, whence):
    """"""
    assert c == _SLASH
    c, self = yield
    if c == _SLASH:
        ctx.set_line_comment()
        block_comment = False
    elif c == _ASTERISK:
        if ctx.line_comment:
            # This happens when a block comment immediately follows a line comment.
            ctx.set_line_comment(False)
        block_comment = True
    else:
        _illegal_character(c, ctx, 'Illegal character sequence "/%s".' % (_chr(c),))
    done = False
    prev = None
    trans = ctx.immediate_transition(self)
    while not done:
        c, _ = yield trans
        if block_comment:
            if prev == _ASTERISK and c == _SLASH:
                done = True
            prev = c
        else:
            if c in _NEWLINES or BufferQueue.is_eof(c):
                done = True
    yield ctx.set_self_delimiting(True).immediate_transition(whence)
203860
def get_comments_content_object(parser, token):
    
    keywords = token.contents.split()
    if len(keywords) != 5:
        raise template.TemplateSyntaxError(
            "'%s' tag takes exactly 2 arguments" % (keywords[0],))
    if keywords[1] != 'for':
        raise template.TemplateSyntaxError(
            "first argument to '%s' tag must be 'for'" % (keywords[0],))
    if keywords[3] != 'as':
        raise template.TemplateSyntaxError(
            "first argument to '%s' tag must be 'as'" % (keywords[0],))
    return GetCommentsContentObject(keywords[2], keywords[4])
761941
def _strip_comments(line):
        
        if line == '':
            return line
        r = re.search('(?P<line>[^#]*)(#(?P<comment>.*))?', line)
        if r:
            line = r.group('line')
            if not line.endswith('\n'):
                line += '\n'
            return line
        return '\n'