ox

The Ox programming language, compiler and tools (WIP)
Log | Files | Refs | README | LICENSE

commit 71cf2b78a40a84a503f4fcffe8be3e630abc685d
parent c45658a06f32412c860b27a90a922ab99aa4064b
Author: citbl <citbl@citbl.org>
Date:   Wed,  3 Dec 2025 20:40:57 +1000

add vim syntax

Diffstat:
Aox-syntax/vim/ftdetect/ox.vim | 5+++++
Aox-syntax/vim/syntax/ox.vim | 40++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/ox-syntax/vim/ftdetect/ox.vim b/ox-syntax/vim/ftdetect/ox.vim @@ -0,0 +1,5 @@ +" Use filetype 'ox' for *.ox files +augroup filetypedetect + au! + au BufNewFile,BufRead *.ox setfiletype ox +augroup END diff --git a/ox-syntax/vim/syntax/ox.vim b/ox-syntax/vim/syntax/ox.vim @@ -0,0 +1,40 @@ +" Clear any existing syntax for this buffer +if exists("b:current_syntax") + finish +endif + +" Keywords +syntax keyword oxKeywords if else while fn fx for continue break struct typedef 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 + +" Constants +syntax keyword oxConstant true false null + +" Comments: from # to end of line +syntax match oxComment "//.*$" + +" Strings: "...." +syntax region oxString start=/"/ end=/"/ skip=/\"/ + +" Numbers +syntax match oxNumber "\v(\d+(\.\d+)?)" + +" Operators +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 + +let b:current_syntax = "ox"