]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/lua.yaml
Close fd properly in save
[micro.git] / runtime / syntax / lua.yaml
1 filetype: lua
2
3 detect:
4     filename: "\\.lua$"
5
6 rules:
7     - statement: "\\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\\b"
8     - statement: "\\b(not|and|or)\\b"
9     - statement: "\\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\\b\\."
10     - 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*\\("
11     - identifier: "io\\.\\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\\b"
12     - 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"
13     - identifier: "os\\.\\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\\b"
14     - identifier: "package\\.\\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\\b"
15     - identifier: "string\\.\\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b"
16     - identifier: "table\\.\\b(concat|insert|maxn|move|pack|remove|sort|unpack)\\b"
17     - identifier: "utf8\\.\\b(char|charpattern|codes|codepoint|len|offset)\\b"
18     - identifier: "coroutine\\.\\b(create|isyieldable|resume|running|status|wrap|yield)\\b"
19     - identifier: "debug\\.\\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\\b"
20     - identifier: "bit32\\.\\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\\b"
21     - identifier: "\\:\\b(close|flush|lines|read|seek|setvbuf|write|byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b"
22     - identifier: "\\b(self|arg)\\b"
23     - constant: "\\b(false|nil|true)\\b"
24     - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b"
25     - constant.number: "\\b([0-9]+)\\b"
26     - symbol: "(\\(|\\)|\\[|\\]|\\{|\\}|\\*\\*|\\*|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
27
28     - constant.string:
29         start: "\""
30         end: "\""
31         skip: "\\\\."
32         rules:
33             - constant.specialChar: "\\\\."
34
35     - constant.string:
36         start: "'"
37         end: "'"
38         skip: "\\\\."
39         rules:
40             - constant.specialChar: "\\\\."
41
42     - constant.string:
43         start: "\\[\\["
44         end: "\\]\\]"
45         rules:
46             - constant.specialChar: "\\\\."
47
48     - special: "\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\[abefnrs]|(\\\\c|\\\\C-|\\\\M-|\\\\M-\\\\C-)."
49
50     - comment.block:
51         start: "\\-\\-\\[(\\=*|\\#*)\\["
52         end: "\\-\\-\\](\\=*|\\#*)\\]"
53         rules:
54             - todo: "(TODO|NOTE|FIXME):?"
55
56 # this has to go after block comment or block comment does not work
57
58     - comment: 
59         start: "\\-\\-"
60         end: "$"
61         rules:
62           - todo: "(TODO|NOTE|FIXME):?"