]> git.lizzy.rs Git - micro.git/blob - syntax_files/lua.micro
Proper window resize handling
[micro.git] / syntax_files / lua.micro
1 ##############################################################################
2 #
3 # Lua syntax highlighting for Nano.
4 #
5 # Author:  Matthew Wild <mwild1 (at) gmail.com>
6 # License: GPL 2  or later
7 #
8 # Version: 2007-06-06
9 #
10 # Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt
11 ##############################################################################
12
13
14 # Automatically use for '.lua' files
15 syntax "Lua" ".*\.lua$"
16
17 # Operators
18 color statement ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\b(not|and|or)\b"
19
20 # Statements
21 color statement "\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\b"
22
23 # Keywords
24 color statement "\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\b\."
25 color statement "\b(_ENV|_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*\("
26
27 # Standard library
28 color identifier "io\.\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\b"
29 color identifier "math\.\b(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|maxinteger|min|mininteger|modf|pi|pow|rad|random|randomseed|sinh|sqrt|tan|tointeger|type|ult)\b"
30 color identifier "os\.\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\b"
31 color identifier "package\.\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\b"
32 color identifier "string\.\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\b"
33 color identifier "table\.\b(concat|insert|maxn|move|pack|remove|sort|unpack)\b"
34 color identifier "utf8\.\b(char|charpattern|codes|codepoint|len|offset)\b"
35 color identifier "coroutine\.\b(create|isyieldable|resume|running|status|wrap|yield)\b"
36 color identifier "debug\.\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\b"
37 color identifier "bit32\.\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\b"
38
39 # File handle methods
40 color identifier "\:\b(close|flush|lines|read|seek|setvbuf|write)\b"
41
42 # false, nil, true
43 color constant "\b(false|nil|true)\b"
44
45 # External files
46 color statement "(\b(dofile|require|include)|%q|%!|%Q|%r|%x)\b"
47
48 # Numbers
49 color constant "\b([0-9]+)\b"
50
51 # Symbols
52 color statement "(\(|\)|\[|\]|\{|\})"
53
54 # Strings
55 color constant "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
56
57 # Multiline strings
58 color constant (s) "\s*\[\[.*?\]\]"
59
60 # Escapes
61 color special "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
62
63 # Shebang
64 color comment "^#!.*"
65
66 # Simple brightblacks
67 color comment "\-\-.*$"
68
69 # Multiline brightblacks
70 color comment (s) "\s*\-\-\s*\[\[.*?\]\]"
71