lua.nanorc (2461B)
1 ## Syntax highlighting for Lua. 2 3 ## Original author: Matthew Wild 4 ## License: GPL version 3 or newer 5 6 syntax lua "\.lua$" 7 magic "Lua script" 8 comment "--" 9 10 linter luacheck --no-color 11 12 color brightwhite "\[\[.*\]\]" 13 14 # Operators 15 color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|#|\<(not|and|or)\>" 16 # Don't partially color ... as an operator 17 color normal "\.\.\." 18 19 # Statements 20 color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>" 21 22 # Keywords 23 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)[[:blank:]]*\(" 24 25 # Standard library 26 color brightyellow "\<coroutine\.(create|isyieldable|resume|running|status|wrap|yield)\>" 27 color brightyellow "\<debug\.(debug|(get|set)(fenv|hook|local|metatable|(up|user)value)|getinfo|getregistry|traceback|upvalue(id|join))\>" 28 color brightyellow "\<io\.(close|flush|input|lines|output|p?open|read|tmpfile|type|write|std(in|out|err))\>" 29 color brightyellow "\<math\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log)\>" 30 color brightyellow "\<math\.((max|min)(integer)?|modf?|pi|pow|rad|random(seed)?|sinh?|sqrt|tan|tointeger|type|ult)\>" 31 color brightyellow "\<os\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>" 32 color brightyellow "\<package\.(config|cpath|loaded|loadlib|path|preload|searchers|searchpath|seeall)\>" 33 color brightyellow "\<string\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\>" 34 color brightyellow "\<table\.(concat|insert|maxn|move|pack|remove|sort|unpack)\>" 35 color brightyellow "\<utf8\.(char|charpattern|codepoint|codes|len|offset)\>" 36 37 # File handle methods 38 color brightyellow ":(close|flush|lines|read|seek|setvbuf|write)\>" 39 40 # External files 41 color brightgreen "\<(dofile|require)\>" 42 43 # Special words 44 color brightmagenta "\<(false|nil|true)\>" 45 46 # Decimal and hexadecimal numbers 47 color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?\>" 48 color red "\<0x[[:xdigit:]]+(\.[[:xdigit:]]*)?([Pp][+-]?[0-9]+)?\>" 49 50 # Brackets 51 color brightmagenta "\(|\)|\[|\]|\{|\}" 52 53 # Shebang 54 color brightcyan "^#!.*" 55 56 # Strings 57 color red ""([^"\]|\\.)*"|'([^'\]|\\.)*'" 58 59 # Simple comments and multiline comments 60 color green "--.*" 61 color green start="--\[\[" end="\]\]"