blob: f5851d024f34a9af9a0e6fe15e2f8462bfe94e4f [file] [log] [blame]
Bram Moolenaarfc1421e2006-04-20 22:17:20 +00001" Vim syntax file
Bram Moolenaar9712ff12022-09-18 13:04:22 +01002" Language: Lua 4.0, Lua 5.0, Lua 5.1, Lua 5.2 and Lua 5.3
Bram Moolenaar71b6d332022-09-10 13:13:14 +01003" Maintainer: Marcus Aurelius Farias <masserahguard-lua 'at' yahoo com>
4" First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br>
brianhuster00a00f52025-02-25 20:22:18 +01005" Last Change: 2025 Feb 25
Bram Moolenaar71b6d332022-09-10 13:13:14 +01006" Options: lua_version = 4 or 5
Bram Moolenaar9712ff12022-09-18 13:04:22 +01007" lua_subversion = 0 (for 4.0 or 5.0)
8" or 1, 2, 3 (for 5.1, 5.2 or 5.3)
9" the default is 5.3
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000010
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020011" quit when a syntax file was already loaded
12if exists("b:current_syntax")
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000013 finish
14endif
15
Bram Moolenaar5dc62522012-02-13 00:05:22 +010016let s:cpo_save = &cpo
17set cpo&vim
18
brianhuster00a00f52025-02-25 20:22:18 +010019" keep in sync with ftplugin/lua.vim
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000020if !exists("lua_version")
Bram Moolenaar9712ff12022-09-18 13:04:22 +010021 " Default is lua 5.3
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000022 let lua_version = 5
Bram Moolenaar9712ff12022-09-18 13:04:22 +010023 let lua_subversion = 3
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000024elseif !exists("lua_subversion")
Bram Moolenaar9712ff12022-09-18 13:04:22 +010025 " lua_version exists, but lua_subversion doesn't. In this case set it to 0
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000026 let lua_subversion = 0
27endif
28
29syn case match
30
31" syncing method
Bram Moolenaar9712ff12022-09-18 13:04:22 +010032syn sync minlines=1000
Bram Moolenaarfc1421e2006-04-20 22:17:20 +000033
Bram Moolenaar9712ff12022-09-18 13:04:22 +010034if lua_version >= 5
35 syn keyword luaMetaMethod __add __sub __mul __div __pow __unm __concat
36 syn keyword luaMetaMethod __eq __lt __le
37 syn keyword luaMetaMethod __index __newindex __call
38 syn keyword luaMetaMethod __metatable __mode __gc __tostring
39endif
40
41if lua_version > 5 || (lua_version == 5 && lua_subversion >= 1)
42 syn keyword luaMetaMethod __mod __len
43endif
44
45if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2)
46 syn keyword luaMetaMethod __pairs
47endif
48
49if lua_version > 5 || (lua_version == 5 && lua_subversion >= 3)
50 syn keyword luaMetaMethod __idiv __name
51 syn keyword luaMetaMethod __band __bor __bxor __bnot __shl __shr
52endif
53
54if lua_version > 5 || (lua_version == 5 && lua_subversion >= 4)
55 syn keyword luaMetaMethod __close
56endif
57
58" catch errors caused by wrong parenthesis and wrong curly brackets or
59" keywords placed outside their respective blocks
60
61syn region luaParen transparent start='(' end=')' contains=TOP,luaParenError
62syn match luaParenError ")"
63syn match luaError "}"
64syn match luaError "\<\%(end\|else\|elseif\|then\|until\|in\)\>"
65
66" Function declaration
67syn region luaFunctionBlock transparent matchgroup=luaFunction start="\<function\>" end="\<end\>" contains=TOP
68
69" else
70syn keyword luaCondElse matchgroup=luaCond contained containedin=luaCondEnd else
71
72" then ... end
73syn region luaCondEnd contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=TOP
74
75" elseif ... then
76syn region luaCondElseif contained containedin=luaCondEnd transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=TOP
77
78" if ... then
79syn region luaCondStart transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=TOP nextgroup=luaCondEnd skipwhite skipempty
80
81" do ... end
82syn region luaBlock transparent matchgroup=luaStatement start="\<do\>" end="\<end\>" contains=TOP
83" repeat ... until
84syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=TOP
85
86" while ... do
87syn region luaWhile transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty
88
89" for ... do and for ... in ... do
90syn region luaFor transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty
91
92syn keyword luaFor contained containedin=luaFor in
93
94" other keywords
95syn keyword luaStatement return local break
96if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2)
97 syn keyword luaStatement goto
98 syn match luaLabel "::\I\i*::"
99endif
100
101" operators
102syn keyword luaOperator and or not
103
104if (lua_version == 5 && lua_subversion >= 3) || lua_version > 5
105 syn match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\{2,3}"
106elseif lua_version == 5 && (lua_subversion == 1 || lua_subversion == 2)
107 syn match luaSymbolOperator "[#<>=~^*/%+-]\|\.\{2,3}"
108else
109 syn match luaSymbolOperator "[<>=~^*/+-]\|\.\{2,3}"
110endif
111
112" comments
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100113syn keyword luaTodo contained TODO FIXME XXX
114syn match luaComment "--.*$" contains=luaTodo,@Spell
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000115if lua_version == 5 && lua_subversion == 0
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100116 syn region luaComment matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100117 syn region luaInnerComment contained transparent start="\[\[" end="\]\]"
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000118elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1)
119 " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc.
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100120 syn region luaComment matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000121endif
122
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100123" first line may start with #!
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000124syn match luaComment "\%^#!.*"
125
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100126syn keyword luaConstant nil
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000127if lua_version > 4
128 syn keyword luaConstant true false
129endif
130
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100131" strings
132syn match luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}#
133if lua_version == 5
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100134 if lua_subversion == 0
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100135 syn region luaString2 matchgroup=luaStringDelimiter start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100136 else
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100137 if lua_subversion >= 2
138 syn match luaSpecial contained #\\z\|\\x[[:xdigit:]]\{2}#
139 endif
140 if lua_subversion >= 3
141 syn match luaSpecial contained #\\u{[[:xdigit:]]\+}#
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100142 endif
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100143 syn region luaString2 matchgroup=luaStringDelimiter start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100144 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000145endif
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100146syn region luaString matchgroup=luaStringDelimiter start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell
147syn region luaString matchgroup=luaStringDelimiter start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000148
149" integer number
Bram Moolenaar9964e462007-05-05 17:54:07 +0000150syn match luaNumber "\<\d\+\>"
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000151" floating point number, with dot, optional exponent
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100152syn match luaNumber "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\="
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000153" floating point number, starting with a dot, optional exponent
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100154syn match luaNumber "\.\d\+\%([eE][-+]\=\d\+\)\=\>"
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000155" floating point number, without dot, with exponent
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100156syn match luaNumber "\<\d\+[eE][-+]\=\d\+\>"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000157
158" hex numbers
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100159if lua_version >= 5
160 if lua_subversion == 1
161 syn match luaNumber "\<0[xX]\x\+\>"
162 elseif lua_subversion >= 2
163 syn match luaNumber "\<0[xX][[:xdigit:].]\+\%([pP][-+]\=\d\+\)\=\>"
164 endif
Bram Moolenaar9964e462007-05-05 17:54:07 +0000165endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000166
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100167" tables
168syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=TOP,luaStatement
169
170" methods
171syntax match luaFunc ":\@<=\k\+"
172
173" built-in functions
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000174syn keyword luaFunc assert collectgarbage dofile error next
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100175syn keyword luaFunc print rawget rawset self tonumber tostring type _VERSION
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000176
177if lua_version == 4
178 syn keyword luaFunc _ALERT _ERRORMESSAGE gcinfo
179 syn keyword luaFunc call copytagmethods dostring
180 syn keyword luaFunc foreach foreachi getglobal getn
181 syn keyword luaFunc gettagmethod globals newtag
182 syn keyword luaFunc setglobal settag settagmethod sort
183 syn keyword luaFunc tag tinsert tremove
184 syn keyword luaFunc _INPUT _OUTPUT _STDIN _STDOUT _STDERR
185 syn keyword luaFunc openfile closefile flush seek
186 syn keyword luaFunc setlocale execute remove rename tmpname
187 syn keyword luaFunc getenv date clock exit
188 syn keyword luaFunc readfrom writeto appendto read write
189 syn keyword luaFunc PI abs sin cos tan asin
190 syn keyword luaFunc acos atan atan2 ceil floor
191 syn keyword luaFunc mod frexp ldexp sqrt min max log
192 syn keyword luaFunc log10 exp deg rad random
193 syn keyword luaFunc randomseed strlen strsub strlower strupper
194 syn keyword luaFunc strchar strrep ascii strbyte
195 syn keyword luaFunc format strfind gsub
196 syn keyword luaFunc getinfo getlocal setlocal setcallhook setlinehook
197elseif lua_version == 5
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100198 syn keyword luaFunc getmetatable setmetatable
199 syn keyword luaFunc ipairs pairs
200 syn keyword luaFunc pcall xpcall
201 syn keyword luaFunc _G loadfile rawequal require
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000202 if lua_subversion == 0
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100203 syn keyword luaFunc getfenv setfenv
204 syn keyword luaFunc loadstring unpack
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000205 syn keyword luaFunc gcinfo loadlib LUA_PATH _LOADED _REQUIREDNAME
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100206 else
207 syn keyword luaFunc load select
208 syn match luaFunc /\<package\.cpath\>/
209 syn match luaFunc /\<package\.loaded\>/
210 syn match luaFunc /\<package\.loadlib\>/
211 syn match luaFunc /\<package\.path\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100212 syn match luaFunc /\<package\.preload\>/
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100213 if lua_subversion == 1
214 syn keyword luaFunc getfenv setfenv
215 syn keyword luaFunc loadstring module unpack
216 syn match luaFunc /\<package\.loaders\>/
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100217 syn match luaFunc /\<package\.seeall\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100218 elseif lua_subversion >= 2
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100219 syn keyword luaFunc _ENV rawlen
220 syn match luaFunc /\<package\.config\>/
221 syn match luaFunc /\<package\.preload\>/
222 syn match luaFunc /\<package\.searchers\>/
223 syn match luaFunc /\<package\.searchpath\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100224 endif
225
226 if lua_subversion >= 3
227 syn match luaFunc /\<coroutine\.isyieldable\>/
228 endif
229 if lua_subversion >= 4
230 syn keyword luaFunc warn
231 syn match luaFunc /\<coroutine\.close\>/
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100232 endif
233 syn match luaFunc /\<coroutine\.running\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000234 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100235 syn match luaFunc /\<coroutine\.create\>/
236 syn match luaFunc /\<coroutine\.resume\>/
237 syn match luaFunc /\<coroutine\.status\>/
238 syn match luaFunc /\<coroutine\.wrap\>/
239 syn match luaFunc /\<coroutine\.yield\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100240
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100241 syn match luaFunc /\<string\.byte\>/
242 syn match luaFunc /\<string\.char\>/
243 syn match luaFunc /\<string\.dump\>/
244 syn match luaFunc /\<string\.find\>/
245 syn match luaFunc /\<string\.format\>/
246 syn match luaFunc /\<string\.gsub\>/
247 syn match luaFunc /\<string\.len\>/
248 syn match luaFunc /\<string\.lower\>/
249 syn match luaFunc /\<string\.rep\>/
250 syn match luaFunc /\<string\.sub\>/
251 syn match luaFunc /\<string\.upper\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000252 if lua_subversion == 0
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100253 syn match luaFunc /\<string\.gfind\>/
254 else
255 syn match luaFunc /\<string\.gmatch\>/
256 syn match luaFunc /\<string\.match\>/
257 syn match luaFunc /\<string\.reverse\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000258 endif
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100259 if lua_subversion >= 3
260 syn match luaFunc /\<string\.pack\>/
261 syn match luaFunc /\<string\.packsize\>/
262 syn match luaFunc /\<string\.unpack\>/
263 syn match luaFunc /\<utf8\.char\>/
264 syn match luaFunc /\<utf8\.charpattern\>/
265 syn match luaFunc /\<utf8\.codes\>/
266 syn match luaFunc /\<utf8\.codepoint\>/
267 syn match luaFunc /\<utf8\.len\>/
268 syn match luaFunc /\<utf8\.offset\>/
269 endif
270
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000271 if lua_subversion == 0
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100272 syn match luaFunc /\<table\.getn\>/
273 syn match luaFunc /\<table\.setn\>/
274 syn match luaFunc /\<table\.foreach\>/
275 syn match luaFunc /\<table\.foreachi\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000276 elseif lua_subversion == 1
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100277 syn match luaFunc /\<table\.maxn\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100278 elseif lua_subversion >= 2
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100279 syn match luaFunc /\<table\.pack\>/
280 syn match luaFunc /\<table\.unpack\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100281 if lua_subversion >= 3
282 syn match luaFunc /\<table\.move\>/
283 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000284 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100285 syn match luaFunc /\<table\.concat\>/
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100286 syn match luaFunc /\<table\.insert\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100287 syn match luaFunc /\<table\.sort\>/
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100288 syn match luaFunc /\<table\.remove\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100289
290 if lua_subversion == 2
291 syn match luaFunc /\<bit32\.arshift\>/
292 syn match luaFunc /\<bit32\.band\>/
293 syn match luaFunc /\<bit32\.bnot\>/
294 syn match luaFunc /\<bit32\.bor\>/
295 syn match luaFunc /\<bit32\.btest\>/
296 syn match luaFunc /\<bit32\.bxor\>/
297 syn match luaFunc /\<bit32\.extract\>/
298 syn match luaFunc /\<bit32\.lrotate\>/
299 syn match luaFunc /\<bit32\.lshift\>/
300 syn match luaFunc /\<bit32\.replace\>/
301 syn match luaFunc /\<bit32\.rrotate\>/
302 syn match luaFunc /\<bit32\.rshift\>/
303 endif
304
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100305 syn match luaFunc /\<math\.abs\>/
306 syn match luaFunc /\<math\.acos\>/
307 syn match luaFunc /\<math\.asin\>/
308 syn match luaFunc /\<math\.atan\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100309 if lua_subversion < 3
310 syn match luaFunc /\<math\.atan2\>/
311 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100312 syn match luaFunc /\<math\.ceil\>/
313 syn match luaFunc /\<math\.sin\>/
314 syn match luaFunc /\<math\.cos\>/
315 syn match luaFunc /\<math\.tan\>/
316 syn match luaFunc /\<math\.deg\>/
317 syn match luaFunc /\<math\.exp\>/
318 syn match luaFunc /\<math\.floor\>/
319 syn match luaFunc /\<math\.log\>/
320 syn match luaFunc /\<math\.max\>/
321 syn match luaFunc /\<math\.min\>/
322 if lua_subversion == 0
323 syn match luaFunc /\<math\.mod\>/
324 syn match luaFunc /\<math\.log10\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100325 elseif lua_subversion == 1
326 syn match luaFunc /\<math\.log10\>/
327 endif
328 if lua_subversion >= 1
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100329 syn match luaFunc /\<math\.huge\>/
330 syn match luaFunc /\<math\.fmod\>/
331 syn match luaFunc /\<math\.modf\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100332 if lua_subversion == 1 || lua_subversion == 2
333 syn match luaFunc /\<math\.cosh\>/
334 syn match luaFunc /\<math\.sinh\>/
335 syn match luaFunc /\<math\.tanh\>/
336 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100337 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100338 syn match luaFunc /\<math\.rad\>/
339 syn match luaFunc /\<math\.sqrt\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100340 if lua_subversion < 3
341 syn match luaFunc /\<math\.pow\>/
342 syn match luaFunc /\<math\.frexp\>/
343 syn match luaFunc /\<math\.ldexp\>/
344 else
345 syn match luaFunc /\<math\.maxinteger\>/
346 syn match luaFunc /\<math\.mininteger\>/
347 syn match luaFunc /\<math\.tointeger\>/
348 syn match luaFunc /\<math\.type\>/
349 syn match luaFunc /\<math\.ult\>/
350 endif
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100351 syn match luaFunc /\<math\.random\>/
352 syn match luaFunc /\<math\.randomseed\>/
353 syn match luaFunc /\<math\.pi\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100354
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100355 syn match luaFunc /\<io\.close\>/
356 syn match luaFunc /\<io\.flush\>/
357 syn match luaFunc /\<io\.input\>/
358 syn match luaFunc /\<io\.lines\>/
359 syn match luaFunc /\<io\.open\>/
360 syn match luaFunc /\<io\.output\>/
361 syn match luaFunc /\<io\.popen\>/
362 syn match luaFunc /\<io\.read\>/
363 syn match luaFunc /\<io\.stderr\>/
364 syn match luaFunc /\<io\.stdin\>/
365 syn match luaFunc /\<io\.stdout\>/
366 syn match luaFunc /\<io\.tmpfile\>/
367 syn match luaFunc /\<io\.type\>/
368 syn match luaFunc /\<io\.write\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100369
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100370 syn match luaFunc /\<os\.clock\>/
371 syn match luaFunc /\<os\.date\>/
372 syn match luaFunc /\<os\.difftime\>/
373 syn match luaFunc /\<os\.execute\>/
374 syn match luaFunc /\<os\.exit\>/
375 syn match luaFunc /\<os\.getenv\>/
376 syn match luaFunc /\<os\.remove\>/
377 syn match luaFunc /\<os\.rename\>/
378 syn match luaFunc /\<os\.setlocale\>/
379 syn match luaFunc /\<os\.time\>/
380 syn match luaFunc /\<os\.tmpname\>/
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100381
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100382 syn match luaFunc /\<debug\.debug\>/
383 syn match luaFunc /\<debug\.gethook\>/
384 syn match luaFunc /\<debug\.getinfo\>/
385 syn match luaFunc /\<debug\.getlocal\>/
386 syn match luaFunc /\<debug\.getupvalue\>/
387 syn match luaFunc /\<debug\.setlocal\>/
388 syn match luaFunc /\<debug\.setupvalue\>/
389 syn match luaFunc /\<debug\.sethook\>/
390 syn match luaFunc /\<debug\.traceback\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000391 if lua_subversion == 1
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100392 syn match luaFunc /\<debug\.getfenv\>/
393 syn match luaFunc /\<debug\.setfenv\>/
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000394 endif
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100395 if lua_subversion >= 1
396 syn match luaFunc /\<debug\.getmetatable\>/
397 syn match luaFunc /\<debug\.setmetatable\>/
398 syn match luaFunc /\<debug\.getregistry\>/
399 if lua_subversion >= 2
400 syn match luaFunc /\<debug\.getuservalue\>/
401 syn match luaFunc /\<debug\.setuservalue\>/
402 syn match luaFunc /\<debug\.upvalueid\>/
403 syn match luaFunc /\<debug\.upvaluejoin\>/
404 endif
405 if lua_subversion >= 4
406 syn match luaFunc /\<debug.setcstacklimit\>/
407 endif
Bram Moolenaarcbaff5e2022-04-08 17:45:08 +0100408 endif
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000409endif
410
411" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200412" Only when an item doesn't have highlighting yet
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000413
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100414hi def link luaStatement Statement
415hi def link luaRepeat Repeat
416hi def link luaFor Repeat
417hi def link luaString String
418hi def link luaString2 String
419hi def link luaStringDelimiter luaString
420hi def link luaNumber Number
421hi def link luaOperator Operator
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100422hi def link luaSymbolOperator luaOperator
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100423hi def link luaConstant Constant
424hi def link luaCond Conditional
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100425hi def link luaCondElse Conditional
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100426hi def link luaFunction Function
Bram Moolenaar9712ff12022-09-18 13:04:22 +0100427hi def link luaMetaMethod Function
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100428hi def link luaComment Comment
429hi def link luaCommentDelimiter luaComment
430hi def link luaTodo Todo
431hi def link luaTable Structure
432hi def link luaError Error
433hi def link luaParenError Error
Bram Moolenaar71b6d332022-09-10 13:13:14 +0100434hi def link luaSpecial SpecialChar
435hi def link luaFunc Identifier
436hi def link luaLabel Label
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000437
Bram Moolenaarfc1421e2006-04-20 22:17:20 +0000438
439let b:current_syntax = "lua"
440
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100441let &cpo = s:cpo_save
442unlet s:cpo_save
Bram Moolenaarb6b046b2011-12-30 13:11:27 +0100443" vim: et ts=8 sw=2