commit a2993a2ed9b6a25a23c013d55a28bf237375de14 parent 71cf2b78a40a84a503f4fcffe8be3e630abc685d Author: citbl <citbl@citbl.org> Date: Wed, 3 Dec 2025 21:05:46 +1000 vim syntax fixes and improvements Diffstat:
| M | ox-syntax/vim/syntax/ox.vim | | | 44 | +++++++++++++++++++++++++------------------- |
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/ox-syntax/vim/syntax/ox.vim b/ox-syntax/vim/syntax/ox.vim @@ -1,10 +1,10 @@ -" Clear any existing syntax for this buffer +" Clear any existing syntax if exists("b:current_syntax") finish endif " Keywords -syntax keyword oxKeywords if else while fn fx for continue break struct typedef return +syntax keyword oxKeyword if else while fn fx for continue break struct typedef print print_ return " Types syntax keyword oxType int float str bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 f128 uint char chr void cstr voidp @@ -12,29 +12,35 @@ syntax keyword oxType int float str bool i8 i16 i32 i64 i128 u8 u16 u32 u6 " Constants syntax keyword oxConstant true false null -" Comments: from # to end of line -syntax match oxComment "//.*$" +" Comments: // EOL +syntax match oxComment "//.*$" -" Strings: "...." -syntax region oxString start=/"/ end=/"/ skip=/\"/ +" Strings: "..." +syntax region oxString start=/"/ end=/"/ skip=/\\"/ + +" Char def +syntax match oxChar /'[^\']'/ +syntax match oxCharError /'[^\']\{2,}'/ " Numbers -syntax match oxNumber "\v(\d+(\.\d+)?)" +syntax match oxNumber "\v(\d+(\.\d+)?)" " Operators -syntax match oxOperator /[?;!~#*\/+\-:=<>]/ containedin=ALL +syntax match oxOperator /[?;!~#*\/+\-:=<>]/ containedin=ALL " Types override -syntax match oxType2 /\<i\(8\|16\|32\|64\)\>/ - -" Highlight groups (link to standard ones) -hi def link oxOperator Operator -hi def link oxKeyword Keyword -hi def link oxType Type -hi def link oxType2 Type -hi def link oxConstant Constant -hi def link oxComment Comment -hi def link oxString String -hi def link oxNumber Number +syntax match oxType2 /\<[i|u|f]\(8\|16\|32\|64\)\>/ + +" Highlight groups +hi def link oxOperator Operator +hi def link oxKeyword Keyword +hi def link oxType Type +hi def link oxType2 Type +hi def link oxConstant Constant +hi def link oxComment Comment +hi def link oxString String +hi def link oxChar Character +hi def link oxCharError Error +hi def link oxNumber Number let b:current_syntax = "ox"