@classmethod
def _inContext(cls, adaptor, tokenNames, t, context):
    """The worker for inContext.

        It's static and full of parameters for testing purposes.
        """
    if cls.dotdotPattern.match(context):
        raise ValueError('invalid syntax: ..')
    if cls.doubleEtcPattern.match(context):
        raise ValueError('invalid syntax: ... ...')
    context = context.replace('...', ' ... ')
    context = context.strip()
    nodes = context.split()
    ni = len(nodes) - 1
    t = adaptor.getParent(t)
    while ni >= 0 and t is not None:
        if nodes[ni] == '...':
            if ni == 0:
                return True
            goal = nodes[ni - 1]
            ancestor = cls._getAncestor(adaptor, tokenNames, t, goal)
            if ancestor is None:
                return False
            t = ancestor
            ni -= 1
        name = tokenNames[adaptor.getType(t)]
        if name != nodes[ni]:
            return False
        ni -= 1
        t = adaptor.getParent(t)
    if t is None and ni >= 0:
        return False
    return True
