Skip to content

fix(cpp) switch is a keyword #3312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Version 11.3.0 (most likely)

enh(css/less/stylus/scss) improve consistency of function dispatch (#3301) [Josh Goebel][]
enh(css/less/stylus/scss) detect block comments more fully (#3301) [Josh Goebel][]
- enh(css/less/stylus/scss) improve consistency of function dispatch (#3301) [Josh Goebel][]
- enh(css/less/stylus/scss) detect block comments more fully (#3301) [Josh Goebel][]
- fix(cpp) switch is a keyword (#3312) [Josh Goebel][]
- fix(cpp) fix `xor_eq` keyword highlighting. [Denis Kovalchuk][]
- enh(css/less/stylus/scss) add support for CSS Grid properties [monochromer][]

Expand Down
1 change: 1 addition & 0 deletions src/languages/cpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ export default function(hljs) {
/(?!decltype)/,
/(?!if)/,
/(?!for)/,
/(?!switch)/,
/(?!while)/,
hljs.IDENT_RE,
regex.lookahead(/(<[^<>]+>|)\s*\(/))
Expand Down
7 changes: 7 additions & 0 deletions test/markup/cpp/function-like-keywords.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<span class="hljs-keyword">if</span> (ch) {}

<span class="hljs-keyword">switch</span> (ch) {}

<span class="hljs-keyword">while</span> (ch) {}

<span class="hljs-keyword">for</span> (;;) {}
8 changes: 8 additions & 0 deletions test/markup/cpp/function-like-keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

if (ch) {}

switch (ch) {}

while (ch) {}

for (;;) {}