Comment out the given list of lines and return them.  The hash mark will
    be inserted before the first non-whitespace character on each line.
964998
def comment_lines(lines):
    """"""
    ret = []
    for line in lines:
        ws_prefix, rest, ignore = RE_LINE_SPLITTER_COMMENT.match(line).groups()
        ret.append(ws_prefix + '#' + rest)
    return ''.join(ret)
926538
public static String commentLine( String line ) {

		String result = line;
		if( ! Utils.isEmptyOrWhitespaces( line )
				&& ! line.trim().startsWith( ParsingConstants.COMMENT_DELIMITER ))
			result = ParsingConstants.COMMENT_DELIMITER + line;

		return result;
	}
625941
def strip_comments(text):
    
    regex = r'\s*(#|\/{2}).*$'
    regex_inline = r'(:?(?:\s)*([A-Za-z\d\.{}]*)|((?<=\").*\"),?)(?:\s)*(((#|(\/{2})).*)|)$'  # noqa
    lines = text.split('\n')

    for index, line in enumerate(lines):
        if re.search(regex, line):
            if re.search(r'^' + regex, line, re.IGNORECASE):
                lines[index] = ""
            elif re.search(regex_inline, line):
                lines[index] = re.sub(regex_inline, r'\1', line)

    return '\n'.join(lines)
1289601
def _strip_top_comments(lines):
        """"""
        lines = copy.copy(lines)
        while lines and lines[0].startswith("#"):
            lines = lines[1:]
        return "\n".join(lines)
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)
671312
def comments(self, text, start=0):
        

        out = [self.extractChunkContent(s)
               for s in self.chunkComment(text, start)]
        return out
479754
def _starts_till(src, probe, strip_comments=True):
    '''
    
    '''
    def _strip_comments(txt):
        '''
        Strip possible comments.
        Usually comments are one or two symbols at the beginning of the line, separated with space
        '''
        buff = txt.split(" ", 1)
        return len(buff) == 2 and len(buff[0]) < 2 and buff[1] or txt

    def _to_words(txt):
        '''
        Split by words
        '''
        return txt and [w for w in txt.strip().split(" ") if w.strip()] or txt

    no_match = -1
    equal = 0
    if not src or not probe:
        return no_match

    src = src.rstrip('\n\r')
    probe = probe.rstrip('\n\r')
    if src == probe:
        return equal

    src = _to_words(strip_comments and _strip_comments(src) or src)
    probe = _to_words(strip_comments and _strip_comments(probe) or probe)

    a_buff, b_buff = len(src) < len(probe) and (src, probe) or (probe, src)
    b_buff = ' '.join(b_buff)
    for idx in range(len(a_buff)):
        prb = ' '.join(a_buff[:-(idx + 1)])
        if prb and b_buff.startswith(prb):
            return idx

    return no_match
466822
def parse_lit(self, lines):
        '''
        
        '''
        comment_char = '#' # TODO: move this into a directive option
        comment = re.compile(r'^\s*{0}[ \n]'.format(comment_char))
        section_test = lambda val: bool(comment.match(val))

        sections = []
        for is_doc, group in itertools.groupby(lines, section_test):
            if is_doc:
                text = [comment.sub('', i).rstrip('\r\n') for i in group]
            else:
                text = [i.rstrip('\r\n') for i in group]

            sections.append((is_doc, text))

        return sections
1138379
function(comment){
    var ast = [];
    if (!comment.buffer) return;
    if (this.pp) push.apply(ast, this.prettyIndent(1, true));
    push.apply(ast, this.buffer('<!--' + comment.val + '-->'));
    return ast;
  }
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'
1226531
def comment(self, format, *args):
        
        return lib.zhash_comment(self._as_parameter_, format, *args)
451818
def _read_next(cls, lines: List[str]) -> 'Hunk':
        
        header = lines[0]
        assert header.startswith('@@ -')

        # sometimes the first line can occur on the same line as the header.
        # in that case, we inject a new line into the buffer
        end_header_at = header.index(' @@')
        bonus_line = header[end_header_at+3:]
        if bonus_line != "":
            lines.insert(1, bonus_line)

        header = header[4:end_header_at]
        left, _, right = header.partition(' +')
        old_start_at = int(left.split(',')[0])
        new_start_at = int(right.split(',')[0])

        old_line_num = old_start_at
        new_line_num = new_start_at
        last_insertion_at = old_start_at


        hunk_lines = [] # type: List[HunkLine]
        while True:
            # discarding the previous line ensures that we only consume lines
            # from the line buffer that belong to the hunk
            lines.pop(0)
            if not lines:
                break

            line = lines[0]

            # inserted line
            if line.startswith('+'):
                hunk_lines.append(InsertedLine(line[1:]))
                new_line_num += 1

            # deleted line
            elif line.startswith('-'):
                hunk_lines.append(DeletedLine(line[1:]))
                old_line_num += 1

            # context line
            elif line.startswith(' '):
                hunk_lines.append(ContextLine(line[1:]))
                new_line_num += 1
                old_line_num += 1

            # end of hunk
            else:
                break

        return Hunk(old_start_at, new_start_at, hunk_lines)
958900
def _end_comment_type_from_line(line):
    
    regex = re.compile(r"^{0}".format(_FTR_COMMENT))
    match = regex.match(line)
    if match:
        return " */"

    return ""
789025
def _ignore_comments(lines_enum):
    
    for line_number, line in lines_enum:
        line = COMMENT_RE.sub('', line)
        line = line.strip()
        if line:
            yield line_number, line
872250
def _remove_comment(line):
    
    # First find just quotes and their indexes.
    quote_indexes = []
    hash_indexes = []
    for i, ch in enumerate(line):
        if ch == '"':
            quote_indexes.append(i)
            if i > 0 and line[i - 1] == "\\":
                quote_indexes.pop()
        elif ch == '#':
            hash_indexes.append(i)

    comment_marker_index = -1
    for hash_index in hash_indexes:
        quote_index_ranges = [quote_indexes[i:i + 2] for i in range(0, len(quote_indexes), 2)]
        if not _check_index_within_index_pairs(hash_index, quote_index_ranges):
            comment_marker_index = hash_index
            break

    if comment_marker_index >= 0:
        line = line[:comment_marker_index]
    return line
1049292
def canonical_text(self, text):
        
        out = []
        line_continues_a_comment = False
        for line in text.splitlines():
            line,comment = self.comment_re.findall(line)[0]
            if line_continues_a_comment == True:
                out[-1] = out[-1] + line.lstrip()
            else:
                out.append(line)
            line_continues_a_comment = len(comment) > 0
        return '\n'.join(out).rstrip()+'\n'
1245566
def comment_text
      begin
        text = @scanner.scan(/.*/) # everything until newline
        text.rstrip! # benchmarked faster too rstrip the string in place
        raise PoSyntaxError, "Comment text should advance to next line or stop at eos" unless end_of_line
        text
      rescue PoSyntaxError => pe
        raise PoSyntaxError, "Syntax error in commtent_text\n" + pe.message, pe.backtrace
      end
    end