diff options
Diffstat (limited to 'runtime/queries/lua/highlights.scm')
-rw-r--r-- | runtime/queries/lua/highlights.scm | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index 2c0dc5447a..5fbf8a1833 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -8,8 +8,6 @@ "local" ] @keyword -(label_statement) @label - (break_statement) @keyword (do_statement @@ -109,6 +107,7 @@ [ ";" ":" + "::" "," "." ] @punctuation.delimiter @@ -129,12 +128,21 @@ (identifier) @variable ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#any-of? @variable.builtin "_G" "_VERSION" "debug" "io" "jit" "math" "os" "package" "self" "string" "table" "utf8")) + +((identifier) @keyword.coroutine + (#eq? @keyword.coroutine "coroutine")) (variable_list - attribute: (attribute - (["<" ">"] @punctuation.bracket - (identifier) @attribute))) + attribute: (attribute + (["<" ">"] @punctuation.bracket + (identifier) @attribute))) + +;; Labels + +(label_statement (identifier) @label) + +(goto_statement (identifier) @label) ;; Constants @@ -172,7 +180,7 @@ (function_call name: (dot_index_expression field: (identifier) @function.call)) (function_declaration name: (dot_index_expression field: (identifier) @function)) -(method_index_expression method: (identifier) @method) +(method_index_expression method: (identifier) @method.call) (function_call (identifier) @function.builtin @@ -180,20 +188,27 @@ ;; built-in functions in Lua 5.1 "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" - "rawequal" "rawget" "rawset" "require" "select" "setfenv" "setmetatable" - "tonumber" "tostring" "type" "unpack" "xpcall")) + "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable" + "tonumber" "tostring" "type" "unpack" "xpcall" + "__add" "__band" "__bnot" "__bor" "__bxor" "__call" "__concat" "__div" "__eq" "__gc" + "__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex" + "__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm")) ;; Others -(comment) @comment -(comment) @spell +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^[-][-][-]")) + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^[-][-](%s?)@")) -(hash_bang_line) @comment +(hash_bang_line) @preproc (number) @number -(string) @string -(string) @spell +(string) @string @spell ;; Error (ERROR) @error |