Whole file

lark-parser/lark

The author described this change as Raise a GrammarError on empty string literal.. It counts as a record because the check below fails on the code as it stood at f7cde8766 and passes on c44bb3e0c, with nothing else changed between the two runs.

Fix saved2021-06-22
Sharing licenceMIT · LICENSE
Change size+3 0

What the code was meant to do, written into the code itself as a save note

Raise a GrammarError on empty string literal.

The change

448448
449449 s = eval_escaping(x)
450450
451+ if s == "":
452+ raise GrammarError("Can't have empty terminals (offending literal: %s)" % literal.value)
453+
451454 if literal.type == 'STRING':
452455 s = s.replace('\\\\', '\\')
453456 return PatternStr(s, flags, raw=literal.value)

The check that tells the two apart

failpass·tests/test_grammar.py::TestGrammar::test_empty_literal

Check file tests/test_grammar.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 itf7cde8766de619fc4490d914c8b9cfe1c97e2479
Broken version dated2021-05-23
Modulelark.load_grammar
Units changed_literal_to_pattern
Fingerprintec28b316de6e3d54
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