Files
Gareth Lloyd 77099ed6b3 runtime(cpp): add C++26 lexical constructs to syntax highlighting
Add a guarded "C++ 26 extensions" block (cpp_no_cpp26) covering new
lexical surface introduced since C++23:

- [[ ... ]] attributes as a region, so P3394 annotations carrying a
  value expression (eg [[=foo{1}]]) no longer trip cErrInBracket on
  their braces/parens. A \w\@1<! look-behind keeps it from matching a
  subscripted immediately-invoked lambda (arr[[]{...}()]).
- ^^ reflection operator (P2996).
- [: :] splice brackets (P2996).
- contract_assert keyword (P2900).

Add input/cpp_cpp26.cpp exercising these constructs with screendumps,
and update dumps/cpp_noreturn_00.dump for the new [[ ]] attribute
delimiter highlighting.

closes: #20577

Signed-off-by: Gareth Lloyd <gareth@ignition-web.co.uk>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-06-21 14:45:14 +00:00

14 lines
399 B
C++

// C++26 lexical constructs
// P3394 annotations: [[ ... ]] may carry a value expression.
[[=rename{"full_name"}]] int braced;
[[=key(8)]] int parened;
[[nodiscard]] int plain();
// P2900 contracts: contract_assert is a keyword.
void check(int x) { contract_assert(x != 0); }
// P2996 reflection (^^) and splicing ([: :]).
constexpr auto refl = ^^int;
[:refl:] spliced{};