Browse Source

Tweak the Earley ambiguity algorithm to correctly prefer earlier branches

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.7.4
night199uk 5 years ago
committed by Erez Sh
parent
commit
dc3c009dca
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      lark/parsers/earley_forest.py

+ 1
- 1
lark/parsers/earley_forest.py View File

@@ -122,7 +122,7 @@ class PackedNode(ForestNode):
ambiguously. Hence, we use the sort order to identify
the order in which ambiguous children should be considered.
"""
return self.is_empty, -self.priority, -self.rule.order
return self.is_empty, -self.priority, self.rule.order

def __iter__(self):
return iter([self.left, self.right])


Loading…
Cancel
Save