Whole file
lark-parser/lark
The author described this change as “BUGFIX: Solved an elusive bug in Earley parser, when empty rules repeat in the same column”. It counts as a record because the check below fails on the code as it stood at a7f99dd8c and passes on 1685f94ea, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2017-04-05
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
BUGFIX: Solved an elusive bug in Earley parser, when empty rules repeat in the same column
The change
| 98 | 98 | for item in items: | |
| 99 | 99 | ||
| 100 | 100 | if item.is_complete: | |
| 101 | - | # XXX TODO Potential bug: What happens if there's ambiguity in an empty rule? | |
| 101 | + | # XXX Potential bug: What happens if there's ambiguity in an empty rule? | |
| 102 | 102 | if item.rule.expansion and item in self.completed: | |
| 103 | 103 | old_tree = self.completed[item].tree | |
| 104 | 104 | if old_tree.data != 'ambig': | |
| ⋯ | |||
| 110 | 110 | old_tree.children.append(item.tree) | |
| 111 | 111 | else: | |
| 112 | 112 | self.completed[item] = item | |
| 113 | - | self.to_reduce.append(item) | |
| 113 | + | self.to_reduce.append(item) | |
| 114 | 114 | else: | |
| 115 | 115 | if item not in added: | |
| 116 | 116 | added.add(item) | |
The check that tells the two apart
fail→pass·tests/test_parser.py::TestEarley::test_earley_repeating_empty
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 ita7f99dd8c6a8472fb4e05c4634b248887d0e39e9
Broken version dated2017-03-20
Modulelark.parsers.earley
Units changedColumn
Fingerprinta706e686fcb5564d
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
- 2026-07-08Fix lexer_callbacks silently dropped for keyword terminals
- 2026-06-24Transformer_NonRecursive
- 2026-06-04Raise GrammarError for non-terminal names in %declare
- 2026-06-02Fix empty SPPF node from xearley ignore carry-over (fixes #1598)
- 2026-05-24fix: raise GrammarError for template usage inside terminals
- 2024-10-25Adjust behaviour in #1481 to raise a NotImplementedError