Skip to content

Commit abcb53d

Browse files
authored
enh(cmake) support bracket comments (#3644)
1 parent 71f5cb2 commit abcb53d

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
New Grammars:
44

5-
- Added 3rd party LookML grammar to SUPPORTED_LANGUAGES [Josh Temple][]
65
- added 3rd party LookML grammar to SUPPORTED_LANGUAGES [Josh Temple][]
76
- added 3rd party FunC grammar to SUPPORTED_LANGUAGES [Nikita Sobolev][]
87

@@ -14,12 +13,14 @@ Grammars:
1413
- fix(js) do not flag `import()` as a function, rather a keyword [nathnolt][]
1514
- fix(bash) recognize the `((` keyword [Nick Chambers][]
1615
- fix(nix) support escaped dollar signs in strings [h7x4][]
16+
- enh(cmake) support bracket comments [Hirse][]
1717

1818
[Josh Goebel]: https://github.com/joshgoebel
1919
[Josh Temple]: https://github.com/joshtemple
2020
[nathnolt]: https://github.com/nathnolt
2121
[Nick Chambers]: https://github.com/uplime
2222
[h7x4]: https://github.com/h7x4
23+
[Hirse]: https://github.com/Hirse
2324

2425

2526
## Version 11.6.0

src/languages/cmake.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default function(hljs) {
5252
begin: /\$\{/,
5353
end: /\}/
5454
},
55+
hljs.COMMENT(/#\[\[/, /]]/),
5556
hljs.HASH_COMMENT_MODE,
5657
hljs.QUOTE_STRING_MODE,
5758
hljs.NUMBER_MODE

test/markup/cmake/default.expect.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@
1717

1818
<span class="hljs-keyword">add_executable</span>(myproject main.cpp mainwindow.cpp)
1919
<span class="hljs-keyword">qt5_use_modules</span>(myproject Widgets)
20+
21+
<span class="hljs-comment">#[[This is a bracket comment.
22+
It runs until the close bracket.]]</span>
23+
<span class="hljs-keyword">message</span>(<span class="hljs-string">&quot;First Argument\n&quot;</span> <span class="hljs-comment">#[[Bracket Comment]]</span> <span class="hljs-string">&quot;Second Argument&quot;</span>)

test/markup/cmake/default.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ find_package(Qt5Widgets REQUIRED)
1717

1818
add_executable(myproject main.cpp mainwindow.cpp)
1919
qt5_use_modules(myproject Widgets)
20+
21+
#[[This is a bracket comment.
22+
It runs until the close bracket.]]
23+
message("First Argument\n" #[[Bracket Comment]] "Second Argument")

0 commit comments

Comments
 (0)