still need to fix literal arrays, it has the same problem as struct literals had with moving the literal into memory and modifying the memory with variables
56 lines
2.2 KiB
VimL
56 lines
2.2 KiB
VimL
" Vim syntax file
|
|
" Language: MClang4
|
|
" Maintainer: MCorange
|
|
" Maintainer: xomf
|
|
|
|
if exists("b:current_syntax")
|
|
finish
|
|
endif
|
|
syn match MCLangSlash '/' containedin=ALLBUT,MCLangComment
|
|
syn match MCLangComment '//.*'
|
|
|
|
syn region MCLangComment start='/\*' end='\*/' contains=@Spell
|
|
|
|
syn keyword MCLangKeywords fn if else struct enum type while for break continue let const mut static include extern return loop as
|
|
" syn keyword MCLangOp + -
|
|
syn keyword MCLangTypes void u8 u16 u32 u64 i8 i16 i32 i64 usize isize str
|
|
syn keyword MCLangBool true false
|
|
syn keyword MCLangConst NULL
|
|
" i8 i16 i32 i64 f32 f64
|
|
syn region MCLangString start=+"+ skip=+\\.+ end=+"+ contains=@Spell
|
|
syn region MCLangChar start=+'+ skip=+\\.+ end=+'+
|
|
|
|
syn match MCLangFuncCall '\<[A-Za-z_][A-Za-z0-9_]*\>\ze\s*(' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
syn match MCLangFuncCall '\<[A-Za-z_][A-Za-z0-9_]*::[A-Za-z_][A-Za-z0-9_]*\>\ze\s*(' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
"syn match MCLangFuncDef '\<fn\s\+\zs[A-Za-z_][A-Za-z0-9_]*\.\?\>' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
"syn match MCLangConstName '\<const\s\+\zs[A-Za-z_][A-Za-z0-9_]*\>' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
syn match MCLangIdentifier '\<[A-Za-z_][A-Za-z0-9_]*\>'
|
|
syn match MCLangOp '[+\-*%&|^!~<>]=\?\|==\|!=\|<=\|>=\|&&\|\\|\|::\|:\|[;,\.]' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
syn match MCLangNumber '\<\(0b[01]\+\|0x[0-9A-Fa-f]\+\|\d\+\.\d*\|\.\d\+\|\d\+\)\>' containedin=ALLBUT,MCLangString,MCLangChar,MCLangComment
|
|
|
|
|
|
|
|
syn match MCLangDelim /[()]/
|
|
syn match MCLangDelim /[{}]/
|
|
syn match MCLangDelim /[\[\]]/
|
|
|
|
let b:current_syntax = "MCLang4"
|
|
|
|
hi def link MCLangComment Comment
|
|
hi def link MCLangTypes Type
|
|
hi def link MCLangString String
|
|
hi def link MCLangChar Character
|
|
hi def link MCLangNumber Constant
|
|
hi def link MCLangConst Constant
|
|
"hi def link MCLangConstName Constant
|
|
hi def link MCLangBool Boolean
|
|
hi def link MCLangDelim Delimiter
|
|
hi def link MCLangOp Operator
|
|
hi def link MCLangKeywords Keyword
|
|
"hi def link MCLangIdentifier Identifier
|
|
hi def link MCLangFuncCall Function
|
|
"hi def link MCLangFuncDef Function
|
|
|
|
|
|
|