mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-09 08:30:23 +09:00
This may be a breaking change if you are using a plugin that checks the filetype. All the default plugins are now updated, just make the filetype you were checking for previously all lowercase.
72 lines
2.9 KiB
Plaintext
72 lines
2.9 KiB
Plaintext
##############################################################################
|
|
#
|
|
# 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$"
|
|
|
|
# Operators
|
|
color statement ":|\*\*|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\b(not|and|or)\b"
|
|
|
|
# Statements
|
|
color statement "\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\b"
|
|
|
|
# Keywords
|
|
color statement "\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\b\."
|
|
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*\("
|
|
|
|
# Standard library
|
|
color identifier "io\.\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\b"
|
|
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"
|
|
color identifier "os\.\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\b"
|
|
color identifier "package\.\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\b"
|
|
color identifier "string\.\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\b"
|
|
color identifier "table\.\b(concat|insert|maxn|move|pack|remove|sort|unpack)\b"
|
|
color identifier "utf8\.\b(char|charpattern|codes|codepoint|len|offset)\b"
|
|
color identifier "coroutine\.\b(create|isyieldable|resume|running|status|wrap|yield)\b"
|
|
color identifier "debug\.\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\b"
|
|
color identifier "bit32\.\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\b"
|
|
|
|
# File handle methods
|
|
color identifier "\:\b(close|flush|lines|read|seek|setvbuf|write)\b"
|
|
|
|
# false, nil, true
|
|
color constant "\b(false|nil|true)\b"
|
|
|
|
# External files
|
|
color statement "(\b(dofile|require|include)|%q|%!|%Q|%r|%x)\b"
|
|
|
|
# Numbers
|
|
color constant "\b([0-9]+)\b"
|
|
|
|
# Symbols
|
|
color statement "(\(|\)|\[|\]|\{|\})"
|
|
|
|
# Strings
|
|
color constant.string "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
|
|
|
|
# Multiline strings
|
|
color constant start="\s*\[\[" end="\]\]"
|
|
|
|
# Escapes
|
|
color special "\\[0-7][0-7][0-7]|\\x[0-9a-fA-F][0-9a-fA-F]|\\[abefnrs]|(\\c|\\C-|\\M-|\\M-\\C-)."
|
|
|
|
# Shebang
|
|
color comment "^#!.*"
|
|
|
|
# Simple brightblacks
|
|
color comment "\-\-.*$"
|
|
|
|
# Multiline brightblacks
|
|
color comment start="\s*\-\-\s*\[\[" end="\]\]"
|
|
|