diff --git a/lark/parse_tree_builder.py b/lark/parse_tree_builder.py index 4a9edd3..904d186 100644 --- a/lark/parse_tree_builder.py +++ b/lark/parse_tree_builder.py @@ -227,10 +227,9 @@ class ParseTreeBuilder: options = rule.options keep_all_tokens = self.always_keep_all_tokens or options.keep_all_tokens expand_single_child = options.expand1 - from_template = options.template_source is not None wrapper_chain = list(filter(None, [ - (expand_single_child and not (rule.alias and not from_template)) and ExpandSingleChild, + (expand_single_child and not rule.alias) and ExpandSingleChild, maybe_create_child_filter(rule.expansion, keep_all_tokens, self.ambiguous, options.empty_indices if self.maybe_placeholders else None), self.propagate_positions and PropagatePositions, self.ambiguous and maybe_create_ambiguous_expander(self.tree_class, rule.expansion, keep_all_tokens),