Skip to content

Commit

Permalink
Implement CMake bracket comment syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanvelzen committed Feb 24, 2023
1 parent 8f417de commit 07b7a7c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions pygments/lexers/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class CMakeLexer(RegexLexer):
],
'ws': [
(r'[ \t]+', Whitespace),
(r'(?:#\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])', Comment),
(r'#.*\n', Comment),
]
}
Expand Down
10 changes: 10 additions & 0 deletions tests/examplefiles/cmake/main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ ANOTHER_COMMAND() # this command has no arguments
YET_ANOTHER_COMMAND( these
arguments are spread # another comment
over several lines )

#[[ multiline
CMake comment
]]

#[==[ another multiline
CMake comment
]==]

#[==[ #[[ A "nested" comment ]] ]==]
15 changes: 15 additions & 0 deletions tests/examplefiles/cmake/main.cmake.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07b7a7c

Please sign in to comment.