diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-06 15:05:50 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch) | |
| tree | 70bf645539882b88e6fa129cefd30986b89bbac3 /queries/squirrel | |
| parent | ci: add query lint job (diff) | |
| download | nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2 nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip | |
chore: query formatting
Diffstat (limited to 'queries/squirrel')
| -rw-r--r-- | queries/squirrel/folds.scm | 4 | ||||
| -rw-r--r-- | queries/squirrel/highlights.scm | 123 | ||||
| -rw-r--r-- | queries/squirrel/indents.scm | 25 | ||||
| -rw-r--r-- | queries/squirrel/injections.scm | 2 | ||||
| -rw-r--r-- | queries/squirrel/locals.scm | 44 |
5 files changed, 114 insertions, 84 deletions
diff --git a/queries/squirrel/folds.scm b/queries/squirrel/folds.scm index db0b9c581..c2903cc66 100644 --- a/queries/squirrel/folds.scm +++ b/queries/squirrel/folds.scm @@ -3,18 +3,14 @@ (function_declaration) (member_declaration) (enum_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (string) (verbatim_string) - (comment) - (if_statement) (else_statement) (while_statement) diff --git a/queries/squirrel/highlights.scm b/queries/squirrel/highlights.scm index e7ac9150e..66bc2247c 100644 --- a/queries/squirrel/highlights.scm +++ b/queries/squirrel/highlights.scm @@ -1,5 +1,4 @@ ; Keywords - [ "class" "clone" @@ -11,9 +10,7 @@ "var" ] @keyword -[ - "function" -] @keyword.function +"function" @keyword.function [ "in" @@ -27,12 +24,11 @@ ] @keyword.return ((global_variable - "::" - (_) @keyword.coroutine) + "::" + (_) @keyword.coroutine) (#any-of? @keyword.coroutine "suspend" "newthread")) ; Conditionals - [ "if" "else" @@ -43,7 +39,6 @@ ] @keyword.conditional ; Repeats - [ "for" "foreach" @@ -53,7 +48,6 @@ ] @keyword.repeat ; Exceptions - [ "try" "catch" @@ -61,26 +55,21 @@ ] @keyword.exception ; Storageclasses - -[ - "local" -] @keyword.storage +"local" @keyword.storage ; Qualifiers - [ "static" "const" ] @type.qualifier ; Variables - -(identifier) @variable +(identifier) @variable (local_declaration (identifier) @variable.local - . "=") - + . + "=") (global_variable) @variable.global @@ -88,58 +77,76 @@ (#any-of? @variable.builtin "base" "this" "vargv")) ; Parameters - (parameter - . (identifier) @variable.parameter) + . + (identifier) @variable.parameter) ; Properties (Slots) - (deref_expression "." - . (identifier) @property) + . + (identifier) @property) (member_declaration (identifier) @property - . "=") + . + "=") ((table_slot - . (identifier) @property - . ["=" ":"]) + . + (identifier) @property + . + [ + "=" + ":" + ]) (#set! "priority" 105)) ; Types - ((identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) (class_declaration (identifier) @type - "extends"? . (identifier)? @type) + "extends"? + . + (identifier)? @type) (enum_declaration (identifier) @type) ; Attributes - (attribute_declaration left: (identifier) @attribute) ; Functions & Methods - (member_declaration (function_declaration - "::"? (_) @function.method . "(" (_)? ")")) + "::"? + (_) @function.method + . + "(" + (_)? + ")")) ((function_declaration - "::"? (_) @function . "(" (_)? ")") + "::"? + (_) @function + . + "(" + (_)? + ")") (#not-has-ancestor? @function member_declaration)) (call_expression function: (identifier) @function.call) (call_expression - function: (deref_expression - "." . (identifier) @function.call)) + function: + (deref_expression + "." + . + (identifier) @function.call)) (call_expression (global_variable @@ -152,11 +159,17 @@ (lambda_expression "@" @string.special.symbol)) -(call_expression +(call_expression [ - function: (identifier) @function.builtin - function: (global_variable "::" (_) @function.builtin) - function: (deref_expression "." (_) @function.builtin) + function: (identifier) @function.builtin + function: + (global_variable + "::" + (_) @function.builtin) + function: + (deref_expression + "." + (_) @function.builtin) ] ; format-ignore (#any-of? @function.builtin @@ -206,20 +219,20 @@ "constructor" @constructor) ; Constants - (const_declaration "const" - . (identifier) @constant) + . + (identifier) @constant) (enum_declaration "{" - . (identifier) @constant) + . + (identifier) @constant) ((identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ; Operators - [ "+" "-" @@ -255,14 +268,25 @@ ] @operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "</" "/>" ] @punctuation.bracket +[ + "</" + "/>" +] @punctuation.bracket [ "." @@ -277,13 +301,11 @@ ] @punctuation.special ; Ternaries - (ternary_expression "?" @keyword.conditional.ternary ":" @keyword.conditional.ternary) ; Literals - (string) @string (verbatim_string) @string.special @@ -301,7 +323,6 @@ (null) @constant.builtin ; Comments - (comment) @comment @spell ((comment) @comment.documentation diff --git a/queries/squirrel/indents.scm b/queries/squirrel/indents.scm index 0dbbab416..00245d6ae 100644 --- a/queries/squirrel/indents.scm +++ b/queries/squirrel/indents.scm @@ -2,13 +2,11 @@ (class_declaration) (function_declaration) (enum_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (while_statement) (switch_statement) (for_statement) @@ -17,10 +15,9 @@ (catch_statement) ] @indent.begin -( - (if_statement) - (ERROR "else") @indent.begin -) +((if_statement) + (ERROR + "else") @indent.begin) (if_statement condition: (_) @indent.begin) @@ -37,11 +34,20 @@ (_) @indent.begin (catch_statement) @indent.begin) -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ "}" @@ -52,7 +58,6 @@ [ (ERROR) (comment) - (string) (verbatim_string) ] @indent.auto diff --git a/queries/squirrel/injections.scm b/queries/squirrel/injections.scm index 34a0fce8b..ee864ca6f 100644 --- a/queries/squirrel/injections.scm +++ b/queries/squirrel/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((verbatim_string) @injection.content (#lua-match? @injection.content "^@\"<html") diff --git a/queries/squirrel/locals.scm b/queries/squirrel/locals.scm index 3e3b9da3e..3858eb6b0 100644 --- a/queries/squirrel/locals.scm +++ b/queries/squirrel/locals.scm @@ -1,18 +1,15 @@ ; Scopes - [ (script) (class_declaration) (enum_declaration) (function_declaration) (attribute_declaration) - (array) (block) (table) (anonymous_function) (parenthesized_expression) - (if_statement) (else_statement) (while_statement) @@ -24,44 +21,55 @@ (catch_statement) ] @local.scope - ; References - [ (identifier) (global_variable) ] @local.reference ; Definitions - (const_declaration - . (identifier) @local.definition.constant) + . + (identifier) @local.definition.constant) (enum_declaration - . (identifier) @local.definition.enum) + . + (identifier) @local.definition.enum) (member_declaration - (identifier) @local.definition.field - . "=") + (identifier) @local.definition.field + . + "=") (table_slot - . (identifier) @local.definition.field - . ["=" ":"]) + . + (identifier) @local.definition.field + . + [ + "=" + ":" + ]) ((function_declaration - . (identifier) @local.definition.function) + . + (identifier) @local.definition.function) (#not-has-ancestor? @local.definition.function member_declaration)) (member_declaration (function_declaration - . (identifier) @local.definition.method)) + . + (identifier) @local.definition.method)) (class_declaration - . (identifier) @local.definition.type) + . + (identifier) @local.definition.type) (var_statement - "var" . (identifier) @local.definition.variable) + "var" + . + (identifier) @local.definition.variable) (local_declaration - (identifier) @local.definition.variable - . "=") + (identifier) @local.definition.variable + . + "=") |
