highlightjs / highlightjs/highlight.js
(C, C++) Implement C2y and C++26 changes
- Dominant language
- JavaScript
- Stars
- 25k
- Forks
- 3.8k
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 3
Description
**Describe the issue**
The grammars for C and C++ do not yet include the latest C2y and C++26 features.
**Additional context**
This list is quite likely incomplete, but here are some of the changes:
- C++26 contracts (P2900) have been accepted (contextual keywords `pre`, `post`, and true keyword `contract_assert`)
- `#embed` is in C++, and on track to be added to C2y (add keyword in preprocessor mode)
- C++26 `delete("reason")` is possible, but `delete` is currently highlighted as a function name instead of a keyword in that situation
- C2y is on track to add `defer` as a feature (add keyword)
- C2y already supports `break label` and there are ongoing efforts to add this to C++; do we need dedicated label highlighting?
Additionally, the C23 type`_BitInt` is also provided as a C++ compiler extension by clang, and it might even become a proper keyword in C++ (though that remains to be seen). Anyhow, it should be a keyword even if it's non-standard.
See also https://en.cppreference.com/w/cpp/26
Contributor guide
Assessment
This issue has not been assessed yet.