Skip to content

fix(lexers): keep CMake bracket arguments intact - #1518

Merged
github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:fix/cmake-bracket-arguments-nov19
Nov 19, 2026
Merged

github-actions[bot] merged 1 commit into
alecthomas:masterfrom
yxshee:fix/cmake-bracket-arguments-nov19

Conversation

@yxshee

@yxshee yxshee commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

CMake prints the first message as a single argument. Chroma considers the closing parenthesis within the square brackets to be the end of the command, treats the following hash as a comment, and reports errors on the following line.

message([=[a ) # literal ]==] "quote"
still one argument]=])
message("next")

It will now lex up to and including the matching closing bracket (with the same number of equals signs) when it encounters a bracket argument. Similar constructs within an unquoted argument are highlighted as before.

This test fails on master with Found Error token in lexer CMake output. All 363 bracket arguments checked with CMake lex correctly, as do 28 cases with brackets within an unquoted argument. bit test, bit lint and bit check-generated succeed.

@github-actions
github-actions Bot enabled auto-merge (squash) November 19, 2026 12:48
@github-actions
github-actions Bot merged commit 665f0a6 into alecthomas:master Nov 19, 2026
4 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.

1 participant