diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
| commit | 5a8dbc6347b3541e84fe669b22c17ad3b715e258 (patch) | |
| tree | b148c450939688caaaeb4adac6f2faa1eaffe649 /queries/lua.scm | |
| download | qwe-editor-5a8dbc6347b3541e84fe669b22c17ad3b715e258.tar.gz | |
Engage!
Diffstat (limited to 'queries/lua.scm')
| -rw-r--r-- | queries/lua.scm | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/queries/lua.scm b/queries/lua.scm new file mode 100644 index 0000000..f5c042c --- /dev/null +++ b/queries/lua.scm @@ -0,0 +1,172 @@ +;;; Highlighting for lua + +;;; Builtins +;; Keywords + +[(if_start) + (if_then) + (if_elseif) + (if_else) + (if_end)] @keyword.conditional + +[(for_start) + (for_in) + (for_do) + (for_end)] @keyword.repeat + +[(while_start) + (while_do) + (while_end)] @keyword.repeat + +[(repeat_start) + (repeat_until)] @keyword.repeat + +(break_statement) @keyword.repeat + +[(return_statement) + (module_return_statement)] @keyword.return + +[(do_start) + (do_end)] @keyword + +; [ +; "goto" +; ] @keyword + +;; Operators + +; TODO: I think I've made a bunch of these nodes. +; we might be able to just use those! + +[ + "not" + "and" + "or"] @keyword.operator + +["=" + "~=" + "==" + "<=" + ">=" + "<" + ">" + "+" + "-" + "%" + "/" + "//" + "*" + "^" + "&" + "~" + "|" + ">>" + "<<" + ".." + "#"] @operator + + + +;; Punctuation +["," "."] @punctuation.delimiter + +;; Brackets +[(left_paren) + (right_paren) + "[" + "]" + "{" + "}"] @punctuation.bracket + +;; Variables +(identifier) @variable +( + (identifier) @variable.builtin + (#match? @variable.builtin "self")) + +; (preproc_call +; directive: (preproc_directive) @_u +; argument: (_) @constant +; (#eq? @_u "#undef")) + +;; Constants +(boolean) @boolean +(nil) @constant.builtin +(ellipsis) @constant ;; "..." +(local) @keyword + +;; Functions +(function_call_paren) @function.bracket + +[ + (function_start) + (function_end)] @keyword.function + +(emmy_type) @type +(emmy_literal) @string +(emmy_parameter + (identifier) @parameter + description: (_)? @comment) @comment + +(emmy_class) @comment +(emmy_field name: (_) @property) @comment +(emmy_function_parameter + name: (_) @parameter) + +(emmy_type_dictionary_value key: (identifier) @property) + +(emmy_note) @comment +(emmy_see) @comment + +; TODO: Make the container so we can still highlight the beginning of the line +; (emmy_eval_container) @comment +; (_emmy_eval_container) @comment + +(emmy_return) @comment + +; TODO: returns + +(emmy_header) @comment +(emmy_ignore) @comment +(documentation_brief) @comment + +(documentation_command) @comment + +(function_call + [ + ((identifier)+ @identifier . (identifier) @function.call . (function_call_paren)) + ((identifier) @function.call.lua . (function_call_paren))]) + +(function_call + prefix: (identifier) @function.call.lua + args: (string_argument) @string) + +(function_call + prefix: (identifier) @function.call.lua + args: (table_argument)) + +; (function [(function_name) (identifier)] @function) +; (function ["function" "end"] @keyword.function) +; (local_function [(function_name) (identifier)] @function) +; (local_function ["function" "end"] @keyword.function) +; (function_definition ["function" "end"] @keyword.function) + +; TODO: Do I have replacements for these. +; (property_identifier) @property +; (method) @method + +; (function_call (identifier) @function . (arguments)) +; (function_call (field (property_identifier) @function) . (arguments)) + +;; Parameters +; (parameters (identifier) @parameter) + +;; Nodes +; (table ["{" "}"] @constructor) +(comment) @comment +(string) @string +(number) @number +; (label_statement) @label + +;; Error +(ERROR) @error
\ No newline at end of file |
