Whole file
lark-parser/lark
The author described this change as “fix tree_matcher when keep_all_tokens=True by setting sym.filter_out correctly.”. It counts as a record because the check below fails on the code as it stood at e4904b32d and passes on bdcd2e001, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2021-06-29
Sharing licenceMIT · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a save note
fix tree_matcher when keep_all_tokens=True by setting sym.filter_out correctly.
The change
| 630 | 630 | else: | |
| 631 | 631 | exp_options = options | |
| 632 | 632 | ||
| 633 | - | assert all(isinstance(x, Symbol) for x in expansion), expansion | |
| 633 | + | for sym in expansion: | |
| 634 | + | assert isinstance(sym, Symbol) | |
| 635 | + | if sym.is_term and exp_options and exp_options.keep_all_tokens: | |
| 636 | + | sym.filter_out = False | |
| 634 | 637 | rule = Rule(NonTerminal(name), expansion, i, alias, exp_options) | |
| 635 | 638 | compiled_rules.append(rule) | |
| 636 | 639 |
The check that tells the two apart
fail→pass·tests/test_reconstructor.py::TestReconstructor::test_keep_all_tokens
Check file tests/test_reconstructor.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 ite4904b32da24cf37f04b79672953e6ce3351bb67
Broken version dated2021-06-05
Modulelark.load_grammar
Units changedGrammar
Fingerprinta4a640f081144418
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