One function
Transformer_NonRecursive in lark-parser/lark
The author described this change as “Fix for #826 (Thanks @mikeiovine) + stubs + tests”. It counts as a record because the check below fails on the code as it stood at 3e7e66eb8 and passes on 7f795e827, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2021-02-05
Sharing licenceMIT · LICENSE
Change size+2 −0
What the code was meant to do, written into the code itself as a docstring
Same as Transformer but non-recursive. Like Transformer, it doesn't change the original tree. Useful for huge trees.
The change
| 27 | 27 | else: | |
| 28 | 28 | args = [] | |
| 29 | 29 | stack.append(self._call_userfunc(x, args)) | |
| 30 | + | elif self.__visit_tokens__ and isinstance(x, Token): | |
| 31 | + | stack.append(self._call_userfunc_token(x)) | |
| 30 | 32 | else: | |
| 31 | 33 | stack.append(x) | |
| 32 | 34 |
The check that tells the two apart
fail→pass·tests/test_trees.py::TestTrees::test_transformer_variants
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 it3e7e66eb8e06cd77fcc1712aeffcb9b86db09290
Broken version dated2021-01-27
Modulelark.visitors
Units changedTransformer_NonRecursive
Fingerprinta941355eb618f070
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