'Return that range in the calltip of the "current" arg.
I.e. what argument is currently being entered.
"buf" is the buffer object on which this is being done.
"trg_pos" is the trigger position.
"calltip" is the full calltip text.
"curr_pos" is the current position in the buffer.
Returns a range: (start, end)
Set `start == -1` to cancel the calltip, i.e. if the entered text
has closed the call region.
The default implementation uses:
self.calltip_region_terminators
to handle languages with calltip signatures with the following
characteristics:
- uses \'(\' and \')\' to bound the argument list (though because of
support for \';\' statement termination, this isn\'t absolutely
required)
- uses a comma to separate arguments
- basic block delimiters are {}, (), and []
For example:
foo()
blam(a, b)
range([start,] stop[, step]) -> list of integers
bar(arg1, *args, **kwargs)
flash(boom, bang=42)'

def curr_calltip_arg_range(self, buf, trg_pos, calltip, curr_pos, DEBUG=False):

    accessor = buf.accessor
    if DEBUG:
        print banner('curr_calltip_arg_range')
        print ('calltip:\n%s' % indent(calltip))
        print ('buffer:\n%s' % indent(markup_text(accessor.text, trg_pos=trg_pos, pos=curr_pos)))
    skip_styles = dict(((s, True) for s in (buf.comment_styles() + buf.string_styles())))
    if (accessor.style_at_pos((trg_pos - 1)) in skip_styles):
        skip_styles = {}
    comma_count = 0
    blocks = {'(': ')', '[': ']', '{': '}'}
    block_stack = []
    p = trg_pos
    for (ch, style) in accessor.gen_char_and_style(trg_pos, curr_pos):
        if DEBUG:
            print ('pos    %2d:    %r    (%2s)    --' % (p, ch, style)),
        if (style in skip_styles):
            if DEBUG:
                print 'skip'
        elif (ch in blocks):
            if DEBUG:
                print 'open    block'
            block_stack.append(blocks[ch])
        elif block_stack:
            if (ch == block_stack[(-1)]):
                if DEBUG:
                    print 'close    block'
                block_stack.pop()
            elif (ch in self.calltip_region_terminators):
                if DEBUG:
                    print 'end    of    call    region:    (-1,    -1)'
                return ((-1), (-1))
            elif DEBUG:
                print 'ignore    (in    block)'
        elif (ch == ','):
            if DEBUG:
                print 'next    arg'
            comma_count += 1
        elif ((ch in self.calltip_region_terminators) and self.calltip_verify_termination(accessor, ch, trg_pos, curr_pos)):
            if DEBUG:
                print 'end    of    call    region:    (-1,    -1)'
            return ((-1), (-1))
        elif DEBUG:
            print 'ignore'
        p += 1
    if (self._parsed_calltip_cache[0] == calltip):
        parsed = self._parsed_calltip_cache[1]
    else:
        parsed = _parse_calltip(calltip, DEBUG)
        self._parsed_calltip_cache = (calltip, parsed)
    if (parsed is None):
        if DEBUG:
            print "couldn't    parse    any    calltip:    (0,    0)"
        return (0, 0)
    (signature, name, args) = parsed
    if DEBUG:
        print ('parsed    calltip:\n        signature:\n%s\n        name:\n%s\n        args:\n%s' % (indent(signature), indent(name), indent(pformat(args))))
    if (not args):
        if DEBUG:
            print 'no    args    in    signature:    (0,    0)'
        return (0, 0)
    elif (comma_count >= len(args)):
        if DEBUG:
            print 'more    commas    than    args:    ellipsis?'
        span = args[(-1)].span
    else:
        span = args[comma_count].span
    if DEBUG:
        print ('curr    calltip    range    (%s,    %s):' % (span[0], span[1]))
        print indent(signature)
        print ('                %s%s' % (('    ' * span[0]), ('-' * (span[1] - span[0]))))
    return span
