blob: 70f69d47ecf293f95628f3345994800470962d0e [file] [log] [blame]
Benno Schulenbergfe9da942014-05-16 20:21:34 +00001## Syntax highlighting for Lua.
Chris Allegretta090e2cf2011-05-08 04:23:24 +00002#
Benno Schulenbergfe9da942014-05-16 20:21:34 +00003## Author: Matthew Wild <mwild1 (at) gmail.com>
4## License: GPL 3 or later
5## Version: 2011-05-05
Chris Allegretta090e2cf2011-05-08 04:23:24 +00006
Chris Allegretta090e2cf2011-05-08 04:23:24 +00007syntax "lua" "\.lua$"
Mike Scalora6a2032f2016-05-25 22:13:50 +02008comment "--"
Chris Allegretta090e2cf2011-05-08 04:23:24 +00009
10color brightwhite "\[\[.*\]\]"
11
12# Operators
13color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
14
15# Statements
16color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
17
18# Keywords
Benno Schulenberged2f0b32015-02-21 10:34:15 +000019color brightyellow "\<(io|math|os|string|table|coroutine|debug)\>\."
Chris Allegretta090e2cf2011-05-08 04:23:24 +000020color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
21
22# Standard library
23color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
Benno Schulenberged2f0b32015-02-21 10:34:15 +000024color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
25color brightyellow "math\.\<(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
Chris Allegretta090e2cf2011-05-08 04:23:24 +000026color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
27color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
28color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
29color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
30color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
Benno Schulenberged2f0b32015-02-21 10:34:15 +000031color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
32color brightyellow "debug\.\<(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
Chris Allegretta090e2cf2011-05-08 04:23:24 +000033
34# File handle methods
35color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
36
37# false, nil, true
38color brightmagenta "\<(false|nil|true)\>"
39
40# External files
41color brightgreen "\<(dofile|require)\>"
42
43# Numbers
44color red "\<([0-9]+)\>"
45
46# Symbols
47color brightmagenta "(\(|\)|\[|\]|\{|\})"
48
Chris Allegretta090e2cf2011-05-08 04:23:24 +000049# Shebang
50color brightcyan "^#!.*"
51
52# Simple comments
53color green "\-\-.*$"
54
55# Multiline comments
56color green start="\-\-\[\[" end="\]\]"
57
58# Strings
Chris Allegretta090e2cf2011-05-08 04:23:24 +000059color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
Benno Schulenbergc4b344f2014-02-23 16:07:44 +000060##color red start="\[\[" end="\]\]"
Chris Allegretta090e2cf2011-05-08 04:23:24 +000061
62# Hex literals
63color red "0x[0-9a-fA-F]*"