From 825b6665746bbad93cd460ba7e0960b9bbae9e6b Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Fri, 10 Jul 2026 13:26:27 +0200 Subject: [PATCH] C2 mode: add `countof` keyword and improve declaration detection --- lang/clang.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lang/clang.c b/lang/clang.c index e647383..f718040 100644 --- a/lang/clang.c +++ b/lang/clang.c @@ -1546,7 +1546,7 @@ static const char c2_keywords[] = { "module|import|as|public|" // Types -> c2_types // Type related - "asm|cast|const|elemsof|enum|extern|" + "asm|cast|const|countof|elemsof|enum|extern|" "false|fn|local|nil|offsetof|to_container|public|" "sizeof|static|struct|template|tlocal|true|type|union|volatile|" // Control flow related @@ -1564,6 +1564,7 @@ static const char c2_keywords[] = { static const char c2_types[] = { "void|bool|char|i8|i16|i32|i64|u8|u16|u32|u64|isize|usize|f32|f64|" "reg8|reg16|reg32|reg64|va_list|" + // C keywords (accepted in extern "C" blocks) "int|short|long|float|double|signed|unsigned|size_t|ssize_t" }; @@ -1571,7 +1572,7 @@ static ModeDef c2_mode = { .name = "C2", .extensions = "c2|c2h|c2i|c2t", .colorize_func = c_colorize_line, - .colorize_flags = CLANG_C2 | CLANG_PREPROC | CLANG_CAP_TYPE, + .colorize_flags = CLANG_C2 | CLANG_PREPROC | CLANG_CAP_TYPE | CLANG_C_DEFS, .keywords = c2_keywords, .types = c2_types, .indent_func = c_indent_line,