On Wednesday, November 13, 2019 at 5:12:32 AM UTC-6, Edward K. Ream wrote:
> There is no great rush to [use generators].
Generators now work. I did say that this is an all-consuming project :-)
leoAst.py now contains two new classes:
- class *TokenOrderGenerator*, the base class for all tree generators.
- class *TokenOrderInjector *(TokenOrderGenerator). This class contains a
single method, TOI.begin_visitor, that injects links into tokens, then
calls super().begin_visitor to get all the default stuff:
def begin_visitor(self, node):
# Do this first, *before* updating self.node.
self.coverage_set.add(node.__class__.__name__)
node.parent = self.node
if self.node:
children = getattr(self.node, 'children', [])
children.append(node)
self.node.children = children
# *Now* update self.node, etc.
super().begin_visitor(node)
> Debugging lists is a lot easier than debugging generators.
Belay that. I have been pleasantly surprised how easy everything has been.
There were a few tweaks to my initial plan, but nothing at all serious.
It's been a good day.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/ccde53eb-eb2c-42e0-b6e2-15cedcc97b40%40googlegroups.com.