Skip to content

Commit

Permalink
Add comment explaining the change
Browse files Browse the repository at this point in the history
  • Loading branch information
chanicpanic committed Jun 29, 2024
1 parent 50a8a14 commit 4c1507a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lark/parsers/earley.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ def parse(self, lexer, start):

if self.Tree is not None:
# Perform our SPPF -> AST conversion
transformer = ForestToParseTree(self.Tree, self.callbacks, self.forest_sum_visitor and self.forest_sum_visitor(), self.resolve_ambiguity, not self.resolve_ambiguity)
# Disable the ForestToParseTree cache when ambiguity='resolve'
# to prevent a tree construction bug. See issue #1283
use_cache = not self.resolve_ambiguity
transformer = ForestToParseTree(self.Tree, self.callbacks, self.forest_sum_visitor and self.forest_sum_visitor(), self.resolve_ambiguity, use_cache)
solutions = [transformer.transform(s) for s in solutions]

if len(solutions) > 1:
Expand Down

0 comments on commit 4c1507a

Please sign in to comment.