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.

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

5252 # Define parser functions
5353 start_symbol = start_symbol or self.start_symbol
5454 delayed_matches = defaultdict(list)
55- match_after_ignore = set()
5655
5756 text_line = 1
5857 text_column = 0
8988 m = x.match(stream, i)
9089 if m:
9190 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)
9492
9593 # TODO add partial matches for ignore too?
9694 # s = m.group(0)
140138
141139 # Parse ended. Now build a parse tree
142140 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
147141 if n.rule.origin==start_symbol and n.start is column0]
148142
149143 if not solutions:

The check that tells the two apart

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