-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabc.vim
111 lines (97 loc) · 4.15 KB
/
abc.vim
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
" Vim syntax file
" Language: ABC (A Bloody Compiler)
" Maintainer: Michael Christian Lehn <[email protected]>
" Last Change: 2022-7-10
" License: Vim (see :h license)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syntax case match
syntax match abcIdentifier /[A-Za-z_][A-Za-z0-9_]*/ skipwhite
" syntax match abcMinus /[-]/ contained skipwhite
syntax match abcIdentifier /[A-Za-z_][A-Za-z0-9_]*/
syntax match keyword /\<label\>/ skipwhite
syntax match keyword /\<fn\>/ skipwhite
syntax match keyword /\<_fn\>/ skipwhite
syntax match keyword /\<for\>/ skipwhite
syntax match keyword /\<do\>/ skipwhite
syntax match keyword /\<while\>/ skipwhite
syntax match keyword /\<if\>/ skipwhite
syntax match keyword /\<else\>/ skipwhite
syntax match keyword /\<then\>/ skipwhite
syntax match keyword /\<local\>/ skipwhite
syntax match keyword /\<global\>/ skipwhite
syntax match keyword /\<static\>/ skipwhite
syntax match keyword /\<extern\>/ skipwhite
syntax match keyword /\<return\>/ skipwhite
syntax match keyword /\<array\>/ skipwhite
syntax match keyword /\<of\>/ skipwhite
syntax match keyword /\<type\>/ skipwhite
syntax match keyword /\<let\>/ skipwhite
syntax match keyword /\<sizeof\>/ skipwhite
syntax match keyword /\<cast\>/ skipwhite
syntax match keyword /\<break\>/ skipwhite
syntax match keyword /\<continue\>/ skipwhite
syntax match keyword /\<switch\>/ skipwhite
syntax match keyword /\<case\>/ skipwhite
syntax match keyword /\<default\>/ skipwhite
syntax match keyword /\<struct\>/ skipwhite
syntax match keyword /\<union\>/ skipwhite
syntax match keyword /\<enum\>/ skipwhite
syntax match keyword /\<goto\>/ skipwhite
syntax match literal /\<true\>/ skipwhite
syntax match literal /\<false\>/ skipwhite
syntax match type /\<const\>/ skipwhite
syntax match type /\<readonly\>/ skipwhite
syntax match type /\<void\>/ skipwhite
syntax match type /\<bool\>/ skipwhite
syntax match type /\<float\>/ skipwhite
syntax match type /\<double\>/ skipwhite
syntax match type /\<char\>/ skipwhite
syntax match type /\<u8\>/ skipwhite
syntax match type /\<u16\>/ skipwhite
syntax match type /\<u32\>/ skipwhite
syntax match type /\<u64\>/ skipwhite
syntax match type /\<i8\>/ skipwhite
syntax match type /\<i16\>/ skipwhite
syntax match type /\<i32\>/ skipwhite
syntax match type /\<i64\>/ skipwhite
syntax match type /\<size_t\>/ skipwhite
syntax match type /\<ptrdiff_t\>/ skipwhite
syntax match type /\<int\>/ skipwhite
syntax match type /\<long\>/ skipwhite
syntax match type /\<long_long\>/ skipwhite
syntax match type /\<unsigned\>/ skipwhite
syntax match type /\<unsigned_long\>/ skipwhite
syntax match type /\<unsigned_long_long\>/ skipwhite
syn region cDefine start="^\s*\zs\%(%:\|#\)\s*\%(define\|undef\)\>" skip="\\$" end="$" keepend
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\zs\%(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
syn match cInclude display "^\s*\zs\%(%:\|@\)\s*.*$" contains=cIncluded
syn region cPreCondit start="^\s*\zs\%(%:\|#\)\s*\%(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=comment
syn match cPreCondit display "^\s*\zs\%(%:\|#\)\s*\%(else\|endif\)\>"
syntax match literal /[+-]*[1-9][0-9]*/ skipwhite
syntax match literal /nullptr/ skipwhite
syntax match literal /[0-7][0-7]*/ skipwhite
syntax match literal /0x[0-9a-fA-F][0-9a-fA-F]*/ skipwhite
syntax region literal start=/"/ skip=/\\"/ end=/"/ skipwhite
syntax match literal /'.'/ skipwhite
syntax match literal /'\\[^\\]'/ skipwhite
"syntax match ident /[a-zA-Z][a-zA-Z0-9_]*/ skipwhite
syntax region comment start="//" end="$" skipwhite
syntax region comment start="/\*" end="\*/" skipwhite
highlight link keyword Statement
highlight link type Type
highlight link literal Number
highlight link comment Comment
hi def link cDefine Macro
hi def link cIncluded cString
hi def link cInclude Include
hi def link cString String
hi def link cPreCondit PreCondit
let b:current_syntax = "abc"