Skip to content

fix(lang): keep highlighter from propagating lexer errors (A1)#38

Merged
dsent merged 1 commit into
aldum:devfrom
Vadim1987:fix/a1-highlighter-lexer
Jul 4, 2026
Merged

fix(lang): keep highlighter from propagating lexer errors (A1)#38
dsent merged 1 commit into
aldum:devfrom
Vadim1987:fix/a1-highlighter-lexer

Conversation

@Vadim1987

Copy link
Copy Markdown

parse consumes the token stream inside pcall, but highlighter realizes the same stream unprotected, so a lexer-level error (e.g. a string escape above 255: "\999", lexer.lua:289) propagates out of syntax highlighting and crashes the app on text change.
Guard the token realization the same way parse does and fall back to an empty SyntaxColoring — consumers handle it by design (auto-vivifying table), and the error position still gets marked through the parse path.
Adds a regression test; the test fails without the fix.

@dsent dsent requested a review from aldum July 2, 2026 19:40
@dsent dsent merged commit 907e241 into aldum:dev Jul 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants