Browse Source

Fix issue with propagate_positions

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.6
Erez Shinan 6 years ago
parent
commit
0935543280
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      lark/parse_tree_builder.py

+ 2
- 2
lark/parse_tree_builder.py 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),
])



Loading…
Cancel
Save