<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def jpath_parse(jpath):
 """ Parse given JPath into chunks. Returns list of dictionaries describing all of the JPath chunks. :param str jpath: JPath to be parsed into chunks :return: JPath chunks as list of dicts :rtype: :py:class:`list` :raises JPathException: in case of invalid JPath syntax """

    result = []
    breadcrumbs = []

    # Split JPath into chunks based on '.' character.
    chunks = jpath.split('.')
    for chnk in chunks:
        match = RE_JPATH_CHUNK.match(chnk)
        if match:
            res = {}

            # Record whole match.
            res['m'] = chnk

            # Record breadcrumb path.
            breadcrumbs.append(chnk)
            res['p'] = '.'.join(breadcrumbs)

            # Handle node name.
            res['n'] = match.group(1)

            # Handle node index (optional, may be omitted).
            if match.group(2):
                res['i'] = match.group(3)
                if str(res['i']) == '#':
                    res['i'] = -1
                elif str(res['i']) == '*':
                    pass
                else:
                    res['i'] = int(res['i']) - 1

            result.append(res)
        else:
            raise JPathException("Invalid JPath chunk '{}'".format(chnk))
    return result