commit 14d8800cc15fca7aa9819fb1d72b65b3b37c6808
parent 26fab2ca4b33915e864efadd45899fdd31b3ab48
Author: Sebastian <sebastian@sebsite.pw>
Date: Fri, 11 Mar 2022 18:46:36 -0500
Highlight size correctly as both keyword and type
All edge cases are handled (AFAIK):
size; // type
size(); // keyword
size
(); // keyword
size // blablabla
(); // keyword
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/syntax/hare.vim b/syntax/hare.vim
@@ -12,7 +12,8 @@ syn keyword hareConditional if else match switch
syn keyword hareLabel case
syn keyword hareBuiltin len offset free alloc assert append abort delete insert
syn keyword hareOperator is as
-" TODO: highlight size correctly both as keyword and type
+syn match hareType "\vsize((\_\s|//.*)*\()@!"
+syn match hareBuiltin "\vsize((\_\s|//.*)*\()@="
syn match harePreProc "^use .*;"
syn match harePreProc "@[a-z]*"
syn match hareOperator "\.\.\." "\.\."
@@ -43,7 +44,6 @@ syn region hareComment start="//" end="$" contains=hareTodo,@Spell
syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
syn keyword hareType uint int
syn keyword hareType uintptr
-syn keyword hareType size
syn keyword hareType f32 f64
syn keyword hareType bool
syn keyword hareType char str