'Resolve the given CITDL expression (starting at the given
scope) down to a non-import/non-variable hit.'

def _hit_from_citdl(self, expr, scoperef, defn_only=False):

    self._check_infinite_recursion(expr)
    tokens = list(self._tokenize_citdl_expr(expr))
    (hit, nconsumed) = self._hit_from_first_part(tokens, scoperef)
    if (not hit):
        raise CodeIntelError(("could    not    resolve    first    part    of    '%s'" % expr))
    self.debug('_hit_from_citdl:    first    part:    %r    ->    %r', tokens[:nconsumed], hit)
    remaining_tokens = tokens[nconsumed:]
    while remaining_tokens:
        self.debug('_hit_from_citdl:    resolve    %r    on    %r    in    %r', remaining_tokens, *hit)
        if (remaining_tokens[0] == '()'):
            new_hit = self._hit_from_call(*hit)
            nconsumed = 1
        else:
            (new_hit, nconsumed) = self._hit_from_getattr(remaining_tokens, *hit)
        remaining_tokens = remaining_tokens[nconsumed:]
        hit = new_hit
    (elem, scoperef) = hit
    if ((elem.tag == 'variable') and (not defn_only)):
        (elem, scoperef) = self._hit_from_variable_type_inference(elem, scoperef)
    self.info("'%s'    is    %s    on    %s", expr, elem, scoperef)
    return (elem, scoperef)
