def parse(self,
              raw_sections=None,
              namespaces=True,
              strip_comments=True,
              strip_whitespaces=True,
              strip_quotation_markers=True,
              raise_parsing_errors=True):
        """
        Process the file content and extracts the sections / attributes
            as nested :class:`collections.OrderedDict` dictionaries or dictionaries.

        Usage::

            >>> content = ["; Comment.\\n", "Attribute 1 = \\"Value A\\"\\n", "Attribute 2 = \\"Value B\\"\\n"]
            >>> sections_file_parser = SectionsFileParser()
            >>> sections_file_parser.content = content
            >>> sections_file_parser.parse(strip_comments=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections.keys()
            [u'_defaults']
            >>> sections_file_parser.sections["_defaults"].values()
            [u'Value A', u'Value B']
            >>> sections_file_parser.parse(strip_comments=False, strip_quotation_markers=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"].values()
            [u'"Value A"', u'"Value B"']
            >>> sections_file_parser.comments
            OrderedDict([(u'_defaults|#0', {u'content': u'Comment.', u'id': 0})])
            >>> sections_file_parser.parse()
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"]
            OrderedDict([(u'_defaults|Attribute 1', u'Value A'), (u'_defaults|Attribute 2', u'Value B')])
            >>> sections_file_parser.parse(namespaces=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"]
            OrderedDict([(u'Attribute 1', u'Value A'), (u'Attribute 2', u'Value B')])

        :param raw_sections: Ignored raw sections.
        :type raw_sections: tuple or list
        :param namespaces: Attributes and comments are namespaced.
        :type namespaces: bool
        :param strip_comments: Comments are stripped.
        :type strip_comments: bool
        :param strip_whitespaces: Whitespaces are stripped.
        :type strip_whitespaces: bool
        :param strip_quotation_markers: Attributes values quotation markers are stripped.
        :type strip_quotation_markers: bool
        :param raise_parsing_errors: Raise parsing errors.
        :type raise_parsing_errors: bool
        :return: SectionFileParser instance.
        :rtype: SectionFileParser
        """

        LOGGER.debug("> Reading sections from: '{0}'.".format(self.path))

        if not self.content:
            self.read()

        attributes = {} if not self.__preserve_order else OrderedDict()
        section = self.__defaults_section
        raw_sections = raw_sections or []

        commentId = 0
        for i, line in enumerate(self.content):
            # Comments matching.
            search = re.search(r"^\s*[{0}](?P<comment>.+)$".format("".join(self.__comment_limiters)), line)
            if search:
                if not strip_comments:
                    comment = namespaces and foundations.namespace.set_namespace(section, "{0}{1}".format(
                        self.__comment_marker, commentId), self.__namespace_splitter) or \
                              "{0}{1}".format(self.__comment_marker, commentId)
                    self.__comments[comment] = {"id": commentId, "content": strip_whitespaces and
                                                                            search.group(
                                                                                "comment").strip() or search.group(
                        "comment")}
                    commentId += 1
                continue

            # Sections matching.
            search = re.search(r"^\s*\[(?P<section>.+)\]\s*$", line)
            if search:
                section = strip_whitespaces and search.group("section").strip() or search.group("section")
                if not self.__preserve_order:
                    attributes = {}
                else:
                    attributes = OrderedDict()
                rawContent = []
                continue

            if section in raw_sections:
                rawContent.append(line)
                attributes[self.__raw_section_content_identifier] = rawContent
            else:
                # Empty line matching.
                search = re.search(r"^\s*$", line)
                if search:
                    continue

                # Attributes matching.
                search = re.search(r"^(?P<attribute>.+?)[{0}](?P<value>.+)$".format("".join(self.__splitters)), line) \
                    or re.search(r"^(?P<attribute>.+?)[{0}]\s*$".format("".join(self.__splitters)), line)
                if search:
                    attribute = search.group("attribute").strip() if strip_whitespaces else search.group("attribute")
                    attribute = foundations.namespace.set_namespace(section, attribute, self.__namespace_splitter) \
                        if namespaces else attribute

                    if len(search.groups()) == 2:
                        value = search.group("value").strip() if strip_whitespaces else search.group("value")
                        attributes[attribute] = value.strip("".join(self.__quotation_markers)) \
                            if strip_quotation_markers else value
                    else:
                        attributes[attribute] = None
                else:
                    self.__parsing_errors.append(foundations.exceptions.AttributeStructureParsingError(
                        "Attribute structure is invalid: {0}".format(line), i + 1))

            self.__sections[section] = attributes

        LOGGER.debug("> Sections: '{0}'.".format(self.__sections))
        LOGGER.debug("> '{0}' file parsing done!".format(self.path))

        if self.__parsing_errors and raise_parsing_errors:
            raise foundations.exceptions.FileStructureParsingError(
                "{0} | '{1}' structure is invalid, parsing exceptions occured!".format(self.__class__.__name__,
                                                                                       self.path))

        return self
Process the file content and extracts the sections / attributes
            as nested :class:`collections.OrderedDict` dictionaries or dictionaries.

        Usage::

            >>> content = ["; Comment.\\n", "Attribute 1 = \\"Value A\\"\\n", "Attribute 2 = \\"Value B\\"\\n"]
            >>> sections_file_parser = SectionsFileParser()
            >>> sections_file_parser.content = content
            >>> sections_file_parser.parse(strip_comments=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections.keys()
            [u'_defaults']
            >>> sections_file_parser.sections["_defaults"].values()
            [u'Value A', u'Value B']
            >>> sections_file_parser.parse(strip_comments=False, strip_quotation_markers=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"].values()
            [u'"Value A"', u'"Value B"']
            >>> sections_file_parser.comments
            OrderedDict([(u'_defaults|#0', {u'content': u'Comment.', u'id': 0})])
            >>> sections_file_parser.parse()
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"]
            OrderedDict([(u'_defaults|Attribute 1', u'Value A'), (u'_defaults|Attribute 2', u'Value B')])
            >>> sections_file_parser.parse(namespaces=False)
            <foundations.parsers.SectionsFileParser object at 0x860323123>
            >>> sections_file_parser.sections["_defaults"]
            OrderedDict([(u'Attribute 1', u'Value A'), (u'Attribute 2', u'Value B')])

        :param raw_sections: Ignored raw sections.
        :type raw_sections: tuple or list
        :param namespaces: Attributes and comments are namespaced.
        :type namespaces: bool
        :param strip_comments: Comments are stripped.
        :type strip_comments: bool
        :param strip_whitespaces: Whitespaces are stripped.
        :type strip_whitespaces: bool
        :param strip_quotation_markers: Attributes values quotation markers are stripped.
        :type strip_quotation_markers: bool
        :param raise_parsing_errors: Raise parsing errors.
        :type raise_parsing_errors: bool
        :return: SectionFileParser instance.
        :rtype: SectionFileParser