Skip to content

Commit

Permalink
fix(cpp) switch is a keyword (#3312)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Aug 29, 2021
1 parent 51d4c1b commit e4226f5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGES.md
@@ -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
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
@@ -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
@@ -0,0 +1,8 @@

if (ch) {}

switch (ch) {}

while (ch) {}

for (;;) {}

0 comments on commit e4226f5

Please sign in to comment.