commit 1f2f877f46df3a286d69d5d0432e575032945e94 parent 6a8bfd1a72a665b1032d14999469b217dded3078 Author: citbl <citbl@citbl.org> Date: Wed, 13 May 2026 23:32:03 +1000 add tools/vim syntax and setup Diffstat:
| A | tools/vim/ftdetect/sic.vim | | | 2 | ++ |
| A | tools/vim/syntax/sic.vim | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/tools/vim/ftdetect/sic.vim b/tools/vim/ftdetect/sic.vim @@ -0,0 +1,2 @@ +" Use filetype 'sic' for *.sic files +autocmd BufNewFile,BufRead *.sic setfiletype sic diff --git a/tools/vim/syntax/sic.vim b/tools/vim/syntax/sic.vim @@ -0,0 +1,52 @@ +" Clear any existing syntax +if exists("b:current_syntax") + finish +endif + +" Keywords +syntax keyword sicKeyword if else while opt lazy match def for each some none ok err in is cast + +" Types +syntax keyword sicType int dec str bool void + +syntax match sicUserType /\<[A-Z][A-Za-z0-9_]*\>/ + +" Constants +syntax keyword sicConstant true false + +" Strings: "..." +syntax region sicString start=/"/ end=/"/ skip=/\\"/ + +" Char def +syntax match sicChar /'[^\']'/ +syntax match sicCharError /'[^\']\{2,}'/ + +" Numbers +syntax match sicNumber "\v(\d+(\.\d+)?)" + +" Operators +syntax match sicOperator /[?;!~#*+\-:=<>]/ +syntax match sicOperator /\/\%(\/\)\@!/ "special rules for / to have another / after it +" Types override +" syntax match sicType2 /\<[i|u|f]\(8\|16\|32\|64\)\>/ + +" Functions +syntax match sicUserFunc /\<[A-Za-z_][A-Za-z0-9_]*\ze(/ + +" Comments: // EOL +syntax match sicComment "//.*$" contains=NONE + +" Highlight groups +hi def link sicComment Comment +hi def link sicOperator Operator +hi def link sicKeyword Keyword +hi def link sicType Type +hi def link sicUserType Tag +hi def link sicUserFunc Function +hi def link sicConstant Constant +hi def link sicString String +hi def link sicChar Character +hi def link sicCharError Error +hi def link sicNumber Number + +let b:current_syntax = "sic"