'Actually parse the config file.'

def _parse(self, infile):

    temp_list_values = self.list_values
    if self.unrepr:
        self.list_values = False
    comment_list = []
    done_start = False
    this_section = self
    maxline = (len(infile) - 1)
    cur_index = (-1)
    reset_comment = False
    while (cur_index < maxline):
        if reset_comment:
            comment_list = []
        cur_index += 1
        line = infile[cur_index]
        sline = line.strip()
        if ((not sline) or sline.startswith('#')):
            reset_comment = False
            comment_list.append(line)
            continue
        if (not done_start):
            self.initial_comment = comment_list
            comment_list = []
            done_start = True
        reset_comment = True
        mat = self._sectionmarker.match(line)
        if (mat is not None):
            (indent, sect_open, sect_name, sect_close, comment) = mat.groups()
            if (indent and (self.indent_type is None)):
                self.indent_type = indent
            cur_depth = sect_open.count('[')
            if (cur_depth != sect_close.count(']')):
                self._handle_error('Cannot    compute    the    section    depth', NestingError, infile, cur_index)
                continue
            if (cur_depth < this_section.depth):
                try:
                    parent = self._match_depth(this_section, cur_depth).parent
                except SyntaxError:
                    self._handle_error('Cannot    compute    nesting    level', NestingError, infile, cur_index)
                    continue
            elif (cur_depth == this_section.depth):
                parent = this_section.parent
            elif (cur_depth == (this_section.depth + 1)):
                parent = this_section
            else:
                self._handle_error('Section    too    nested', NestingError, infile, cur_index)
                continue
            sect_name = self._unquote(sect_name)
            if (sect_name in parent):
                self._handle_error('Duplicate    section    name', DuplicateError, infile, cur_index)
                continue
            this_section = Section(parent, cur_depth, self, name=sect_name)
            parent[sect_name] = this_section
            parent.inline_comments[sect_name] = comment
            parent.comments[sect_name] = comment_list
            continue
        mat = self._keyword.match(line)
        if (mat is None):
            self._handle_error('Invalid    line    ({0!r})    (matched    as    neither    section    nor    keyword)'.format(line), ParseError, infile, cur_index)
        else:
            (indent, key, value) = mat.groups()
            if (indent and (self.indent_type is None)):
                self.indent_type = indent
            if (value[:3] in ['"""', "'''"]):
                try:
                    (value, comment, cur_index) = self._multiline(value, infile, cur_index, maxline)
                except SyntaxError:
                    self._handle_error('Parse    error    in    multiline    value', ParseError, infile, cur_index)
                    continue
                else:
                    if self.unrepr:
                        comment = ''
                        try:
                            value = unrepr(value)
                        except Exception as e:
                            if (type(e) == UnknownType):
                                msg = 'Unknown    name    or    type    in    value'
                            else:
                                msg = 'Parse    error    from    unrepr-ing    multiline    value'
                            self._handle_error(msg, UnreprError, infile, cur_index)
                            continue
            elif self.unrepr:
                comment = ''
                try:
                    value = unrepr(value)
                except Exception as e:
                    if isinstance(e, UnknownType):
                        msg = 'Unknown    name    or    type    in    value'
                    else:
                        msg = 'Parse    error    from    unrepr-ing    value'
                    self._handle_error(msg, UnreprError, infile, cur_index)
                    continue
            else:
                try:
                    (value, comment) = self._handle_value(value)
                except SyntaxError:
                    self._handle_error('Parse    error    in    value', ParseError, infile, cur_index)
                    continue
            key = self._unquote(key)
            if (key in this_section):
                self._handle_error('Duplicate    keyword    name', DuplicateError, infile, cur_index)
                continue
            this_section.__setitem__(key, value, unrepr=True)
            this_section.inline_comments[key] = comment
            this_section.comments[key] = comment_list
            continue
    if (self.indent_type is None):
        self.indent_type = ''
    if ((not self) and (not self.initial_comment)):
        self.initial_comment = comment_list
    elif (not reset_comment):
        self.final_comment = comment_list
    self.list_values = temp_list_values
