def parse_arguments(stream, end_token):
    """
    Helper function for function argument parsing.  Pass it a
    `TokenStream` and the delimiter token for the argument section and
    it will extract all position and keyword arguments as well as
    each argument's type info (string literal or not).

    Returns a ``(args, kwargs)`` tuple.
    """
    args = []
    kwargs = {}
    keywords = []
    while stream.current.type != end_token:
        if stream.current.type == 'func_string_arg':
            value = stream.current.value.strip()
            for char in ["'", '"']:
                if value.startswith(char) and value.endswith(char):
                    value = value[1:-1]
                    break
            stream.next()
            if keywords:
                for keyword in keywords:
                    kwargs[keyword] = value
                del keywords[:]
            else:
                args.append((value, 'func_string_arg'))
        elif stream.current.type == 'text':
            args.append((stream.current.value, 'text'))
            stream.next()
        elif stream.current.type == 'func_kwarg':
            keywords.append(stream.current.value)
            stream.next()
        elif stream.current.type == 'func_argument_delimiter':
            stream.next()
        else:
            break
    for keyword in keywords:
        args.append((keyword, 'func_kwarg'))
    return tuple(args), kwargs
