def METHOD_NAME(self, s, state, rules):
    sc = self._create_scanner(rules)
    for tok in sc.iter(s, state, self.parse_text):
        if isinstance(tok, list):
            for t in tok:
                yield t
        elif tok:
            yield tok