Skip to content

Commit b6d418a

Browse files
authored
Merge pull request #17 from davidhcefx/lua-num
fix(lua): add keyword, number matching
2 parents 7062015 + c001ce7 commit b6d418a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lua.nanorc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ color brightwhite ".+"
2525
color brightyellow ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
2626

2727
# Statements
28-
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\>"
28+
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|goto)\>"
2929

3030
# Keywords
3131
color brightyellow "\<(debug|string|math|table|io|coroutine|os|utf8|bit32)\>\."
3232
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*\("
3333

3434
# Standard library
3535
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\>"
36-
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)\>"
36+
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|sin|sqrt|tan|tointeger|type|ult)\>"
3737
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
3838
color brightyellow "package\.\<(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\>"
3939
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\>"
@@ -52,8 +52,10 @@ color brightmagenta "\<(false|nil|true)\>"
5252
# External files
5353
color brightgreen "(\<(dofile|require|include)|%q|%!|%Q|%r|%x)\>"
5454

55-
# Numbers
56-
color red "\<([0-9]+)\>"
55+
# Numbers (hex and decimal with scientific notation)
56+
#color magenta "\<(0[xX](([0-9A-Fa-f]+\.[0-9A-Fa-f]*)|(\.?[0-9A-Fa-f]+))([pP][-+]?[0-9]+)?)\>"
57+
#color magenta "\<((([0-9]+\.[0-9]*)|(\.?[0-9]+))([eE][-+]?[0-9]+)?)\>"
58+
color magenta "\<((0[xX](([0-9A-Fa-f]+\.[0-9A-Fa-f]*)|(\.?[0-9A-Fa-f]+))([pP][-+]?[0-9]+)?)|((([0-9]+\.[0-9]*)|(\.?[0-9]+))([eE][-+]?[0-9]+)?))\>"
5759

5860
# Symbols
5961
color brightmagenta "(\(|\)|\[|\]|\{|\})"
@@ -65,7 +67,7 @@ color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
6567
color red start="\s*\[\[" end="\]\]"
6668

6769
# Escapes
68-
color red "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
70+
color magenta "\\([abfnrtvz'\"]|[0-9]{1,3}|x[0-9a-fA-F][0-9a-fA-F]|u\{[0-9a-fA-F]+\})"
6971

7072
# Shebang
7173
color brightcyan "^#!.*"

0 commit comments

Comments
 (0)