@@ -10,214 +10,26 @@ endif
10
10
let s: cpo_save = &cpo
11
11
set cpo &vim
12
12
13
- let s: zig_syntax_keywords = {
14
- \ ' zigBoolean' : [" true"
15
- \ , " false" ]
16
- \ , ' zigNull' : [" null" ]
17
- \ , ' zigType' : [" bool"
18
- \ , " f16"
19
- \ , " f32"
20
- \ , " f64"
21
- \ , " f80"
22
- \ , " f128"
23
- \ , " void"
24
- \ , " type"
25
- \ , " anytype"
26
- \ , " anyerror"
27
- \ , " anyframe"
28
- \ , " volatile"
29
- \ , " linksection"
30
- \ , " noreturn"
31
- \ , " allowzero"
32
- \ , " i0"
33
- \ , " u0"
34
- \ , " isize"
35
- \ , " usize"
36
- \ , " comptime_int"
37
- \ , " comptime_float"
38
- \ , " c_char"
39
- \ , " c_short"
40
- \ , " c_ushort"
41
- \ , " c_int"
42
- \ , " c_uint"
43
- \ , " c_long"
44
- \ , " c_ulong"
45
- \ , " c_longlong"
46
- \ , " c_ulonglong"
47
- \ , " c_longdouble"
48
- \ , " anyopaque" ]
49
- \ , ' zigConstant' : [" undefined"
50
- \ , " unreachable" ]
51
- \ , ' zigConditional' : [" if"
52
- \ , " else"
53
- \ , " switch" ]
54
- \ , ' zigRepeat' : [" while"
55
- \ , " for" ]
56
- \ , ' zigComparatorWord' : [" and"
57
- \ , " or"
58
- \ , " orelse" ]
59
- \ , ' zigStructure' : [" struct"
60
- \ , " enum"
61
- \ , " union"
62
- \ , " error"
63
- \ , " packed"
64
- \ , " opaque" ]
65
- \ , ' zigException' : [" error" ]
66
- \ , ' zigVarDecl' : [" var"
67
- \ , " const"
68
- \ , " comptime"
69
- \ , " threadlocal" ]
70
- \ , ' zigDummyVariable' : [" _" ]
71
- \ , ' zigKeyword' : [" fn"
72
- \ , " try"
73
- \ , " test"
74
- \ , " pub" ]
75
- \ , ' zigExecution' : [" return"
76
- \ , " break"
77
- \ , " continue" ]
78
- \ , ' zigMacro' : [" defer"
79
- \ , " errdefer"
80
- \ , " nosuspend"
81
- \ , " suspend"
82
- \ , " resume"
83
- \ , " export"
84
- \ , " extern" ]
85
- \ , ' zigPreProc' : [" addrspace"
86
- \ , " align"
87
- \ , " asm"
88
- \ , " callconv"
89
- \ , " catch"
90
- \ , " inline"
91
- \ , " noalias"
92
- \ , " noinline" ]
93
- \ , ' zigBuiltinFn' : [" @addrSpaceCast"
94
- \ , " @addWithOverflow"
95
- \ , " @alignCast"
96
- \ , " @alignOf"
97
- \ , " @as"
98
- \ , " @atomicLoad"
99
- \ , " @atomicRmw"
100
- \ , " @atomicStore"
101
- \ , " @bitCast"
102
- \ , " @bitOffsetOf"
103
- \ , " @bitSizeOf"
104
- \ , " @branchHint"
105
- \ , " @breakpoint"
106
- \ , " @mulAdd"
107
- \ , " @byteSwap"
108
- \ , " @bitReverse"
109
- \ , " @offsetOf"
110
- \ , " @call"
111
- \ , " @cDefine"
112
- \ , " @cImport"
113
- \ , " @cInclude"
114
- \ , " @clz"
115
- \ , " @cmpxchgStrong"
116
- \ , " @cmpxchgWeak"
117
- \ , " @compileError"
118
- \ , " @compileLog"
119
- \ , " @constCast"
120
- \ , " @ctz"
121
- \ , " @cUndef"
122
- \ , " @cVaArg"
123
- \ , " @cVaCopy"
124
- \ , " @cVaEnd"
125
- \ , " @cVaStart"
126
- \ , " @disableInstrumentation"
127
- \ , " @disableIntrinsics"
128
- \ , " @divExact"
129
- \ , " @divFloor"
130
- \ , " @divTrunc"
131
- \ , " @embedFile"
132
- \ , " @enumFromInt"
133
- \ , " @errorFromInt"
134
- \ , " @errorName"
135
- \ , " @errorReturnTrace"
136
- \ , " @errorCast"
137
- \ , " @export"
138
- \ , " @extern"
139
- \ , " @field"
140
- \ , " @fieldParentPtr"
141
- \ , " @FieldType"
142
- \ , " @floatCast"
143
- \ , " @floatFromInt"
144
- \ , " @frameAddress"
145
- \ , " @hasDecl"
146
- \ , " @hasField"
147
- \ , " @import"
148
- \ , " @inComptime"
149
- \ , " @intCast"
150
- \ , " @intFromBool"
151
- \ , " @intFromEnum"
152
- \ , " @intFromError"
153
- \ , " @intFromFloat"
154
- \ , " @intFromPtr"
155
- \ , " @max"
156
- \ , " @memcpy"
157
- \ , " @memmove"
158
- \ , " @memset"
159
- \ , " @min"
160
- \ , " @wasmMemorySize"
161
- \ , " @wasmMemoryGrow"
162
- \ , " @mod"
163
- \ , " @mulWithOverflow"
164
- \ , " @panic"
165
- \ , " @popCount"
166
- \ , " @prefetch"
167
- \ , " @ptrCast"
168
- \ , " @ptrFromInt"
169
- \ , " @rem"
170
- \ , " @returnAddress"
171
- \ , " @select"
172
- \ , " @setEvalBranchQuota"
173
- \ , " @setFloatMode"
174
- \ , " @setRuntimeSafety"
175
- \ , " @shlExact"
176
- \ , " @shlWithOverflow"
177
- \ , " @shrExact"
178
- \ , " @shuffle"
179
- \ , " @sizeOf"
180
- \ , " @splat"
181
- \ , " @reduce"
182
- \ , " @src"
183
- \ , " @sqrt"
184
- \ , " @sin"
185
- \ , " @cos"
186
- \ , " @tan"
187
- \ , " @exp"
188
- \ , " @exp2"
189
- \ , " @log"
190
- \ , " @log2"
191
- \ , " @log10"
192
- \ , " @abs"
193
- \ , " @floor"
194
- \ , " @ceil"
195
- \ , " @trunc"
196
- \ , " @round"
197
- \ , " @subWithOverflow"
198
- \ , " @tagName"
199
- \ , " @This"
200
- \ , " @trap"
201
- \ , " @truncate"
202
- \ , " @Type"
203
- \ , " @typeInfo"
204
- \ , " @typeName"
205
- \ , " @TypeOf"
206
- \ , " @unionInit"
207
- \ , " @Vector"
208
- \ , " @volatileCast"
209
- \ , " @workGroupId"
210
- \ , " @workGroupSize"
211
- \ , " @workItemId" ]
212
- \ }
213
-
214
- function ! s: syntax_keyword (dict )
215
- for key in keys (a: dict )
216
- execute ' syntax keyword' key join (a: dict [key ], ' ' )
217
- endfor
218
- endfunction
219
-
220
- call s: syntax_keyword (s: zig_syntax_keywords )
13
+ syntax keyword zigBoolean true false
14
+ syntax keyword zigNull null
15
+ syntax keyword zigType bool void type anytype anyerror anyframe volatile linksection noreturn allowzero anyopaque
16
+ syntax keyword zigType i0 u0 isize usize comptime_int comptime_float
17
+ syntax keyword zigType f16 f32 f64 f80 f128
18
+ syntax keyword zigType c_char c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_longdouble
19
+ syntax keyword zigConstant undefined unreachable
20
+ syntax keyword zigConditional if else switch
21
+ syntax keyword zigRepeat while for
22
+ syntax keyword zigComparatorWord and or orelse
23
+ syntax keyword zigStructure struct enum union error packed opaque
24
+ syntax keyword zigException error
25
+ syntax keyword zigStorageClass
26
+ syntax keyword zigVarDecl var const comptime threadlocal
27
+ syntax keyword zigDummyVariable _
28
+ syntax keyword zigKeyword fn try test pub
29
+ syntax keyword zigExecution return break continue
30
+ syntax keyword zigMacro defer errdefer nosuspend suspend resume export extern
31
+ syntax keyword zigPreProc addrspace align asm callconv catch inline noalias noinline
32
+ syntax keyword zigBuiltinFn @addrSpaceCast @addWithOverflow @alignCast @alignOf @as @atomicLoad @atomicRmw @atomicStore @bitCast @bitOffsetOf @bitSizeOf @branchHint @breakpoint @mulAdd @byteSwap @bitReverse @offsetOf @call @cDefine @cImport @cInclude @clz @cmpxchgStrong @cmpxchgWeak @compileError @compileLog @constCast @ctz @cUndef @cVaArg @cVaCopy @cVaEnd @cVaStart @disableInstrumentation @disableIntrinsics @divExact @divFloor @divTrunc @embedFile @enumFromInt @errorFromInt @errorName @errorReturnTrace @errorCast @export @extern @field @fieldParentPtr @FieldType @floatCast @floatFromInt @frameAddress @hasDecl @hasField @import @inComptime @intCast @intFromBool @intFromEnum @intFromError @intFromFloat @intFromPtr @max @memcpy @memmove @memset @min @wasmMemorySize @wasmMemoryGrow @mod @mulWithOverflow @panic @popCount @prefetch @ptrCast @ptrFromInt @rem @returnAddress @select @setEvalBranchQuota @setFloatMode @setRuntimeSafety @shlExact @shlWithOverflow @shrExact @shuffle @sizeOf @splat @reduce @src @sqrt @sin @cos @tan @exp @exp2 @log @log2 @log10 @abs @floor @ceil @trunc @round @subWithOverflow @tagName @This @trap @truncate @Type @typeInfo @typeName @TypeOf @unionInit @Vector @volatileCast @workGroupId @workGroupSize @workItemId
221
33
222
34
syntax match zigType " \v <[iu][1-9]\d *>"
223
35
syntax match zigOperator display " \V\[ -+/*=^&?|!><%~]"
@@ -290,8 +102,6 @@ highlight default link zigVarDecl Function
290
102
highlight default link zigPreProc PreProc
291
103
highlight default link zigException Exception
292
104
293
- delfunction s: syntax_keyword
294
-
295
105
let b: current_syntax = " zig"
296
106
297
107
let &cpo = s: cpo_save
0 commit comments