Fix issue with propagate_positions

This commit is contained in:
Erez Shinan 2018-11-13 14:46:50 +02:00
parent 74fc559ea5
commit 0935543280
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ class PropagatePositions:
def __call__(self, children):
res = self.node_builder(children)
if isinstance(res, Tree):
if isinstance(res, Tree) and getattr(res.meta, 'empty', True):
res.meta.empty = True
for c in children:
@ -144,9 +144,9 @@ class ParseTreeBuilder:
expand_single_child = options.expand1 if options else False
wrapper_chain = filter(None, [
self.propagate_positions and PropagatePositions,
(expand_single_child and not rule.alias) and ExpandSingleChild,
maybe_create_child_filter(rule.expansion, keep_all_tokens),
self.propagate_positions and PropagatePositions,
self.ambiguous and maybe_create_ambiguous_expander(self.tree_class, rule.expansion, keep_all_tokens),
])