Skip to content

fix(lexers): recognize CMake bracket comments - #1520

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

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

Conversation

@yxshee

@yxshee yxshee commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Only the second message will be evaluated by CMake. Chroma stops the comment after one newline, highlights the commented-out statement as a command, then emits an error on ]==].

#[=[ disabled
message("hidden") ]==]
]=]
message("visible")

Bracket comments are now lexed up to the closing bracket with the same number of equals signs. In addition, backslash escapes are consumed within an unquoted argument, so \# stays literal and a subsequent unescaped # can begin a comment.

On master the fixture reports Found Error token in lexer CMake output. All 262 bracket comments in CMake's own module files that tree-sitter could parse are correctly identified. bit test, bit lint, and bit check-generated succeed.

@github-actions
github-actions Bot enabled auto-merge (squash) November 19, 2026 13:12
@github-actions
github-actions Bot merged commit 735c62e 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