aboutsummaryrefslogtreecommitdiff
path: root/misc/cff.vim
blob: 1c6ca505000a3f0ba7954b12ab8954fa25ffadcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
" Vim syntax file
" Language: cff

if exists("b:current_syntax")
   finish
endif


syn keyword Statement return break continue case
syn keyword Repeat for while do if else switch
syn keyword StorageClass typedef fn static def let extern const
syn keyword Include import
syn keyword Macro defmacro
syn keyword Type i8 u8 i16 u16 i32 u32 i64 u64
syn keyword Type int uint isize usize iptrint uptrint
syn keyword Type c_char c_long c_ulong c_llong c_ullong
syn keyword Type bool intbool void f32 f64 typeof
syn keyword Structure struct enum union
syn keyword Operator alignof sizeof as and or offsetof 

syn match   PreProc "#\i*\>"
syn match   PreProc "#?\>"
syn match   PreProc "#'\k\+\>"
syn region PreProc start="#\[" end="\]" extend

syn case ignore
syn match	Number	display transparent "\<\d\|\.\d" contains=cNumber,cFloat
syn match	cNumber		display contained "\d\+\%(\vu|u8|i8|u16|i32|u32|i64|u64|z|zs|p|ps\V\)\?\>"
syn match	cNumber		display contained "0x\x\+\%(\vu|u8|i8|u16|i32|u32|i64|u64|z|zs|p|ps\V\)\?\>"
syn match	cFloat		display contained "\d\+\.\d*\%(f\|f32\|f64\)\?\>"

syn region	String		start=+"+ skip=+\\\\\|\\"+ end=+"+  extend
syn match   mCommentLabel contained "#'\k\+\>"
syn region	Character	start=+'+ skip=+\\\\\|\\'+ end=+'+  
syn region  Comment start="//" end="$"
syn region  mComment start="#{" end="}" contains=mComment,mCommentBraces,String,mCommentLabel,Character
syn region  mCommentBraces contained start=+[^'"#]{+ end="}" contains=mCommentBraces,String
hi link mComment Comment
hi link mCommentBraces Comment
hi link mCommentLabel Comment