Whole file
lark-parser/lark
The author described this change as “%ignore bug fixed in xearley (thanks to issue #44)”. It counts as a record because the check below fails on the code as it stood at 34449651b and passes on 6f85ca429, with nothing else changed between the two runs.
Projectlark-parser/lark
Fix saved2017-11-19
Sharing licenceMIT · LICENSE
Change size+1 −7
What the code was meant to do, written into the code itself as a save note
%ignore bug fixed in xearley (thanks to issue #44)
The change
| 52 | 52 | # Define parser functions | |
| 53 | 53 | start_symbol = start_symbol or self.start_symbol | |
| 54 | 54 | delayed_matches = defaultdict(list) | |
| 55 | - | match_after_ignore = set() | |
| 56 | 55 | ||
| 57 | 56 | text_line = 1 | |
| 58 | 57 | text_column = 0 | |
| ⋯ | |||
| 89 | 88 | m = x.match(stream, i) | |
| 90 | 89 | if m: | |
| 91 | 90 | delayed_matches[m.end()] += set(to_scan) | |
| 92 | - | if m.end() == len(stream): | |
| 93 | - | match_after_ignore.update(set(column.to_reduce)) | |
| 91 | + | delayed_matches[m.end()] += set(column.to_reduce) | |
| 94 | 92 | ||
| 95 | 93 | # TODO add partial matches for ignore too? | |
| 96 | 94 | # s = m.group(0) | |
| ⋯ | |||
| 140 | 138 | ||
| 141 | 139 | # Parse ended. Now build a parse tree | |
| 142 | 140 | solutions = [n.tree for n in column.to_reduce | |
| 143 | - | if n.rule.origin==start_symbol and n.start is column0] | |
| 144 | - | ||
| 145 | - | if not solutions: | |
| 146 | - | solutions = [n.tree for n in match_after_ignore | |
| 147 | 141 | if n.rule.origin==start_symbol and n.start is column0] | |
| 148 | 142 | ||
| 149 | 143 | if not solutions: | |
The check that tells the two apart
fail→pass·tests/test_parser.py::TestEarleyDynamic::test_ignore
Check file tests/test_parser.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 it34449651bf24e1dd130d9986dde930582e176749
Broken version dated2017-11-17
Modulelark.parsers.xearley
Units changedParser
Fingerprint2a154dd8fc87db4a
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