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.

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

2626 return f(tree)
2727 else:
2828 return f(children)
29- except GrammarError:
29+ except (GrammarError, Discard):
3030 raise
3131 except Exception as e:
3232 raise VisitError(tree, e)

The check that tells the two apart

failpass·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