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.

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

630630 else:
631631 exp_options = options
632632
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
634637 rule = Rule(NonTerminal(name), expansion, i, alias, exp_options)
635638 compiled_rules.append(rule)
636639

The check that tells the two apart

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