'Generator yielding matches for a sequence of nodes.
Args:
nodes: sequence of nodes
Yields:
(count, results) tuples where:
count: the match comprises nodes[:count];
results: dict containing named submatches.'

def generate_matches(self, nodes):

    if (self.content is None):
        for count in xrange(self.min, (1 + min(len(nodes), self.max))):
            r = {}
            if self.name:
                r[self.name] = nodes[:count]
            (yield (count, r))
    elif (self.name == 'bare_name'):
        (yield self._bare_name_matches(nodes))
    else:
        if hasattr(sys, 'getrefcount'):
            save_stderr = sys.stderr
            sys.stderr = StringIO()
        try:
            for (count, r) in self._recursive_matches(nodes, 0):
                if self.name:
                    r[self.name] = nodes[:count]
                (yield (count, r))
        except RuntimeError:
            for (count, r) in self._iterative_matches(nodes):
                if self.name:
                    r[self.name] = nodes[:count]
                (yield (count, r))
        finally:
            if hasattr(sys, 'getrefcount'):
                sys.stderr = save_stderr
