| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " Vim syntax file | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " Language:     Lua 4.0, Lua 5.0, Lua 5.1, Lua 5.2 and Lua 5.3 | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | " Maintainer:   Marcus Aurelius Farias <masserahguard-lua 'at' yahoo com> | 
					
						
							|  |  |  | " First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br> | 
					
						
							| 
									
										
										
										
											2025-02-25 20:22:18 +01:00
										 |  |  | " Last Change:  2025 Feb 25 | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | " Options:      lua_version = 4 or 5 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | "               lua_subversion = 0 (for 4.0 or 5.0) | 
					
						
							|  |  |  | "                               or 1, 2, 3 (for 5.1, 5.2 or 5.3) | 
					
						
							|  |  |  | "               the default is 5.3 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " quit when a syntax file was already loaded | 
					
						
							|  |  |  | if exists("b:current_syntax") | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-13 00:05:22 +01:00
										 |  |  | let s:cpo_save = &cpo | 
					
						
							|  |  |  | set cpo&vim | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-25 20:22:18 +01:00
										 |  |  | " keep in sync with ftplugin/lua.vim | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | if !exists("lua_version") | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   " Default is lua 5.3 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   let lua_version = 5 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   let lua_subversion = 3 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | elseif !exists("lua_subversion") | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   " lua_version exists, but lua_subversion doesn't. In this case set it to 0 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   let lua_subversion = 0 | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | syn case match | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " syncing method | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn sync minlines=1000 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | if lua_version >= 5 | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __add __sub __mul __div __pow __unm __concat | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __eq __lt __le | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __index __newindex __call | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __metatable __mode __gc __tostring | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | if lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __mod __len | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2) | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __pairs | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if lua_version > 5 || (lua_version == 5 && lua_subversion >= 3) | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __idiv __name | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __band __bor __bxor __bnot __shl __shr | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if lua_version > 5 || (lua_version == 5 && lua_subversion >= 4) | 
					
						
							|  |  |  |   syn keyword luaMetaMethod __close | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " catch errors caused by wrong parenthesis and wrong curly brackets or | 
					
						
							|  |  |  | " keywords placed outside their respective blocks | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaParen transparent start='(' end=')' contains=TOP,luaParenError | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | syn match  luaParenError ")" | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn match  luaError "}" | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | syn match  luaError "\<\%(end\|else\|elseif\|then\|until\|in\)\>" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " Function declaration | 
					
						
							|  |  |  | syn region luaFunctionBlock transparent matchgroup=luaFunction start="\<function\>" end="\<end\>" contains=TOP | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " else | 
					
						
							|  |  |  | syn keyword luaCondElse matchgroup=luaCond contained containedin=luaCondEnd else | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " then ... end | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaCondEnd contained transparent matchgroup=luaCond start="\<then\>" end="\<end\>" contains=TOP | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " elseif ... then | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaCondElseif contained containedin=luaCondEnd transparent matchgroup=luaCond start="\<elseif\>" end="\<then\>" contains=TOP | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " if ... then | 
					
						
							|  |  |  | syn region luaCondStart transparent matchgroup=luaCond start="\<if\>" end="\<then\>"me=e-4 contains=TOP nextgroup=luaCondEnd skipwhite skipempty | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " do ... end | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaBlock transparent matchgroup=luaStatement start="\<do\>" end="\<end\>" contains=TOP | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " repeat ... until | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaRepeatBlock transparent matchgroup=luaRepeat start="\<repeat\>" end="\<until\>" contains=TOP | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " while ... do | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaWhile transparent matchgroup=luaRepeat start="\<while\>" end="\<do\>"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " for ... do and for ... in ... do | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn region luaFor transparent matchgroup=luaRepeat start="\<for\>" end="\<do\>"me=e-2 contains=TOP nextgroup=luaBlock skipwhite skipempty | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn keyword luaFor contained containedin=luaFor in | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " other keywords | 
					
						
							|  |  |  | syn keyword luaStatement return local break | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | if lua_version > 5 || (lua_version == 5 && lua_subversion >= 2) | 
					
						
							|  |  |  |   syn keyword luaStatement goto | 
					
						
							|  |  |  |   syn match luaLabel "::\I\i*::" | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | " operators | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | syn keyword luaOperator and or not | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | if (lua_version == 5 && lua_subversion >= 3) || lua_version > 5 | 
					
						
							|  |  |  |   syn match luaSymbolOperator "[#<>=~^&|*/%+-]\|\.\{2,3}" | 
					
						
							|  |  |  | elseif lua_version == 5 && (lua_subversion == 1 || lua_subversion == 2) | 
					
						
							|  |  |  |   syn match luaSymbolOperator "[#<>=~^*/%+-]\|\.\{2,3}" | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |   syn match luaSymbolOperator "[<>=~^*/+-]\|\.\{2,3}" | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " comments | 
					
						
							|  |  |  | syn keyword luaTodo            contained TODO FIXME XXX | 
					
						
							|  |  |  | syn match   luaComment         "--.*$" contains=luaTodo,@Spell | 
					
						
							|  |  |  | if lua_version == 5 && lua_subversion == 0 | 
					
						
							|  |  |  |   syn region luaComment        matchgroup=luaCommentDelimiter start="--\[\[" end="\]\]" contains=luaTodo,luaInnerComment,@Spell | 
					
						
							|  |  |  |   syn region luaInnerComment   contained transparent start="\[\[" end="\]\]" | 
					
						
							|  |  |  | elseif lua_version > 5 || (lua_version == 5 && lua_subversion >= 1) | 
					
						
							|  |  |  |   " Comments in Lua 5.1: --[[ ... ]], [=[ ... ]=], [===[ ... ]===], etc. | 
					
						
							|  |  |  |   syn region luaComment        matchgroup=luaCommentDelimiter start="--\[\z(=*\)\[" end="\]\z1\]" contains=luaTodo,@Spell | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " first line may start with #! | 
					
						
							|  |  |  | syn match luaComment "\%^#!.*" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | syn keyword luaConstant nil | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | if lua_version > 4 | 
					
						
							|  |  |  |   syn keyword luaConstant true false | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " strings | 
					
						
							|  |  |  | syn match  luaSpecial contained #\\[\\abfnrtv'"[\]]\|\\[[:digit:]]\{,3}# | 
					
						
							|  |  |  | if lua_version == 5 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   if lua_subversion == 0 | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  |     syn region luaString2 matchgroup=luaStringDelimiter start=+\[\[+ end=+\]\]+ contains=luaString2,@Spell | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     if lua_subversion >= 2 | 
					
						
							|  |  |  |       syn match  luaSpecial contained #\\z\|\\x[[:xdigit:]]\{2}# | 
					
						
							|  |  |  |     endif | 
					
						
							|  |  |  |     if lua_subversion >= 3 | 
					
						
							|  |  |  |       syn match  luaSpecial contained #\\u{[[:xdigit:]]\+}# | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     endif | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  |     syn region luaString2 matchgroup=luaStringDelimiter start="\[\z(=*\)\[" end="\]\z1\]" contains=@Spell | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | syn region luaString matchgroup=luaStringDelimiter start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=luaSpecial,@Spell | 
					
						
							|  |  |  | syn region luaString matchgroup=luaStringDelimiter start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=luaSpecial,@Spell | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " integer number | 
					
						
							| 
									
										
										
										
											2007-05-05 17:54:07 +00:00
										 |  |  | syn match luaNumber "\<\d\+\>" | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " floating point number, with dot, optional exponent | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn match luaNumber  "\<\d\+\.\d*\%([eE][-+]\=\d\+\)\=" | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " floating point number, starting with a dot, optional exponent | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | syn match luaNumber  "\.\d\+\%([eE][-+]\=\d\+\)\=\>" | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | " floating point number, without dot, with exponent | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | syn match luaNumber  "\<\d\+[eE][-+]\=\d\+\>" | 
					
						
							| 
									
										
										
										
											2007-05-05 17:54:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " hex numbers | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | if lua_version >= 5 | 
					
						
							|  |  |  |   if lua_subversion == 1 | 
					
						
							|  |  |  |     syn match luaNumber "\<0[xX]\x\+\>" | 
					
						
							|  |  |  |   elseif lua_subversion >= 2 | 
					
						
							|  |  |  |     syn match luaNumber "\<0[xX][[:xdigit:].]\+\%([pP][-+]\=\d\+\)\=\>" | 
					
						
							|  |  |  |   endif | 
					
						
							| 
									
										
										
										
											2007-05-05 17:54:07 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | " tables | 
					
						
							|  |  |  | syn region luaTableBlock transparent matchgroup=luaTable start="{" end="}" contains=TOP,luaStatement | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " methods | 
					
						
							|  |  |  | syntax match luaFunc ":\@<=\k\+" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " built-in functions | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | syn keyword luaFunc assert collectgarbage dofile error next | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | syn keyword luaFunc print rawget rawset self tonumber tostring type _VERSION | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if lua_version == 4 | 
					
						
							|  |  |  |   syn keyword luaFunc _ALERT _ERRORMESSAGE gcinfo | 
					
						
							|  |  |  |   syn keyword luaFunc call copytagmethods dostring | 
					
						
							|  |  |  |   syn keyword luaFunc foreach foreachi getglobal getn | 
					
						
							|  |  |  |   syn keyword luaFunc gettagmethod globals newtag | 
					
						
							|  |  |  |   syn keyword luaFunc setglobal settag settagmethod sort | 
					
						
							|  |  |  |   syn keyword luaFunc tag tinsert tremove | 
					
						
							|  |  |  |   syn keyword luaFunc _INPUT _OUTPUT _STDIN _STDOUT _STDERR | 
					
						
							|  |  |  |   syn keyword luaFunc openfile closefile flush seek | 
					
						
							|  |  |  |   syn keyword luaFunc setlocale execute remove rename tmpname | 
					
						
							|  |  |  |   syn keyword luaFunc getenv date clock exit | 
					
						
							|  |  |  |   syn keyword luaFunc readfrom writeto appendto read write | 
					
						
							|  |  |  |   syn keyword luaFunc PI abs sin cos tan asin | 
					
						
							|  |  |  |   syn keyword luaFunc acos atan atan2 ceil floor | 
					
						
							|  |  |  |   syn keyword luaFunc mod frexp ldexp sqrt min max log | 
					
						
							|  |  |  |   syn keyword luaFunc log10 exp deg rad random | 
					
						
							|  |  |  |   syn keyword luaFunc randomseed strlen strsub strlower strupper | 
					
						
							|  |  |  |   syn keyword luaFunc strchar strrep ascii strbyte | 
					
						
							|  |  |  |   syn keyword luaFunc format strfind gsub | 
					
						
							|  |  |  |   syn keyword luaFunc getinfo getlocal setlocal setcallhook setlinehook | 
					
						
							|  |  |  | elseif lua_version == 5 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn keyword luaFunc getmetatable setmetatable | 
					
						
							|  |  |  |   syn keyword luaFunc ipairs pairs | 
					
						
							|  |  |  |   syn keyword luaFunc pcall xpcall | 
					
						
							|  |  |  |   syn keyword luaFunc _G loadfile rawequal require | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   if lua_subversion == 0 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn keyword luaFunc getfenv setfenv | 
					
						
							|  |  |  |     syn keyword luaFunc loadstring unpack | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |     syn keyword luaFunc gcinfo loadlib LUA_PATH _LOADED _REQUIREDNAME | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   else | 
					
						
							|  |  |  |     syn keyword luaFunc load select | 
					
						
							|  |  |  |     syn match   luaFunc /\<package\.cpath\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<package\.loaded\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<package\.loadlib\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<package\.path\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     syn match   luaFunc /\<package\.preload\>/ | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     if lua_subversion == 1 | 
					
						
							|  |  |  |       syn keyword luaFunc getfenv setfenv | 
					
						
							|  |  |  |       syn keyword luaFunc loadstring module unpack | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.loaders\>/ | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.seeall\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     elseif lua_subversion >= 2 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |       syn keyword luaFunc _ENV rawlen | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.config\>/ | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.preload\>/ | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.searchers\>/ | 
					
						
							|  |  |  |       syn match   luaFunc /\<package\.searchpath\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if lua_subversion >= 3 | 
					
						
							|  |  |  |       syn match luaFunc /\<coroutine\.isyieldable\>/ | 
					
						
							|  |  |  |     endif | 
					
						
							|  |  |  |     if lua_subversion >= 4 | 
					
						
							|  |  |  |       syn keyword luaFunc warn | 
					
						
							|  |  |  |       syn match luaFunc /\<coroutine\.close\>/ | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     endif | 
					
						
							|  |  |  |     syn match luaFunc /\<coroutine\.running\>/ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<coroutine\.create\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<coroutine\.resume\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<coroutine\.status\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<coroutine\.wrap\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<coroutine\.yield\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<string\.byte\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.char\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.dump\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.find\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.format\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.gsub\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.len\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.lower\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.rep\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.sub\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<string\.upper\>/ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   if lua_subversion == 0 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<string\.gfind\>/ | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.gmatch\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.match\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.reverse\>/ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   if lua_subversion >= 3 | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.pack\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.packsize\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<string\.unpack\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.char\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.charpattern\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.codes\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.codepoint\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.len\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<utf8\.offset\>/ | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   if lua_subversion == 0 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<table\.getn\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<table\.setn\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<table\.foreach\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<table\.foreachi\>/ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   elseif lua_subversion == 1 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<table\.maxn\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   elseif lua_subversion >= 2 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<table\.pack\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<table\.unpack\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     if lua_subversion >= 3 | 
					
						
							|  |  |  |       syn match luaFunc /\<table\.move\>/ | 
					
						
							|  |  |  |     endif | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   endif | 
					
						
							|  |  |  |   syn match   luaFunc /\<table\.concat\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<table\.insert\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   syn match   luaFunc /\<table\.sort\>/ | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<table\.remove\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if lua_subversion == 2 | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.arshift\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.band\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.bnot\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.bor\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.btest\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.bxor\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.extract\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.lrotate\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.lshift\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.replace\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.rrotate\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<bit32\.rshift\>/ | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<math\.abs\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.acos\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.asin\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.atan\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   if lua_subversion < 3 | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.atan2\>/ | 
					
						
							|  |  |  |   endif | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<math\.ceil\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.sin\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.cos\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.tan\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.deg\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.exp\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.floor\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.log\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.max\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.min\>/ | 
					
						
							|  |  |  |   if lua_subversion == 0 | 
					
						
							|  |  |  |     syn match luaFunc /\<math\.mod\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<math\.log10\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   elseif lua_subversion == 1 | 
					
						
							|  |  |  |     syn match luaFunc /\<math\.log10\>/ | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  |   if lua_subversion >= 1 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<math\.huge\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<math\.fmod\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<math\.modf\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     if lua_subversion == 1 || lua_subversion == 2 | 
					
						
							|  |  |  |       syn match luaFunc /\<math\.cosh\>/ | 
					
						
							|  |  |  |       syn match luaFunc /\<math\.sinh\>/ | 
					
						
							|  |  |  |       syn match luaFunc /\<math\.tanh\>/ | 
					
						
							|  |  |  |     endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<math\.rad\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.sqrt\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   if lua_subversion < 3 | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.pow\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.frexp\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.ldexp\>/ | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.maxinteger\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.mininteger\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.tointeger\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.type\>/ | 
					
						
							|  |  |  |     syn match   luaFunc /\<math\.ult\>/ | 
					
						
							|  |  |  |   endif | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<math\.random\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.randomseed\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<math\.pi\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<io\.close\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.flush\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.input\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.lines\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.open\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.output\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.popen\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.read\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.stderr\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.stdin\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.stdout\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.tmpfile\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.type\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<io\.write\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<os\.clock\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.date\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.difftime\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.execute\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.exit\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.getenv\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.remove\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.rename\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.setlocale\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.time\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<os\.tmpname\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |   syn match   luaFunc /\<debug\.debug\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.gethook\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.getinfo\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.getlocal\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.getupvalue\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.setlocal\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.setupvalue\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.sethook\>/ | 
					
						
							|  |  |  |   syn match   luaFunc /\<debug\.traceback\>/ | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  |   if lua_subversion == 1 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<debug\.getfenv\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<debug\.setfenv\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |   endif | 
					
						
							|  |  |  |   if lua_subversion >= 1 | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  |     syn match luaFunc /\<debug\.getmetatable\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<debug\.setmetatable\>/ | 
					
						
							|  |  |  |     syn match luaFunc /\<debug\.getregistry\>/ | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  |     if lua_subversion >= 2 | 
					
						
							|  |  |  |       syn match luaFunc /\<debug\.getuservalue\>/ | 
					
						
							|  |  |  |       syn match luaFunc /\<debug\.setuservalue\>/ | 
					
						
							|  |  |  |       syn match luaFunc /\<debug\.upvalueid\>/ | 
					
						
							|  |  |  |       syn match luaFunc /\<debug\.upvaluejoin\>/ | 
					
						
							|  |  |  |     endif | 
					
						
							|  |  |  |     if lua_subversion >= 4 | 
					
						
							|  |  |  |       syn match luaFunc /\<debug.setcstacklimit\>/ | 
					
						
							|  |  |  |     endif | 
					
						
							| 
									
										
										
										
											2022-04-08 17:45:08 +01:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Define the default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " Only when an item doesn't have highlighting yet | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | hi def link luaStatement        Statement | 
					
						
							|  |  |  | hi def link luaRepeat           Repeat | 
					
						
							|  |  |  | hi def link luaFor              Repeat | 
					
						
							|  |  |  | hi def link luaString           String | 
					
						
							|  |  |  | hi def link luaString2          String | 
					
						
							|  |  |  | hi def link luaStringDelimiter  luaString | 
					
						
							|  |  |  | hi def link luaNumber           Number | 
					
						
							|  |  |  | hi def link luaOperator         Operator | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | hi def link luaSymbolOperator   luaOperator | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | hi def link luaConstant         Constant | 
					
						
							|  |  |  | hi def link luaCond             Conditional | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | hi def link luaCondElse         Conditional | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | hi def link luaFunction         Function | 
					
						
							| 
									
										
										
										
											2022-09-18 13:04:22 +01:00
										 |  |  | hi def link luaMetaMethod       Function | 
					
						
							| 
									
										
										
										
											2022-09-10 13:13:14 +01:00
										 |  |  | hi def link luaComment          Comment | 
					
						
							|  |  |  | hi def link luaCommentDelimiter luaComment | 
					
						
							|  |  |  | hi def link luaTodo             Todo | 
					
						
							|  |  |  | hi def link luaTable            Structure | 
					
						
							|  |  |  | hi def link luaError            Error | 
					
						
							|  |  |  | hi def link luaParenError       Error | 
					
						
							|  |  |  | hi def link luaSpecial          SpecialChar | 
					
						
							|  |  |  | hi def link luaFunc             Identifier | 
					
						
							|  |  |  | hi def link luaLabel            Label | 
					
						
							| 
									
										
										
										
											2006-04-20 22:17:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let b:current_syntax = "lua" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-13 00:05:22 +01:00
										 |  |  | let &cpo = s:cpo_save | 
					
						
							|  |  |  | unlet s:cpo_save | 
					
						
							| 
									
										
										
										
											2011-12-30 13:11:27 +01:00
										 |  |  | " vim: et ts=8 sw=2 |