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/tiger | |
| 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/tiger')
| -rw-r--r-- | queries/tiger/folds.scm | 3 | ||||
| -rw-r--r-- | queries/tiger/highlights.scm | 65 | ||||
| -rw-r--r-- | queries/tiger/indents.scm | 64 | ||||
| -rw-r--r-- | queries/tiger/injections.scm | 3 | ||||
| -rw-r--r-- | queries/tiger/locals.scm | 14 |
5 files changed, 88 insertions, 61 deletions
diff --git a/queries/tiger/folds.scm b/queries/tiger/folds.scm index 24332a0f2..c74871bde 100644 --- a/queries/tiger/folds.scm +++ b/queries/tiger/folds.scm @@ -8,12 +8,9 @@ (let_expression) (function_declaration) (primitive_declaration) - (record_type) - (class_declaration) (class_type) (method_declaration) ] @fold - ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/highlights.scm b/queries/tiger/highlights.scm index 0516341c3..e77d80229 100644 --- a/queries/tiger/highlights.scm +++ b/queries/tiger/highlights.scm @@ -1,29 +1,20 @@ ; Built-ins {{{ ((function_call function: (identifier) @function.builtin) - (#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) + (#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring")) ((type_identifier) @type.builtin - (#any-of? @type.builtin "int" "string" "Object") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) + (#any-of? @type.builtin "int" "string" "Object")) ((identifier) @variable.builtin - (#eq? @variable.builtin "self") - ; FIXME: not supported by neovim - ; (#is-not? local) - ) -; }}} + (#eq? @variable.builtin "self")) +; }}} ; Keywords {{{ [ - "function" - "primitive" - "method" + "function" + "primitive" + "method" ] @keyword.function [ @@ -49,73 +40,79 @@ "then" "type" "var" - "class" "extends" - "_cast" "_chunks" "_exp" "_lvalue" "_namety" ] @keyword -; }}} +; }}} ; Operators {{{ (operator) @operator [ - "," - ";" - ":" - "." + "," + ";" + ":" + "." ] @punctuation.delimiter [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket -; }}} +; }}} ; Functions and methods {{{ (function_call function: (identifier) @function) + (function_declaration name: (identifier) @function) + (primitive_declaration name: (identifier) @function) (method_call method: (identifier) @function.method) + (method_declaration name: (identifier) @function.method) (parameters name: (identifier) @variable.parameter) -; }}} +; }}} ; Declarations {{{ (import_declaration file: (string_literal) @string.special.path) -; }}} +; }}} ; Literals {{{ (nil_literal) @constant.builtin + (integer_literal) @number + (string_literal) @string + (escape_sequence) @string.escape -; }}} +; }}} ; Misc {{{ (comment) @comment @spell (type_identifier) @type + (field_identifier) @property + (identifier) @variable -; }}} +; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/indents.scm b/queries/tiger/indents.scm index 6f6c80bae..686bfde16 100644 --- a/queries/tiger/indents.scm +++ b/queries/tiger/indents.scm @@ -1,70 +1,104 @@ ; Control flow {{{ (if_expression) @indent.begin + "then" @indent.branch + "else" @indent.branch (while_expression) @indent.begin + "do" @indent.branch (for_expression) @indent.begin + "to" @indent.branch -; }}} +; }}} ; Class {{{ (class_declaration) @indent.begin -(class_declaration "}" @indent.end) + +(class_declaration + "}" @indent.end) (class_type) @indent.begin -(class_type "}" @indent.end) -; }}} +(class_type + "}" @indent.end) + +; }}} ; Groups {{{ (let_expression) @indent.begin + "in" @indent.branch + "end" @indent.branch -(let_expression "end" @indent.end) + +(let_expression + "end" @indent.end) (sequence_expression) @indent.begin + ")" @indent.branch -(sequence_expression ")" @indent.end) -; }}} +(sequence_expression + ")" @indent.end) + +; }}} ; Functions and methods {{{ (parameters) @indent.begin -(parameters ")" @indent.end) + +(parameters + ")" @indent.end) (function_call) @indent.begin -(function_call ")" @indent.end) + +(function_call + ")" @indent.end) + (method_call) @indent.begin + ")" @indent.branch (function_declaration) @indent.begin + (primitive_declaration) @indent.begin + (method_declaration) @indent.begin -; }}} +; }}} ; Values and expressions {{{ (array_value) @indent.begin + "]" @indent.branch -(array_value "]" @indent.end) + +(array_value + "]" @indent.end) (array_expression) @indent.begin + "of" @indent.branch (record_expression) @indent.begin + "}" @indent.branch -(record_expression "}" @indent.end) + +(record_expression + "}" @indent.end) (record_type) @indent.begin + "}" @indent.branch -(record_type "}" @indent.end) + +(record_type + "}" @indent.end) (variable_declaration) @indent.begin -; }}} +; }}} ; Misc{{{ (comment) @indent.ignore + (string_literal) @indent.ignore -; }}} +; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/injections.scm b/queries/tiger/injections.scm index b0063012c..5dfaa7aeb 100644 --- a/queries/tiger/injections.scm +++ b/queries/tiger/injections.scm @@ -1,4 +1,3 @@ ((comment) @injection.content - (#set! injection.language "comment")) - + (#set! injection.language "comment")) ; vim: sw=2 foldmethod=marker diff --git a/queries/tiger/locals.scm b/queries/tiger/locals.scm index df26bb2a0..f010dd0e8 100644 --- a/queries/tiger/locals.scm +++ b/queries/tiger/locals.scm @@ -3,15 +3,14 @@ ; top-to-bottom). ; ; [1]: https://github.com/tree-sitter/tree-sitter/issues/918 - ; Scopes {{{ [ - (for_expression) - (let_expression) - (function_declaration) + (for_expression) + (let_expression) + (function_declaration) ] @local.scope -; }}} +; }}} ; Definitions {{{ (type_declaration name: (identifier) @local.definition.type @@ -23,6 +22,7 @@ (function_declaration name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) + (primitive_declaration name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) @@ -30,10 +30,10 @@ (variable_declaration name: (identifier) @local.definition.var (#set! "definition.var.scope" "parent")) -; }}} +; }}} ; References {{{ (identifier) @local.reference -; }}} +; }}} ; vim: sw=2 foldmethod=marker |
