def parse_slice(token):
    """Parse a single slice string

    :param token: A string containing a number [3], a range [3:7] or a colon [:]
    :returns: An integer for simple numbers, or a slice object
    """
    try:
        return int(token)
    except ValueError:
        if token == ':':
            return ...
        elif ':' in token:
            rng = [int(s) for s in token.split(':')]
            # The DAP protocol uses slicing including the last index.
            # [0:20] in DAP translates to [0:21] in Python.
            rng[1] += 1
            return slice(*rng)