diff options
-rw-r--r-- | abdl/_vm.py | 10 | ||||
-rw-r--r-- | setup.py | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/abdl/_vm.py b/abdl/_vm.py index f8b8c80..41f28eb 100644 --- a/abdl/_vm.py +++ b/abdl/_vm.py @@ -88,18 +88,24 @@ class KeySubtree(PatternElement): self.key = toks[0] self.skippable = toks[1] == '?' + def on_in_key(self, frame, path, defs): + return self.on_not_in_key(frame, path, defs) + def on_not_in_key(self, frame, path, defs): path[-1].subtree = True - filtered_iterator = self.filter(path[-1].iterator, defs) + filtered_iterator = self.filter(path[-1].iterator, defs, name=path[-1].name) del path[-1].iterator path[-1].iterator = filtered_iterator del filtered_iterator path[-1].empty = False return True - def filter(self, iter_, defs): + def filter(self, iter_, defs, name): for x in iter_: for y in match_helper(self.key, defs, x[0]): + if name: + # FIXME this "name" thing is a bit suboptimal + y.setdefault(name, x) yield (y, x[1]) def collect_params(self, res: list): diff --git a/setup.py b/setup.py index d90a0be..4e8277e 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ import setuptools -setuptools.setup(name="gan0f74bd87a23b515b45da7e6f5d9cc82380443dab", version="2.1.1", packages=["abdl"], install_requires=["pyparsing >= 2.4.2"]) +setuptools.setup(name="gan0f74bd87a23b515b45da7e6f5d9cc82380443dab", version="2.1.2", packages=["abdl"], install_requires=["pyparsing >= 2.4.2"]) |