syntax: lua: add new and missing standard library functions

The list now includes all the Lua 5.3 functions listed on
https://www.lua.org/manual/5.3/#index.

Also, remove the coloring of just the library name, so that
only known library functions get highlighted.

Signed-off-by: Tom Levy <tomlevy93@gmail.com>
master
Tom Levy 2017-12-31 05:56:01 +00:00 committed by Benno Schulenberg
parent 38a10a62d0
commit 058b9da9b9
1 changed files with 10 additions and 9 deletions

View File

@ -17,20 +17,21 @@ color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
# Keywords
color brightyellow "\<(io|math|os|string|table|coroutine|debug)\."
color 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*\("
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
# Standard library
color brightyellow "\<io\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
color brightyellow "\<math\.(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>"
color brightyellow "\<math\.(max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
color brightyellow "\<math\.(max|maxinteger|min|mininteger|mod|modf|pi|pow|rad|random|randomseed|sinh|sin|sqrt|tan)\>"
color brightyellow "\<math\.(tointeger|type|ult)\>"
color brightyellow "\<os\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
color brightyellow "\<package\.(cpath|loaded|loadlib|path|preload|seeall)\>"
color brightyellow "\<string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
color brightyellow "\<table\.(concat|insert|maxn|remove|sort)\>"
color brightyellow "\<coroutine\.(create|resume|running|status|wrap|yield)\>"
color brightyellow "\<debug\.(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue)\>"
color brightyellow "\<debug\.(setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
color brightyellow "\<package\.(config|cpath|loaded|loadlib|path|preload|searchers|searchpath|seeall)\>"
color brightyellow "\<string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\>"
color brightyellow "\<table\.(concat|insert|maxn|move|pack|remove|sort|unpack)\>"
color brightyellow "\<coroutine\.(create|isyieldable|resume|running|status|wrap|yield)\>"
color brightyellow "\<debug\.(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue)\>"
color brightyellow "\<debug\.(setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\>"
color brightyellow "\<utf8\.(char|charpattern|codepoint|codes|len|offset)\>"
# File handle methods
color brightyellow ":(close|flush|lines|read|seek|setvbuf|write)\>"