From 50df92481103ec4b2d2549eebc0dcbae73ed8a20 Mon Sep 17 00:00:00 2001 From: EmmChriss Date: Fri, 15 Apr 2022 18:35:23 +0300 Subject: gdscript support (#1985) --- runtime/queries/gdscript/highlights.scm | 93 +++++++++++++++++++++++++++++++++ runtime/queries/gdscript/indents.scm | 26 +++++++++ runtime/queries/gdscript/tags.scm | 5 ++ 3 files changed, 124 insertions(+) create mode 100644 runtime/queries/gdscript/highlights.scm create mode 100644 runtime/queries/gdscript/indents.scm create mode 100644 runtime/queries/gdscript/tags.scm (limited to 'runtime/queries') diff --git a/runtime/queries/gdscript/highlights.scm b/runtime/queries/gdscript/highlights.scm new file mode 100644 index 00000000..0849eedb --- /dev/null +++ b/runtime/queries/gdscript/highlights.scm @@ -0,0 +1,93 @@ +; Identifier naming conventions + +((identifier) @constant + (#match? @constant "^[A-Z][A-Z_]*$")) + +; Function calls + +(attribute_call (identifier) @function) + +(base_call (identifier) @function) + +(call (identifier) @function) + +; Function definitions + +(function_definition (name) @function) + +(constructor_definition "_init" @function) + +;; Literals +(integer) @constant.numeric.integer +(float) @constant.numeric.float +(comment) @comment +(string) @string +(escape_sequence) @constant.character.escape +(identifier) @variable +(type) @type + +;; Literals +[ + (true) + (false) + (null) +] @constant.builtin + +[ + "+" + "-" + "*" + "/" + "%" + "==" + "!=" + ">" + "<" + ">=" + "<=" + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "&" + "|" + "^" + "~" + "<<" + ">>" + "and" + "or" + "not" +] @operator + +[ + (static_keyword) + (remote_keyword) + (tool_statement) + "var" + "func" + "setget" + "in" + "is" + "as" + "if" + "else" + "elif" + "while" + "for" + "return" + "break" + "continue" + "pass" + "match" + "class" + "class_name" + "enum" + "signal" + "onready" + "export" + "extends" + "const" +] @keyword diff --git a/runtime/queries/gdscript/indents.scm b/runtime/queries/gdscript/indents.scm new file mode 100644 index 00000000..01439e1c --- /dev/null +++ b/runtime/queries/gdscript/indents.scm @@ -0,0 +1,26 @@ +[ + (_compound_statement) + (match_statement) + (parenthesized_expression) + + (pattern_array) + (pattern_dictionary) + (argument_list) + (binary_operator) + + (parameters) + (body) + (enumerator_list) + + (function_definition) + (constructor_definition) + (class_definition) +] @indent + +[ + ")", + "]", + "}", + (return_statement) + (pass_statement) +] @outdent diff --git a/runtime/queries/gdscript/tags.scm b/runtime/queries/gdscript/tags.scm new file mode 100644 index 00000000..05796fdf --- /dev/null +++ b/runtime/queries/gdscript/tags.scm @@ -0,0 +1,5 @@ +(class_definition (name) @name) @definition.class + +(function_definition (name) @name) @definition.function + +(call (name) @name) @reference.call \ No newline at end of file -- cgit v1.2.3-70-g09d2