Parses all the docstrings out of the specified string.

        Returns a dictionary of docstrings with the key as parent.code_element_name
        and the value a list of XML elements that contain docstrings.

def _parse_docblocks(self, string, container):
        """Parses all the docstrings out of the specified string.

        Returns a dictionary of docstrings with the key as parent.code_element_name
        and the value a list of XML elements that contain docstrings.
        """
        #The easiest way to do this is to look at one line at a time and see if it is a docstring
        #When we find a group of docstrings that suddenly ends, the next item is the code element
        #that they were decorating (which may or may not be pertinent).
        from fortpy.utility import XML
        current = []
        docblocks = {}
        docstart = 0

        for line in string.split("\n"):
            match = self.RE_DOCS.match(line)
            if match is not None:
                current.append(match.group("docstring"))
                if len(current) == 1:
                    #This was the first docstring of a new documentation block.
                    docend = docstart + len(line) + 1  # +1 for \n removed by split()
                else:
                    #We already have some docstrings in the block, update start/end
                    docend += len(line) + 1
            else:
                #See if we were previously working on a docstring block or not.
                if len(current) > 0:
                    #Save all the current docstrings in the blocks dictionary
                    #under the name of the code element in this line.
                    key = self._parse_docline(line, container)
                    #If the docblock has multiple XML tags at the same depth, the XML
                    #parser will scream. Wrap everything in a doc tag.
                    doctext = "<doc>{}</doc>".format(" ".join(current))
                    try:
                        #Let the docstart and docend *always* be absolute character references.
                        tabsstart, tabsend = container.module.absolute_charindex(string, docstart, docend-len(line))
                        emsg="module '{0}' docstring starting @ {1[0]}:{1[1]}"
                        emsg=emsg.format(container.module.name, container.module.linenum(tabsstart))
                        docs = XML(doctext, emsg)
                        if not key in docblocks:
                            absstart, absend = tabsstart, tabsend
                            docblocks[key] = [list(docs), absstart, absend]
                        else:
                            docblocks[key][0].extend(list(docs))
                    except ET.ParseError as err:
                        msg.err(err.msg)

                    #Reset the list of current docstrings
                    current = []
                    docstart = docend + len(line) + 1
                else:
                    #We need to keep track of the line lengths for docstart/end.
                    docstart += len(line) + 1

        return docblocks