aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_zig.lua
blob: 40ecb013fcaa3d69bc87efcf136ea8c4e8eec613 (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
-- lite-xl 1.16
local syntax = require "core.syntax"

syntax.add {
  files = { "%.zig$" },
  comment = "//",
  patterns = {
    { pattern = "//.-\n",               type = "comment"  },
    { pattern = "#!.-\n",               type = "comment"  },
    { pattern = { '"', '"', '\\' },     type = "string"   },
    { pattern = { "'", "'", '\\' },     type = "string"   },
    { pattern = "-?[iuf][%d_]+",            type = "keyword2" },
    { pattern = "-?\\x[%x_]+",          type = "number"   },
    { pattern = "-?\\u{[%x_]+}",        type = "number"   },
    { pattern = "-?%d+[%d%.eE]*f?",     type = "number"   },
    { pattern = "-?%.?%d+f?",           type = "number"   },
    { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
    { pattern = "[%a_][%w_]*%f[(]",     type = "function" },
    { pattern = "@?[%a_][%w_]*",        type = "symbol"   },
  },
  symbols = {
    ["fn"]          = "keyword",

    ["asm"]         = "keyword",
    ["volatile"]    = "keyword",

    ["continue"]    = "keyword",
    ["break"]       = "keyword",
    ["switch"]      = "keyword",
    ["for"]         = "keyword",
    ["while"]       = "keyword",

    ["var"]             = "keyword",
    ["anytype"]         = "keyword",
    ["const"]           = "keyword",
    ["test"]            = "keyword",
    ["packed"]          = "keyword",
    ["extern"]          = "keyword",
    ["export"]          = "keyword",
    ["pub"]             = "keyword",
    ["defer"]           = "keyword",
    ["errdefer"]        = "keyword",
    ["align"]           = "keyword",
    ["usingnamespace"]  = "keyword",

    ["noasync"]     = "keyword",
    ["async"]       = "keyword",
    ["await"]       = "keyword",
    ["cancel"]      = "keyword",
    ["suspend"]     = "keyword",
    ["resume"]      = "keyword",

    ["threadlocal"] = "keyword",

    ["linksection"] = "keyword",

    ["callconv"]    = "keyword",

    ["try"]         = "keyword",
    ["catch"]       = "keyword",
    ["orelse"]      = "keyword",
    ["unreachable"] = "keyword",
    ["noreturn"]    = "keyword",
    ["error"]       = "keyword",
    ["if"]          = "keyword",
    ["else"]        = "keyword",
    ["return"]      = "keyword",
    ["comptime"]    = "keyword",

    ["stdcallcc"]   = "keyword",
    ["ccc"]         = "keyword",
    ["nakedcc"]     = "keyword",

    ["and"]         = "keyword",
    ["or"]          = "keyword",

    -- std
    ["@import"]     = "keyword",
    ["@cImport"]    = "keyword",

    [ "@addWithOverflow" ]      = "function",
    [ "@alignCast" ]            = "function",
    [ "@alignOf" ]              = "function",
    [ "@as" ]                   = "function",
    [ "@asyncCall" ]            = "function",
    [ "@atomicLoad" ]           = "function",
    [ "@atomicRmw" ]            = "function",
    [ "@atomicStore" ]          = "function",
    [ "@bitCast" ]              = "function",
    [ "@bitOffsetOf" ]          = "function",
    [ "@boolToInt" ]            = "function",
    [ "@bitSizeOf" ]            = "function",
    [ "@breakpoint" ]           = "function",
    [ "@mulAdd" ]               = "function",
    [ "@byteSwap" ]             = "function",
    [ "@bitReverse" ]           = "function",
    [ "@byteOffsetOf" ]         = "function",
    [ "@call" ]                 = "function",
    [ "@cDefine" ]              = "function",
    [ "@cImport" ]              = "function",
    [ "@cInclude" ]             = "function",
    [ "@clz" ]                  = "function",
    [ "@cmpxchgStrong" ]        = "function",
    [ "@cmpxchgWeak" ]          = "function",
    [ "@compileError" ]         = "function",
    [ "@compileLog" ]           = "function",
    [ "@ctz" ]                  = "function",
    [ "@cUndef" ]               = "function",
    [ "@divExact" ]             = "function",
    [ "@divFloor" ]             = "function",
    [ "@divTrunc" ]             = "function",
    [ "@embedFile" ]            = "function",
    [ "@enumToInt" ]            = "function",
    [ "@errorName" ]            = "function",
    [ "@errorReturnTrace" ]     = "function",
    [ "@errorToInt" ]           = "function",
    [ "@errSetCast" ]           = "function",
    [ "@export" ]               = "function",
    [ "@fence" ]                = "function",
    [ "@field" ]                = "function",
    [ "@fieldParentPtr" ]       = "function",
    [ "@floatCast" ]            = "function",
    [ "@floatToInt" ]           = "function",
    [ "@Frame" ]                = "function",
    [ "@frame" ]                = "function",
    [ "@frameAddress" ]         = "function",
    [ "@frameSize" ]            = "function",
    [ "@hasDecl" ]              = "function",
    [ "@hasField" ]             = "function",
    [ "@import" ]               = "function",
    [ "@intCast" ]              = "function",
    [ "@intToEnum" ]            = "function",
    [ "@intToError" ]           = "function",
    [ "@intToFloat" ]           = "function",
    [ "@intToPtr" ]             = "function",
    [ "@memcpy" ]               = "function",
    [ "@memset" ]               = "function",
    [ "@wasmMemorySize" ]       = "function",
    [ "@wasmMemoryGrow" ]       = "function",
    [ "@mod" ]                  = "function",
    [ "@mulWithOverflow" ]      = "function",
    [ "@panic" ]                = "function",
    [ "@popCount" ]             = "function",
    [ "@ptrCast" ]              = "function",
    [ "@ptrToInt" ]             = "function",
    [ "@rem" ]                  = "function",
    [ "@returnAddress" ]        = "function",
    [ "@setAlignStack" ]        = "function",
    [ "@setCold" ]              = "function",
    [ "@setEvalBranchQuota" ]   = "function",
    [ "@setFloatMode" ]         = "function",
    [ "@setRuntimeSafety" ]     = "function",
    [ "@shlExact" ]             = "function",
    [ "@shlWithOverflow" ]      = "function",
    [ "@shrExact" ]             = "function",
    [ "@shuffle" ]              = "function",
    [ "@sizeOf" ]               = "function",
    [ "@splat" ]                = "function",
    [ "@src" ]                  = "function",
    [ "@sqrt" ]                 = "function",
    [ "@sin" ]                  = "function",
    [ "@cos" ]                  = "function",
    [ "@exp" ]                  = "function",
    [ "@exp2" ]                 = "function",
    [ "@log" ]                  = "function",
    [ "@log2" ]                 = "function",
    [ "@log10" ]                = "function",
    [ "@fabs" ]                 = "function",
    [ "@floor" ]                = "function",
    [ "@ceil" ]                 = "function",
    [ "@trunc" ]                = "function",
    [ "@round" ]                = "function",
    [ "@subWithOverflow" ]      = "function",
    [ "@tagName" ]              = "function",
    [ "@TagType" ]              = "function",
    [ "@This" ]                 = "function",
    [ "@truncate" ]             = "function",
    [ "@Type" ]                 = "function",
    [ "@typeInfo" ]             = "function",
    [ "@typeName" ]             = "function",
    [ "@TypeOf" ]               = "function",
    [ "@unionInit" ]            = "function",

    -- types
    ["void"]            = "keyword2",
    ["c_void"]          = "keyword2",
    ["isize"]           = "keyword2",
    ["usize"]           = "keyword2",
    ["c_short"]         = "keyword2",
    ["c_ushort"]        = "keyword2",
    ["c_int"]           = "keyword2",
    ["c_uint"]          = "keyword2",
    ["c_long"]          = "keyword2",
    ["c_ulong"]         = "keyword2",
    ["c_longlong"]      = "keyword2",
    ["c_ulonglong"]     = "keyword2",
    ["c_longdouble"]    = "keyword2",
    ["bool"]            = "keyword2",

    ["noreturn"]        = "keyword2",
    ["type"]            = "keyword2",
    ["anyerror"]        = "keyword2",
    ["comptime_int"]    = "keyword2",
    ["comptime_float"]  = "keyword2",

    ["true"]            = "literal",
    ["false"]           = "literal",
    ["null"]            = "literal",
    ["undefined"]       = "literal",
  },
}