One function
Transformer in lark-parser/lark
The author described this change as “Fixed Discard, broken in 0.6.6 (Issue #337)”. It counts as a record because the check below fails on the code as it stood at e16bb3557 and passes on 2b3fabd01, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2019-03-09
Sharing licenceMIT · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
Visits the tree recursively, starting with the leaves and finally the root (bottom-up) Calls its methods (provided by user via inheritance) according to tree.data The returned value replaces the old one in the structure. Can be used to implement map or reduce.
The change
| 26 | 26 | return f(tree) | |
| 27 | 27 | else: | |
| 28 | 28 | return f(children) | |
| 29 | - | except GrammarError: | |
| 29 | + | except (GrammarError, Discard): | |
| 30 | 30 | raise | |
| 31 | 31 | except Exception as e: | |
| 32 | 32 | raise VisitError(tree, e) |
The check that tells the two apart
fail→pass·tests/test_trees.py::TestTrees::test_discard
Check file tests/test_trees.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 ite16bb35576cfbcd0c4c2ae0c1c5d03370697a0da
Broken version dated2019-03-09
Modulelark.visitors
Units changedTransformer
Fingerprint54e7291b97aca9ba
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