11hook global BufCreate .*[.]c3[it]? %{
2- set-option buffer filetype c3
2+ set-option buffer filetype c3
33}
44
55hook -group c3-highlight global WinSetOption filetype =c3 %{
6- require-module c3
7- set-option window static_words %opt{c3_static_words}
6+ require-module c3
7+ set-option window static_words %opt{c3_static_words}
88
9- add-highlighter window /c3 ref c3
10- hook -once -always window WinSetOption filetype =.* %{ remove-highlighter window /c3 }
9+ add-highlighter window /c3 ref c3
10+ hook -once -always window WinSetOption filetype =.* %{ remove-highlighter window /c3 }
1111}
1212
1313
@@ -26,7 +26,7 @@ addhl shared/c3/code/shebang regex '\A#! ?/.*?\n' 0:comment
2626
2727addhl shared/c3/code/asterisk regex ' (?:\[<?)\s*(\*)\s*(?:>?\])' 1 :value
2828
29- addhl shared/c3/code/module-decl regex ' (module|import)\s*[a-z0-9_]+(?:::[a-z0-9_]+)*(?:(?:,\s*[a-z0-9_]+(?:::[a-z0-9_]+)*)+|\s*(\{(?:\s*_*[A-Z][A-z0-9_]*,?\s*)+\}))?(?=;) ' 0 :module 1 :Default 2 :Default
29+ addhl shared/c3/code/module-decl regex ' ^\s* (module|import)\b\ s*[a-z0-9_]+(?:::[a-z0-9_]+)*(?:(?:,\s*[a-z0-9_]+(?:::[a-z0-9_]+)*)+)? ' 0 :module 1 :Default 2 :Default
3030addhl shared/c3/code/num regex ' \b[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?\b' 0 :value
3131addhl shared/c3/code/const regex ' \$?\b_*[A-Z][A-Z_0-9]*\b' 0 :value
3232addhl shared/c3/code/type regex ' \$?\b_*[A-Z][A-Z_0-9]*[a-z][A-Z_0-9a-z]*\b' 0 :value
@@ -36,24 +36,23 @@ addhl shared/c3/code/module regex '([a-z0-9_]+)(?=::)' 1:module
3636addhl shared/c3/code/namespace regex ' ::' 0 :Default
3737
3838evaluate-commands %sh{
39- keywords=' alias assert asm attrdef bitstruct break case catch const continue default defer do else enum extern false faultdef for foreach foreach_r fn tlocal if inline import lengthof macro module nextcase null interface return static struct switch true try typedef union var while'
40- attributes=' align allow_deprecated benchmark bigendian builtin callconv compact const deprecated dynamic export extern finalizer format if inline init jump link littleendian local maydiscard naked noalias nodiscard noinit noinline nopadding norecurse noreturn nosanitize nostrip obfuscate operator operator_r operator_s optional overlap packed private public pure reflect safeinfer safemacro section structlike tag test unused used wasm weak winmain'
41- builtins='abs add any_make atomic_fetch_add atomic_fetch_and atomic_fetch_dec_wrap atomic_fetch_exchange atomic_fetch_inc_wrap atomic_fetch_max atomic_fetch_min atomic_fetch_nand atomic_fetch_or atomic_fetch_sub atomic_fetch_xor atomic_load atomic_store bitreverse breakpoint bswap ceil clz compare_exchange copysign cos ctz div exp exp2 expect expect_with_probability fence floor fma fmuladd frameaddress fshl fshr gather get_rounding_mode log log10 log2 masked_load masked_store matrix_mul matrix_transpose max memcpy memcpy_inline memmove memset memset_inline min mod mul nearbyint neg overflow_add overflow_mul overflow_sub popcount pow pow_int prefetch reduce_add reduce_and reduce_fadd reduce_fmul reduce_max reduce_min reduce_mul reduce_or reduce_xor returnaddress reverse rint rnd round roundeven sat_add sat_mul sat_shl sat_sub scatter select set_rounding_mode sin sprintf sqrt str_find str_hash str_lower str_pascalcase str_replace str_snakecase str_upper sub swizzle swizzle2 syscall sysclock trap trunc unaligned_load unaligned_store unreachable veccompeq veccompge veccompgt veccomple veccomplt veccompne volatile_load volatile_store wasm_memory_grow wasm_memory_size wstr16 wstr32 BENCHMARK_FNS BENCHMARK_NAMES DATE FILE FILEPATH FUNC FUNCTION LINE LINE_RAW MODULE TEST_FNS TEST_NAMES TIME ADDRESS_SANITIZER ARCH_TYPE AUTHOR_EMAILS AUTHORS BACKTRACE BENCHMARKING BUILD_DATE BUILD_HASH COMPILER_LIBC_AVAILABLE COMPILER_OPT_LEVEL COMPILER_SAFE_MODE DEBUG_SYMBOLS LANGUAGE_DEV_VERSION LLVM_VERSION MAX_VECTOR_SIZE MEMORY_ENVIRONMENT MEMORY_SANITIZER OS_TYPE PANIC_MSG PLATFORM_BIG_ENDIAN PLATFORM_F128_SUPPORTED PLATFORM_F16_SUPPORTED PLATFORM_I128_SUPPORTED PROJECT_VERSION REGISTER_SIZE TESTING THREAD_SANITIZER'
42- types=' void bool char double float float16 bfloat int128 ichar int iptr isz long short uint128 uint ulong uptr ushort usz float128 any fault typeid'
43- comptime_keywords=' alignof assert assignable case default defined echo else embed endfor endforeach endif endswitch eval evaltype error exec extnameof feature for foreach if include is_const kindof nameof offsetof qnameof sizeof stringify switch typefrom typeof vacount vatype vaconst vaarg vaexpr vasplat'
44-
45- # Both joins with a separator and escapes '$' characters
46- join () { sep=$2 ; eval set -- $1 ; IFS=" $sep " ; echo " $* " | sed -e ' s/\$/\\\$/g' ; }
47-
48- printf %s\\ n " declare-option str-list c3_static_words $( echo ${keywords} ${attributes} ${types} ${builtins} ${comptime_keywords} ) '"
49-
50- printf %s "
51- addhl shared/c3/code/keywords regex '(?<![@#$])\b(?:$( join ' ${keywords}' ' |' ) )\\ b' 0:keyword
52- addhl shared/c3/code/comptime-keywords regex '[$](?:$( join ' ${comptime_keywords}' ' |' ) )\\ b' 0:keyword
53- addhl shared/c3/code/builtins regex '[$]{2}(?:$( join ' ${builtins}' ' |' ) )\\ b' 0:keyword
54- addhl shared/c3/code/attributes regex '[@]\b(?:$( join ' ${attributes}' ' |' ) )\\ b' 0:attribute
55- addhl shared/c3/code/types regex '(?<![@#$])\\ b(?:$( join ' ${types}' ' |' ) )\\ b' 0:type
56- "
39+ keywords=' alias assert asm attrdef bitstruct break case catch cenum const continue default defer do else enum extern false faultdef for foreach foreach_r fn tlocal if inline import lengthof macro module nextcase null interface return static struct switch true try typedef union var while'
40+ attributes=' align allow_deprecated benchmark bigendian builtin callconv cname compact const constinit deprecated dynamic export extern finalizer format if inline init jump link littleendian local maydiscard naked noalias nodiscard noinit noinline nopadding norecurse noreturn nosanitize nostrip obfuscate operator operator_r operator_s optional overlap packed private public pure reflect safeinfer safemacro simd section structlike tag test unused used wasm weak winmain'
41+ builtins='abs any_make atomic_load atomic_store atomic_fetch_exchange atomic_fetch_add atomic_fetch_sub atomic_fetch_and atomic_fetch_nand atomic_fetch_or atomic_fetch_xor atomic_fetch_max atomic_fetch_min atomic_fetch_inc_wrap atomic_fetch_dec_wrap bitreverse breakpoint bswap ceil compare_exchange copysign cos clz ctz add div mod mul neg sub exp exp2 expect expect_with_probability fence floor fma fmuladd frameaddress fshl fshr gather get_rounding_mode int_to_mask log log10 log2 matrix_mul matrix_transpose mask_to_int masked_load masked_store max memcpy memcpy_inline memmove memset memset_inline min nearbyint overflow_add overflow_mul overflow_sub popcount pow pow_int prefetch reduce_add reduce_and reduce_fadd reduce_fmul reduce_max reduce_min reduce_mul reduce_or reduce_xor reverse returnaddress rint rnd round roundeven sat_add sat_shl sat_sub sat_mul scatter select set_rounding_mode sprintf str_find str_hash str_lower str_pascalcase str_replace str_upper str_snakecase swizzle swizzle2 sin sqrt syscall sysclock trap trunc unaligned_load unaligned_store unreachable veccomplt veccomple veccompgt veccompge veccompeq veccompne volatile_load volatile_store wasm_memory_size wasm_memory_grow wstr16 wstr32 DATE FILE FILEPATH FUNC FUNCTION LINE LINE_RAW MODULE BENCHMARK_NAMES BENCHMARK_FNS TEST_NAMES TEST_FNS TIME BUILD_HASH BUILD_DATE OS_TYPE ARCH_TYPE MAX_VECTOR_SIZE REGISTER_SIZE COMPILER_LIBC_AVAILABLE CUSTOM_LIBC COMPILER_OPT_LEVEL PLATFORM_BIG_ENDIAN PLATFORM_I128_SUPPORTED PLATFORM_F16_SUPPORTED PLATFORM_F128_SUPPORTED REGISTER_SIZE COMPILER_SAFE_MODE DEBUG_SYMBOLS BACKTRACE LLVM_VERSION BENCHMARKING TESTING PANIC_MSG MEMORY_ENVIRONMENT ADDRESS_SANITIZER MEMORY_SANITIZER THREAD_SANITIZER LANGUAGE_DEV_VERSION AUTHORS AUTHOR_EMAILS PROJECT_VERSION'
42+ types=' void bool char double float float16 bfloat int128 ichar int iptr isz long short uint128 uint ulong uptr ushort usz float128 any fault typeid'
43+ comptime_keywords=' alignof assert assignable case default defined echo else embed endfor endforeach endif endswitch eval evaltype error exec extnameof feature for foreach if include is_const kindof nameof offsetof qnameof sizeof stringify switch typefrom typeof vacount vatype vaconst vaarg vaexpr vasplat'
44+
45+ join () { sep=$2 ; eval set -- $1 ; IFS=" $sep " ; echo " $* " ; }
46+
47+ printf %s\\ n " declare-option str-list c3_static_words $( echo ${keywords} ${attributes} ${types} ${builtins} ${comptime_keywords} ) '"
48+
49+ printf %s "
50+ addhl shared/c3/code/keywords regex '(?<![@#$])\b(?:$( join ' ${keywords}' ' |' ) )\\ b' 0:keyword
51+ addhl shared/c3/code/comptime-keywords regex '[$](?:$( join ' ${comptime_keywords}' ' |' ) )\\ b' 0:keyword
52+ addhl shared/c3/code/builtins regex '[$]{2}(?:$( join ' ${builtins}' ' |' ) )\\ b' 0:keyword
53+ addhl shared/c3/code/attributes regex '[@]\b(?:$( join ' ${attributes}' ' |' ) )\\ b' 0:attribute
54+ addhl shared/c3/code/types regex '(?<![@#$])\\ b(?:$( join ' ${types}' ' |' ) )\\ b' 0:type
55+ "
5756}
5857
5958}
0 commit comments