From 48a781fcf2f4121a6c2a2384e5d3bad9c63560ca Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Tue, 18 Sep 2018 21:19:20 +0300 Subject: [PATCH] Bugfix for propagate_positions --- lark/parse_tree_builder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lark/parse_tree_builder.py b/lark/parse_tree_builder.py index e81ca1b..a6e28e5 100644 --- a/lark/parse_tree_builder.py +++ b/lark/parse_tree_builder.py @@ -26,9 +26,10 @@ class PropagatePositions: def __call__(self, children): res = self.node_builder(children) - res.meta.empty = True - if children and isinstance(res, Tree): + if isinstance(res, Tree): + res.meta.empty = True + for c in children: if isinstance(c, Tree) and c.children and not c.meta.empty: res.meta.line = c.meta.line