-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added submodule * small changes * updated some stuff * remove * shallow clone * correct indent * shallow * ok * highlights * proper captures
- Loading branch information
1 parent
31f1455
commit ae3f936
Showing
5 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tree-sitter-lua
added at
6f5d40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
;;; Highlighting for lua | ||
|
||
;;; Builtins | ||
(self) @variable.builtin | ||
|
||
;; Keywords | ||
|
||
(if_statement | ||
[ | ||
"if" | ||
"then" | ||
"end" | ||
] @keyword.control.conditional) | ||
|
||
[ | ||
"else" | ||
"elseif" | ||
"then" | ||
] @keyword.control.conditional | ||
|
||
(for_statement | ||
[ | ||
"for" | ||
"do" | ||
"end" | ||
] @keyword.control.loop) | ||
|
||
(for_in_statement | ||
[ | ||
"for" | ||
"do" | ||
"end" | ||
] @keyword.control.loop) | ||
|
||
(while_statement | ||
[ | ||
"while" | ||
"do" | ||
"end" | ||
] @keyword.control.loop) | ||
|
||
(repeat_statement | ||
[ | ||
"repeat" | ||
"until" | ||
] @keyword.control.loop) | ||
|
||
(do_statement | ||
[ | ||
"do" | ||
"end" | ||
] @keyword) | ||
|
||
[ | ||
"in" | ||
"local" | ||
(break_statement) | ||
"goto" | ||
"return" | ||
] @keyword | ||
|
||
;; Operators | ||
|
||
[ | ||
"not" | ||
"and" | ||
"or" | ||
] @keyword.operator | ||
|
||
[ | ||
"=" | ||
"~=" | ||
"==" | ||
"<=" | ||
">=" | ||
"<" | ||
">" | ||
"+" | ||
"-" | ||
"%" | ||
"/" | ||
"//" | ||
"*" | ||
"^" | ||
"&" | ||
"~" | ||
"|" | ||
">>" | ||
"<<" | ||
".." | ||
"#" | ||
] @operator | ||
|
||
;; Punctuation | ||
["," "." ":" ";"] @punctuation.delimiter | ||
|
||
;; Brackets | ||
[ | ||
"(" | ||
")" | ||
"[" | ||
"]" | ||
"{" | ||
"}" | ||
] @punctuation.bracket | ||
|
||
; ;; Constants | ||
[ | ||
(false) | ||
(true) | ||
] @boolean | ||
(nil) @constant.builtin | ||
(spread) @constant ;; "..." | ||
((identifier) @constant | ||
(#match? @constant "^[A-Z][A-Z_0-9]*$")) | ||
|
||
;; Parameters | ||
(parameters | ||
(identifier) @parameter) | ||
|
||
; ;; Functions | ||
(function [(function_name) (identifier)] @function) | ||
(function ["function" "end"] @keyword.function) | ||
|
||
(function | ||
(function_name | ||
(function_name_field | ||
(property_identifier) @function .))) | ||
|
||
(local_function (identifier) @function) | ||
(local_function ["function" "end"] @keyword.function) | ||
|
||
(variable_declaration | ||
(variable_declarator (identifier) @function) (function_definition)) | ||
(local_variable_declaration | ||
(variable_declarator (identifier) @function) (function_definition)) | ||
|
||
(function_definition ["function" "end"] @keyword.function) | ||
|
||
(function_call | ||
[ | ||
((identifier) @variable (method) @method) | ||
((_) (method) @method) | ||
(identifier) @function | ||
(field_expression (property_identifier) @function) | ||
] | ||
. (arguments)) | ||
|
||
;; Nodes | ||
(table ["{" "}"] @constructor) | ||
(comment) @comment | ||
(string) @string | ||
(number) @number | ||
(label_statement) @label | ||
; A bit of a tricky one, this will only match field names | ||
(field . (identifier) @property (_)) | ||
(shebang) @comment | ||
|
||
;; Property | ||
(property_identifier) @property | ||
|
||
;; Variable | ||
(identifier) @variable | ||
|
||
;; Error | ||
(ERROR) @error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
indent = [ | ||
"function_definition", | ||
"variable_declaration", | ||
"local_variable_declaration", | ||
"field", | ||
"local_function", | ||
"function", | ||
"if_statement", | ||
"for_statement", | ||
"for_in_statement", | ||
"repeat_statement", | ||
"return_statement", | ||
"while_statement", | ||
"table", | ||
"arguments", | ||
"do_statement", | ||
] | ||
|
||
oudent = [ | ||
"end", | ||
"until", | ||
"}", | ||
")", | ||
] |