'Parse a Cython generated C/C++ source file and find the executable lines.
Each executable line starts with a comment header that states source file
and line number, as well as the surrounding range of source code lines.'

def _parse_lines(self, c_file, sourcefile):

    if (self._parsed_c_files is None):
        self._parsed_c_files = {}
    if (c_file in self._parsed_c_files):
        code_lines = self._parsed_c_files[c_file]
    else:
        match_source_path_line = re.compile('    */[*]    +"(.*)":([0-9]+)$').match
        match_current_code_line = re.compile('    *[*]    (.*)    #    <<<<<<+$').match
        match_comment_end = re.compile('    *[*]/$').match
        not_executable = re.compile('\\s*c(?:type)?def\\s+(?:(?:public|external)\\s+)?(?:struct|union|enum|class)(\\s+[^:]+|)\\s*:').match
        code_lines = defaultdict(dict)
        filenames = set()
        with open(c_file) as lines:
            lines = iter(lines)
            for line in lines:
                match = match_source_path_line(line)
                if (not match):
                    continue
                (filename, lineno) = match.groups()
                filenames.add(filename)
                lineno = int(lineno)
                for comment_line in lines:
                    match = match_current_code_line(comment_line)
                    if match:
                        code_line = match.group(1).rstrip()
                        if not_executable(code_line):
                            break
                        code_lines[filename][lineno] = code_line
                        break
                    elif match_comment_end(comment_line):
                        break
        self._parsed_c_files[c_file] = code_lines
    if (self._c_files_map is None):
        self._c_files_map = {}
    for (filename, code) in code_lines.items():
        abs_path = _find_dep_file_path(c_file, filename)
        self._c_files_map[abs_path] = (c_file, filename, code)
    if (sourcefile not in self._c_files_map):
        return ((None,) * 2)
    return self._c_files_map[sourcefile][1:]
