Whole file

lark-parser/lark

The author described this change as Bugfix: Earley now respects ambiguity='resolve' again. Bug was introduced in a previous bugfix.. It counts as a record because the checks below fail on the code as it stood at ae207df1b and pass on e6cf57082, with nothing else changed between the two runs.

Fix saved2024-08-13
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a save note

Bugfix: Earley now respects ambiguity='resolve' again. Bug was introduced in a previous bugfix.

The change

306306 transformer = ForestToParseTree(self.Tree, self.callbacks, self.forest_sum_visitor and self.forest_sum_visitor(), self.resolve_ambiguity, use_cache)
307307 solutions = [transformer.transform(s) for s in solutions]
308308
309- if len(solutions) > 1:
309+ if len(solutions) > 1 and not self.resolve_ambiguity:
310310 t: Tree = self.Tree('_ambig', solutions)
311311 t.expand_kids_by_data('_ambig') # solutions may themselves be _ambig nodes
312312 return t

The check that tells the two apart

failpass·tests/test_parser.py::TestFullEarleyBasic::test_multiple_start_solutions
failpass·tests/test_parser.py::TestFullEarleyDynamic::test_multiple_start_solutions
failpass·tests/test_parser.py::TestFullEarleyDynamic_complete::test_multiple_start_solutions

Check file tests/test_parser.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itae207df1bbf6e2a7d11c7288a168090ba93f0abb
Broken version dated2024-08-13
Modulelark.parsers.earley
Units changedParser
Fingerprint74b13dc4b7e51343
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in lark-parser/lark