2020-04-20 16:18:02 +02:00
|
|
|
;;; Highlighting for lua
|
|
|
|
|
|
|
|
|
|
;;; Builtins
|
|
|
|
|
;; Keywords
|
2020-09-05 09:53:21 -05:00
|
|
|
|
|
|
|
|
(if_statement
|
|
|
|
|
[
|
2020-11-23 22:10:52 +01:00
|
|
|
"if"
|
2020-11-25 21:26:31 +01:00
|
|
|
"then"
|
2020-09-05 09:53:21 -05:00
|
|
|
"end"
|
|
|
|
|
] @conditional)
|
|
|
|
|
|
2020-07-16 09:30:15 +02:00
|
|
|
[
|
2020-07-05 19:58:47 +02:00
|
|
|
"else"
|
|
|
|
|
"elseif"
|
2020-11-23 22:10:52 +01:00
|
|
|
"then"
|
2020-09-06 18:31:46 +02:00
|
|
|
] @conditional
|
2020-06-30 08:59:34 +02:00
|
|
|
|
2020-09-05 09:53:21 -05:00
|
|
|
(for_statement
|
|
|
|
|
[
|
|
|
|
|
"for"
|
|
|
|
|
"do"
|
|
|
|
|
"end"
|
|
|
|
|
] @repeat)
|
2020-06-30 08:59:34 +02:00
|
|
|
|
2020-09-05 09:53:21 -05:00
|
|
|
(for_in_statement
|
|
|
|
|
[
|
|
|
|
|
"for"
|
2020-07-05 19:58:47 +02:00
|
|
|
"do"
|
2020-09-05 09:53:21 -05:00
|
|
|
"end"
|
|
|
|
|
] @repeat)
|
|
|
|
|
|
|
|
|
|
(while_statement
|
|
|
|
|
[
|
2020-07-05 19:58:47 +02:00
|
|
|
"while"
|
2020-09-05 09:53:21 -05:00
|
|
|
"do"
|
|
|
|
|
"end"
|
|
|
|
|
] @repeat)
|
2020-07-05 19:58:47 +02:00
|
|
|
|
2020-09-05 09:53:21 -05:00
|
|
|
(repeat_statement
|
|
|
|
|
[
|
|
|
|
|
"repeat"
|
|
|
|
|
"until"
|
|
|
|
|
] @repeat)
|
2020-06-30 08:59:34 +02:00
|
|
|
|
2021-01-27 09:29:44 +01:00
|
|
|
(do_statement
|
|
|
|
|
[
|
|
|
|
|
"do"
|
|
|
|
|
"end"
|
|
|
|
|
] @keyword)
|
|
|
|
|
|
2020-06-30 08:59:34 +02:00
|
|
|
[
|
2020-08-03 21:40:23 -05:00
|
|
|
"in"
|
|
|
|
|
"local"
|
|
|
|
|
"return"
|
|
|
|
|
(break_statement)
|
|
|
|
|
"goto"
|
2020-06-30 08:59:34 +02:00
|
|
|
] @keyword
|
2020-04-20 16:18:02 +02:00
|
|
|
|
|
|
|
|
;; Operators
|
2020-09-13 15:08:11 +02:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"not"
|
|
|
|
|
"and"
|
|
|
|
|
"or"
|
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
2020-06-30 08:59:34 +02:00
|
|
|
[
|
2020-08-11 10:04:34 +02:00
|
|
|
"="
|
2020-06-30 08:59:34 +02:00
|
|
|
"~="
|
|
|
|
|
"=="
|
|
|
|
|
"<="
|
|
|
|
|
">="
|
|
|
|
|
"<"
|
|
|
|
|
">"
|
|
|
|
|
"+"
|
|
|
|
|
"-"
|
|
|
|
|
"%"
|
|
|
|
|
"/"
|
|
|
|
|
"//"
|
|
|
|
|
"*"
|
|
|
|
|
"^"
|
|
|
|
|
"&"
|
|
|
|
|
"~"
|
|
|
|
|
"|"
|
|
|
|
|
">>"
|
|
|
|
|
"<<"
|
|
|
|
|
".."
|
|
|
|
|
"#"
|
|
|
|
|
] @operator
|
|
|
|
|
|
2020-08-11 10:04:34 +02:00
|
|
|
;; Punctuation
|
2020-09-05 09:27:13 -05:00
|
|
|
[ "," "." ":"] @punctuation.delimiter
|
2020-08-11 10:04:34 +02:00
|
|
|
|
2020-07-27 20:00:18 -05:00
|
|
|
;; Brackets
|
|
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|
2020-04-20 16:18:02 +02:00
|
|
|
|
2020-09-12 20:57:01 +02:00
|
|
|
;; Variables
|
|
|
|
|
(identifier) @variable
|
|
|
|
|
|
2020-04-20 16:18:02 +02:00
|
|
|
;; Constants
|
2020-06-30 08:59:34 +02:00
|
|
|
[
|
|
|
|
|
(false)
|
|
|
|
|
(true)
|
|
|
|
|
] @boolean
|
2020-05-07 09:23:33 +02:00
|
|
|
(nil) @constant.builtin
|
2020-04-20 19:13:24 +02:00
|
|
|
(spread) @constant ;; "..."
|
2020-04-20 16:18:02 +02:00
|
|
|
|
2020-08-03 21:40:23 -05:00
|
|
|
;; Functions
|
2020-09-08 17:59:16 +02:00
|
|
|
(function [(function_name) (identifier)] @function)
|
2020-09-08 19:07:55 +02:00
|
|
|
(function ["function" "end"] @keyword.function)
|
2020-09-08 17:59:16 +02:00
|
|
|
|
2020-11-25 21:26:31 +01:00
|
|
|
(local_function (identifier) @function)
|
2020-09-08 19:07:55 +02:00
|
|
|
(local_function ["function" "end"] @keyword.function)
|
2020-09-08 17:59:16 +02:00
|
|
|
|
2020-09-08 19:07:55 +02:00
|
|
|
(function_definition ["function" "end"] @keyword.function)
|
2020-06-30 08:59:34 +02:00
|
|
|
|
2020-09-05 09:27:13 -05:00
|
|
|
(property_identifier) @property
|
|
|
|
|
(method) @method
|
|
|
|
|
|
|
|
|
|
(function_call (identifier) @function . (arguments))
|
|
|
|
|
(function_call (field_expression (property_identifier) @function) . (arguments))
|
|
|
|
|
|
2020-10-21 10:16:05 +05:30
|
|
|
;; Parameters
|
|
|
|
|
(parameters
|
|
|
|
|
(identifier) @parameter)
|
|
|
|
|
|
2020-08-03 21:40:23 -05:00
|
|
|
;; Nodes
|
2020-06-30 08:59:34 +02:00
|
|
|
(table ["{" "}"] @constructor)
|
2020-04-20 16:18:02 +02:00
|
|
|
(comment) @comment
|
|
|
|
|
(string) @string
|
2020-04-20 19:13:24 +02:00
|
|
|
(number) @number
|
|
|
|
|
(label_statement) @label
|
2021-02-05 01:31:10 -05:00
|
|
|
(field (identifier) @field)
|
2020-11-25 21:26:31 +01:00
|
|
|
(shebang) @comment
|
2020-04-20 16:18:02 +02:00
|
|
|
|
|
|
|
|
;; Error
|
2020-08-03 19:43:17 -05:00
|
|
|
(ERROR) @error
|