From e75b7e400cd71e703e764b8fe5f28f3bb9e4b4da Mon Sep 17 00:00:00 2001 From: Jan Schultke Date: Thu, 21 Mar 2024 01:57:04 +0100 Subject: [PATCH] enh(c) add C23 keywords and types (#3836) --- CHANGES.md | 3 ++- src/languages/c.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8a42a86249..147e39a540 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ CAVEATS / POTENTIALLY BREAKING CHANGES Core Grammars: +- enh(c) added more C23 keywords and preprcoessor directives [Eisenwave][] - enh(js/ts) support namespaced tagged template strings [Aral Balkan][] - enh(perl) fix false-positive variable match at end of string [Josh Goebel][] - fix(cpp) not all kinds of number literals are highlighted correctly [Lê Duy Quang][] @@ -55,6 +56,7 @@ Themes: - Added `1c-light` theme a like in the IDE 1C:Enterprise 8 (for 1c) [Vitaly Barilko][] +[Eisenwave]: https://github.com/Eisenwave [Aral Balkan]: https://github.com/aral [Lê Duy Quang]: https://github.com/leduyquang753 [Mohamed Ali]: https://github.com/MohamedAli00949 @@ -134,7 +136,6 @@ Core Grammars: - fix(css) added '_' css variable detection [Md Saad Akhtar][] - enh(groovy) add `record` and `var` as keywords [Guillaume Laforge][] - Developer Tool: - (chore) Update dev tool to use the new `highlight` API. [Shah Shabbir Ahmmed][] diff --git a/src/languages/c.js b/src/languages/c.js index 227927913f..cb7f51dbe4 100644 --- a/src/languages/c.js +++ b/src/languages/c.js @@ -70,7 +70,7 @@ export default function(hljs) { end: /$/, keywords: { keyword: 'if else elif endif define undef warning error line ' - + 'pragma _Pragma ifdef ifndef include' }, + + 'pragma _Pragma ifdef ifndef elifdef elifndef include' }, contains: [ { begin: /\\\n/, @@ -148,14 +148,26 @@ export default function(hljs) { "char", "void", "_Bool", + "_BitInt", "_Complex", "_Imaginary", "_Decimal32", "_Decimal64", + "_Decimal96", "_Decimal128", + "_Decimal64x", + "_Decimal128x", + "_Float16", + "_Float32", + "_Float64", + "_Float128", + "_Float32x", + "_Float64x", + "_Float128x", // modifiers "const", "static", + "constexpr", // aliases "complex", "bool",