-
Notifications
You must be signed in to change notification settings - Fork 552
/
lua.nanorc
80 lines (60 loc) · 3.01 KB
/
lua.nanorc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
##############################################################################
#
# Lua syntax highlighting for Nano.
#
# Author: Matthew Wild <mwild1 (at) gmail.com>
# License: GPL 2 or later
#
# Version: 2007-06-06
#
# Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt
##############################################################################
# Automatically use for '.lua' files
syntax "Lua" ".*\.lua$"
magic "Lua script"
comment "--"
linter luacheck --no-color
# General
color brightwhite ".+"
# Operators
color brightyellow ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
# Statements
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\>"
# Keywords
color brightyellow "\<(debug|string|math|table|io|coroutine|os|utf8|bit32)\>\."
color brightyellow "\<(_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*\("
# Standard library
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\>"
color brightyellow "math\.\<(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)\>"
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
color brightyellow "package\.\<(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\>"
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 "utf8\.\<(char|charpattern|codes|codepoint|len|offset)\>"
color brightyellow "coroutine\.\<(create|isyieldable|resume|running|status|wrap|yield)\>"
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\>"
color brightyellow "bit32\.\<(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\>"
# File handle methods
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
# false, nil, true
color brightmagenta "\<(false|nil|true)\>"
# External files
color brightgreen "(\<(dofile|require|include)|%q|%!|%Q|%r|%x)\>"
# Numbers
color red "\<([0-9]+)\>"
# Symbols
color brightmagenta "(\(|\)|\[|\]|\{|\})"
# Strings
color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
# Multiline strings
color red start="\s*\[\[" end="\]\]"
# Escapes
color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
# Shebang
color brightcyan "^#!.*"
# Simple comments
color green "\-\-.*$"
# Multiline comments
color green start="\s*\-\-\s*\[\[" end="\]\]"
# Trailing whitespaces
color ,green "[[:space:]]+$"