dot_files/.config/nvim/syntax/mclang.vim
2024-05-18 23:46:28 +03:00

39 lines
1.5 KiB
VimL

" Vim syntax file
" Language: MClang
" Maintainer: MCorange
" Maintainer: xomf
if exists("b:current_syntax")
finish
endif
syn keyword MCLangKeywords contained memory fn const in inline include assert with returns typedef structdef if else elif end done then while do
syn keyword MCLangInstructions contained divmod div mod _dbg_print eq lt gt le ge ne shr shl bor band not dup swap drop over rot syscall0 syscall1 syscall2 syscall3 syscall4 syscall5 syscall6
syn keyword MCLangTypes contained void u8 u16 u32 u64 ptr char
syn keyword MCLangBool contained true false
syn keyword MCLangConst contained NULL
" i8 i16 i32 i64 f32 f64
syn match MCLangComment '//.*'
syn match MCLangIdentifier '(?<=^|\\s)([a-z|A-Z|_|\\-][0-9|a-z|A-Z|_|\\-]+\\([a-z|A-Z|_|\\-][0-9|a-z|A-Z|_|\\-]+\\)|[a-z|A-Z|_|\\-][0-9|a-z|A-Z|_|\\-]+)(?:\\s|$)'
syn match MCLangNumber '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b(?!\\$)'
syn region MCLangString start='"' end='"' contained
syn region MCLangChar start='\'' end='\'' contained
let b:current_syntax = "MCLang"
hi def link MCLangComment Comment
hi def link MCLangTypes Type
hi def link MCLangString Constant
hi def link MCLangChar Character
hi def link MCLangNumber Constant
hi def link MCLangConst Constant
hi def link MCLangBool Boolean
hi def link MCLangInstructions Operator
hi def link MCLangKeywords Keyword
hi def link MCLangIdentifier Identifier