def _reconstruct(self, tree):
    callbacks = {rule: rule.alias for rule in self.rules}
    parser = earley.Parser(ParserConf(self.rules, callbacks, tree.data), self._match, resolve_ambiguity=True)
    unreduced_tree = parser.parse(tree.children)
    assert (unreduced_tree.data == tree.data)
    res = self.write_tokens.transform(unreduced_tree)
    for item in res:
        if isinstance(item, Tree):
            for x in self._reconstruct(item):
                (yield x)
        else:
            (yield item)
def _reconstruct(self, tree):
    callbacks = {rule: rule.alias for rule in self.rules}
    parser = earley.Parser(ParserConf(self.rules, callbacks, tree.data), self._match, resolve_ambiguity=True)
    unreduced_tree = parser.parse(tree.children)
    assert (unreduced_tree.data == tree.data)
    res = self.write_tokens.transform(unreduced_tree)
    for item in res:
        if isinstance(item, Tree):
            for x in self._reconstruct(item):
                (yield x)
        else:
            (yield item)