mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
runtime(c): add new constexpr keyword to syntax file (C23)
closes: #16471 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
1d2867df0c
commit
e06405181a
@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: C
|
" Language: C
|
||||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||||
" Last Change: 2025 Jan 15
|
" Last Change: 2025 Jan 18
|
||||||
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
|
|
||||||
" Quit when a (custom) syntax file was already loaded
|
" Quit when a (custom) syntax file was already loaded
|
||||||
@ -318,6 +318,9 @@ syn keyword cStorageClass static register auto volatile extern const
|
|||||||
if !exists("c_no_c99") && !s:in_cpp_family
|
if !exists("c_no_c99") && !s:in_cpp_family
|
||||||
syn keyword cStorageClass inline restrict
|
syn keyword cStorageClass inline restrict
|
||||||
endif
|
endif
|
||||||
|
if (s:ft ==# "c" && !exists("c_no_c23")) || (s:in_cpp_family && !exists("cpp_no_cpp11"))
|
||||||
|
syn keyword cStorageClass constexpr
|
||||||
|
endif
|
||||||
if !exists("c_no_c11")
|
if !exists("c_no_c11")
|
||||||
syn keyword cStorageClass _Alignas alignas
|
syn keyword cStorageClass _Alignas alignas
|
||||||
syn keyword cOperator _Alignof alignof
|
syn keyword cOperator _Alignof alignof
|
||||||
|
20
runtime/syntax/testdir/dumps/c_keywords_00.dump
Normal file
20
runtime/syntax/testdir/dumps/c_keywords_00.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
>/+0#0000e05#ffffff0@1| |C| |k|e|y|w|o|r|d|s| +0#0000000&@61
|
||||||
|
@75
|
||||||
|
|/+0#0000e05&@1| |S|o|u|r|c|e|:| |h|t@1|p|s|:|/@1|e|n|.|c|p@1|r|e|f|e|r|e|n|c|e|.|c|o|m|/|w|/|c|/|k|e|y|w|o|r|d| +0#0000000&@24
|
||||||
|
@75
|
||||||
|
|a+0#00e0003&|l|i|g|n|a|s| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@58
|
||||||
|
|a+0#af5f00255&|l|i|g|n|o|f| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@58
|
||||||
|
|a+0#00e0003&|u|t|o| +0#0000000&@70
|
||||||
|
|b+0#00e0003&|o@1|l| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@61
|
||||||
|
|b+0#af5f00255&|r|e|a|k| +0#0000000&@69
|
||||||
|
|c+0#af5f00255&|a|s|e| +0#0000000&@70
|
||||||
|
|c+0#00e0003&|h|a|r| +0#0000000&@70
|
||||||
|
|c+0#00e0003&|o|n|s|t| +0#0000000&@69
|
||||||
|
|c+0#00e0003&|o|n|s|t|e|x|p|r| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@56
|
||||||
|
|c+0#af5f00255&|o|n|t|i|n|u|e| +0#0000000&@66
|
||||||
|
|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@67
|
||||||
|
|d+0#af5f00255&|o| +0#0000000&@72
|
||||||
|
|d+0#00e0003&|o|u|b|l|e| +0#0000000&@68
|
||||||
|
|e+0#af5f00255&|l|s|e| +0#0000000&@70
|
||||||
|
|e+0#00e0003&|n|u|m| +0#0000000&@70
|
||||||
|
@57|1|,|1| @10|T|o|p|
|
20
runtime/syntax/testdir/dumps/c_keywords_01.dump
Normal file
20
runtime/syntax/testdir/dumps/c_keywords_01.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|c+0#af5f00255#ffffff0|o|n|t|i|n|u|e| +0#0000000&@66
|
||||||
|
|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@67
|
||||||
|
|d+0#af5f00255&|o| +0#0000000&@72
|
||||||
|
|d+0#00e0003&|o|u|b|l|e| +0#0000000&@68
|
||||||
|
|e+0#af5f00255&|l|s|e| +0#0000000&@70
|
||||||
|
>e+0#00e0003&|n|u|m| +0#0000000&@70
|
||||||
|
|e+0#00e0003&|x|t|e|r|n| +0#0000000&@68
|
||||||
|
|f+0#e000002&|a|l|s|e| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@60
|
||||||
|
|f+0#00e0003&|l|o|a|t| +0#0000000&@69
|
||||||
|
|f+0#af5f00255&|o|r| +0#0000000&@71
|
||||||
|
|g+0#af5f00255&|o|t|o| +0#0000000&@70
|
||||||
|
|i+0#af5f00255&|f| +0#0000000&@72
|
||||||
|
|i+0#00e0003&|n|l|i|n|e| +0#0000000&|/+0#0000e05&@1| |(|C|9@1|)| +0#0000000&@59
|
||||||
|
|i+0#00e0003&|n|t| +0#0000000&@71
|
||||||
|
|l+0#00e0003&|o|n|g| +0#0000000&@70
|
||||||
|
|n+0#e000002&|u|l@1|p|t|r| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@58
|
||||||
|
|r+0#00e0003&|e|g|i|s|t|e|r| +0#0000000&@66
|
||||||
|
|r+0#00e0003&|e|s|t|r|i|c|t| +0#0000000&|/+0#0000e05&@1| |(|C|9@1|)| +0#0000000&@57
|
||||||
|
|r+0#af5f00255&|e|t|u|r|n| +0#0000000&@68
|
||||||
|
@57|1|9|,|1| @9|2|8|%|
|
20
runtime/syntax/testdir/dumps/c_keywords_02.dump
Normal file
20
runtime/syntax/testdir/dumps/c_keywords_02.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|r+0#af5f00255#ffffff0|e|t|u|r|n| +0#0000000&@68
|
||||||
|
|s+0#00e0003&|h|o|r|t| +0#0000000&@69
|
||||||
|
|s+0#00e0003&|i|g|n|e|d| +0#0000000&@68
|
||||||
|
|s+0#af5f00255&|i|z|e|o|f| +0#0000000&@68
|
||||||
|
|s+0#00e0003&|t|a|t|i|c| +0#0000000&@68
|
||||||
|
>s+0#af5f00255&|t|a|t|i|c|_|a|s@1|e|r|t| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@52
|
||||||
|
|s+0#00e0003&|t|r|u|c|t| +0#0000000&@68
|
||||||
|
|s+0#af5f00255&|w|i|t|c|h| +0#0000000&@68
|
||||||
|
|t+0#00e0003&|h|r|e|a|d|_|l|o|c|a|l| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@53
|
||||||
|
|t+0#e000002&|r|u|e| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@61
|
||||||
|
|t+0#00e0003&|y|p|e|d|e|f| +0#0000000&@67
|
||||||
|
|t+0#af5f00255&|y|p|e|o|f| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@59
|
||||||
|
|t+0#af5f00255&|y|p|e|o|f|_|u|n|q|u|a|l| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@52
|
||||||
|
|u+0#00e0003&|n|i|o|n| +0#0000000&@69
|
||||||
|
|u+0#00e0003&|n|s|i|g|n|e|d| +0#0000000&@66
|
||||||
|
|v+0#00e0003&|o|i|d| +0#0000000&@70
|
||||||
|
|v+0#00e0003&|o|l|a|t|i|l|e| +0#0000000&@66
|
||||||
|
|w+0#af5f00255&|h|i|l|e| +0#0000000&@69
|
||||||
|
@75
|
||||||
|
@57|3|7|,|1| @9|6|8|%|
|
20
runtime/syntax/testdir/dumps/c_keywords_03.dump
Normal file
20
runtime/syntax/testdir/dumps/c_keywords_03.dump
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
| +0&#ffffff0@74
|
||||||
|
|_+0#00e0003&|A|l|i|g|n|a|s| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@38
|
||||||
|
|_+0#af5f00255&|A|l|i|g|n|o|f| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@38
|
||||||
|
|_+0#00e0003&|A|t|o|m|i|c| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)| +0#0000000&@58
|
||||||
|
|_+0#00e0003&|B|i|t|I|n|t| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@58
|
||||||
|
>_+0#00e0003&|B|o@1|l| +0#0000000&|/+0#0000e05&@1| |(|C|9@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@41
|
||||||
|
|_+0#00e0003&|C|o|m|p|l|e|x| +0#0000000&|/+0#0000e05&@1| |(|C|9@1|)| +0#0000000&@57
|
||||||
|
|_+0#00e0003&|D|e|c|i|m|a|l|1|2|8| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@54
|
||||||
|
|_+0#00e0003&|D|e|c|i|m|a|l|3|2| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@55
|
||||||
|
|_+0#00e0003&|D|e|c|i|m|a|l|6|4| +0#0000000&|/+0#0000e05&@1| |(|C|2|3|)| +0#0000000&@55
|
||||||
|
|_+0#af5f00255&|G|e|n|e|r|i|c| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)| +0#0000000&@57
|
||||||
|
|_+0#00e0003&|I|m|a|g|i|n|a|r|y| +0#0000000&|/+0#0000e05&@1| |(|C|9@1|)| +0#0000000&@55
|
||||||
|
|_+0#00e0003&|N|o|r|e|t|u|r|n| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@37
|
||||||
|
|_+0#af5f00255&|S|t|a|t|i|c|_|a|s@1|e|r|t| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@32
|
||||||
|
|_+0#00e0003&|T|h|r|e|a|d|_|l|o|c|a|l| +0#0000000&|/+0#0000e05&@1| |(|C|1@1|)|(|d|e|p|r|e|c|a|t|e|d| |i|n| |C|2|3|)| +0#0000000&@33
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|5@1|,|1| @9|B|o|t|
|
64
runtime/syntax/testdir/input/c_keywords.c
Normal file
64
runtime/syntax/testdir/input/c_keywords.c
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// C keywords
|
||||||
|
|
||||||
|
// Source: https://en.cppreference.com/w/c/keyword
|
||||||
|
|
||||||
|
alignas // (C23)
|
||||||
|
alignof // (C23)
|
||||||
|
auto
|
||||||
|
bool // (C23)
|
||||||
|
break
|
||||||
|
case
|
||||||
|
char
|
||||||
|
const
|
||||||
|
constexpr // (C23)
|
||||||
|
continue
|
||||||
|
default
|
||||||
|
do
|
||||||
|
double
|
||||||
|
else
|
||||||
|
enum
|
||||||
|
extern
|
||||||
|
false // (C23)
|
||||||
|
float
|
||||||
|
for
|
||||||
|
goto
|
||||||
|
if
|
||||||
|
inline // (C99)
|
||||||
|
int
|
||||||
|
long
|
||||||
|
nullptr // (C23)
|
||||||
|
register
|
||||||
|
restrict // (C99)
|
||||||
|
return
|
||||||
|
short
|
||||||
|
signed
|
||||||
|
sizeof
|
||||||
|
static
|
||||||
|
static_assert // (C23)
|
||||||
|
struct
|
||||||
|
switch
|
||||||
|
thread_local // (C23)
|
||||||
|
true // (C23)
|
||||||
|
typedef
|
||||||
|
typeof // (C23)
|
||||||
|
typeof_unqual // (C23)
|
||||||
|
union
|
||||||
|
unsigned
|
||||||
|
void
|
||||||
|
volatile
|
||||||
|
while
|
||||||
|
|
||||||
|
_Alignas // (C11)(deprecated in C23)
|
||||||
|
_Alignof // (C11)(deprecated in C23)
|
||||||
|
_Atomic // (C11)
|
||||||
|
_BitInt // (C23)
|
||||||
|
_Bool // (C99)(deprecated in C23)
|
||||||
|
_Complex // (C99)
|
||||||
|
_Decimal128 // (C23)
|
||||||
|
_Decimal32 // (C23)
|
||||||
|
_Decimal64 // (C23)
|
||||||
|
_Generic // (C11)
|
||||||
|
_Imaginary // (C99)
|
||||||
|
_Noreturn // (C11)(deprecated in C23)
|
||||||
|
_Static_assert // (C11)(deprecated in C23)
|
||||||
|
_Thread_local // (C11)(deprecated in C23)
|
Loading…
x
Reference in New Issue
Block a user