Whole file

terryyin/lizard

The author described this change as fix: prevent IndexError on nested TypeScript template literals (fixes #471). It counts as a record because the check below fails on the code as it stood at c4d9a60c7 and passes on 35f9273b6, with nothing else changed between the two runs.

Fix saved2026-04-22
Sharing licenceMIT · LICENSE.txt
Change size+5 0

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

fix: prevent IndexError on nested TypeScript template literals (fixes #471)

The change

9898 elif content[i] == '}':
9999 brace_count -= 1
100100 i += 1
101+
102+ if brace_count > 0:
103+ yield token
104+ return
105+
101106 expr = content[expr_start:i - 1]
102107 yield expr
103108 yield '}'

The check that tells the two apart

failpass·test/test_languages/testTypeScript.py::Test_tokenizing_TypeScript::test_nested_template_literal_exact_tokens

Check file test/test_languages/testTypeScript.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 itc4d9a60c77828cd43315a9adbc3523512fd8b19f
Broken version dated2026-04-22
Modulelizard_languages.typescript
Units changedTypeScriptReader
Fingerprintacbf64fb8706ae79
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 terryyin/lizard