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/ada | |
| 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/ada')
| -rw-r--r-- | queries/ada/folds.scm | 23 | ||||
| -rw-r--r-- | queries/ada/highlights.scm | 388 | ||||
| -rw-r--r-- | queries/ada/locals.scm | 106 |
3 files changed, 336 insertions, 181 deletions
diff --git a/queries/ada/folds.scm b/queries/ada/folds.scm index b8b5735bb..8e3defac4 100644 --- a/queries/ada/folds.scm +++ b/queries/ada/folds.scm @@ -1,14 +1,13 @@ -;; Support for folding in Ada -;; za toggles folding a package, subprogram, if statement or loop - +; Support for folding in Ada +; za toggles folding a package, subprogram, if statement or loop [ - (package_declaration) - (generic_package_declaration) - (package_body) - (subprogram_body) - (block_statement) - (if_statement) - (loop_statement) - (gnatprep_declarative_if_statement) - (gnatprep_if_statement) + (package_declaration) + (generic_package_declaration) + (package_body) + (subprogram_body) + (block_statement) + (if_statement) + (loop_statement) + (gnatprep_declarative_if_statement) + (gnatprep_if_statement) ] @fold diff --git a/queries/ada/highlights.scm b/queries/ada/highlights.scm index a88935b2a..c15c4d9e3 100644 --- a/queries/ada/highlights.scm +++ b/queries/ada/highlights.scm @@ -1,190 +1,288 @@ -;; highlight queries. -;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries -;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations -;; for a list of recommended @ tags, though not all of them have matching -;; highlights in neovim. - +; highlight queries. +; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries +; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations +; for a list of recommended @ tags, though not all of them have matching +; highlights in neovim. [ - "abort" - "abs" - "abstract" - "accept" - "access" - "all" - "array" - "at" - "begin" - "declare" - "delay" - "delta" - "digits" - "do" - "end" - "entry" - "exit" - "generic" - "interface" - "is" - "limited" - "null" - "of" - "others" - "out" - "pragma" - "private" - "range" - "synchronized" - "tagged" - "task" - "terminate" - "until" - "when" + "abort" + "abs" + "abstract" + "accept" + "access" + "all" + "array" + "at" + "begin" + "declare" + "delay" + "delta" + "digits" + "do" + "end" + "entry" + "exit" + "generic" + "interface" + "is" + "limited" + "null" + "of" + "others" + "out" + "pragma" + "private" + "range" + "synchronized" + "tagged" + "task" + "terminate" + "until" + "when" ] @keyword + [ - "aliased" - "constant" - "renames" + "aliased" + "constant" + "renames" ] @keyword.storage + [ - "mod" - "new" - "protected" - "record" - "subtype" - "type" + "mod" + "new" + "protected" + "record" + "subtype" + "type" ] @keyword.type + [ - "with" - "use" + "with" + "use" ] @keyword.import + [ - "body" - "function" - "overriding" - "procedure" - "package" - "separate" + "body" + "function" + "overriding" + "procedure" + "package" + "separate" ] @keyword.function + [ - "and" - "in" - "not" - "or" - "xor" + "and" + "in" + "not" + "or" + "xor" ] @keyword.operator + [ - "while" - "loop" - "for" - "parallel" - "reverse" - "some" + "while" + "loop" + "for" + "parallel" + "reverse" + "some" ] @keyword.repeat + +"return" @keyword.return + [ - "return" -] @keyword.return -[ - "case" - "if" - "else" - "then" - "elsif" - "select" + "case" + "if" + "else" + "then" + "elsif" + "select" ] @keyword.conditional + [ - "exception" - "raise" + "exception" + "raise" ] @keyword.exception + (comment) @comment @spell + (string_literal) @string + (character_literal) @string + (numeric_literal) @number -;; Highlight the name of subprograms -(procedure_specification name: (_) @function) -(function_specification name: (_) @function) -(package_declaration name: (_) @function) -(package_body name: (_) @function) -(generic_instantiation name: (_) @function) -(entry_declaration . (identifier) @function) +; Highlight the name of subprograms +(procedure_specification + name: (_) @function) + +(function_specification + name: (_) @function) + +(package_declaration + name: (_) @function) + +(package_body + name: (_) @function) + +(generic_instantiation + name: (_) @function) + +(entry_declaration + . + (identifier) @function) + +; Some keywords should take different categories depending on the context +(use_clause + "use" @keyword.import + "type" @keyword.import) + +(with_clause + "private" @keyword.import) + +(with_clause + "limited" @keyword.import) + +(use_clause + (_) @module) + +(with_clause + (_) @module) + +(loop_statement + "end" @keyword.repeat) -;; Some keywords should take different categories depending on the context -(use_clause "use" @keyword.import "type" @keyword.import) -(with_clause "private" @keyword.import) -(with_clause "limited" @keyword.import) -(use_clause (_) @module) -(with_clause (_) @module) +(if_statement + "end" @keyword.conditional) -(loop_statement "end" @keyword.repeat) -(if_statement "end" @keyword.conditional) -(loop_parameter_specification "in" @keyword.repeat) -(loop_parameter_specification "in" @keyword.repeat) -(iterator_specification ["in" "of"] @keyword.repeat) -(range_attribute_designator "range" @keyword.repeat) +(loop_parameter_specification + "in" @keyword.repeat) -(raise_statement "with" @keyword.exception) +(loop_parameter_specification + "in" @keyword.repeat) -(gnatprep_declarative_if_statement) @keyword.directive -(gnatprep_if_statement) @keyword.directive -(gnatprep_identifier) @keyword.directive +(iterator_specification + [ + "in" + "of" + ] @keyword.repeat) -(subprogram_declaration "is" @keyword.function "abstract" @keyword.function) -(aspect_specification "with" @keyword.function) +(range_attribute_designator + "range" @keyword.repeat) -(full_type_declaration "is" @keyword.type) -(subtype_declaration "is" @keyword.type) -(record_definition "end" @keyword.type) -(full_type_declaration (_ "access" @keyword.type)) -(array_type_definition "array" @keyword.type "of" @keyword.type) -(access_to_object_definition "access" @keyword.type) -(access_to_object_definition "access" @keyword.type - [ - (general_access_modifier "constant" @keyword.type) - (general_access_modifier "all" @keyword.type) - ] -) -(range_constraint "range" @keyword.type) -(signed_integer_type_definition "range" @keyword.type) -(index_subtype_definition "range" @keyword.type) -(record_type_definition "abstract" @keyword.type) -(record_type_definition "tagged" @keyword.type) -(record_type_definition "limited" @keyword.type) -(record_type_definition (record_definition "null" @keyword.type)) -(private_type_declaration "is" @keyword.type "private" @keyword.type) -(private_type_declaration "tagged" @keyword.type) -(private_type_declaration "limited" @keyword.type) -(task_type_declaration "task" @keyword.type "is" @keyword.type) +(raise_statement + "with" @keyword.exception) -;; Gray the body of expression functions +(gnatprep_declarative_if_statement) @keyword.directive + +(gnatprep_if_statement) @keyword.directive + +(gnatprep_identifier) @keyword.directive + +(subprogram_declaration + "is" @keyword.function + "abstract" @keyword.function) + +(aspect_specification + "with" @keyword.function) + +(full_type_declaration + "is" @keyword.type) + +(subtype_declaration + "is" @keyword.type) + +(record_definition + "end" @keyword.type) + +(full_type_declaration + (_ + "access" @keyword.type)) + +(array_type_definition + "array" @keyword.type + "of" @keyword.type) + +(access_to_object_definition + "access" @keyword.type) + +(access_to_object_definition + "access" @keyword.type + [ + (general_access_modifier + "constant" @keyword.type) + (general_access_modifier + "all" @keyword.type) + ]) + +(range_constraint + "range" @keyword.type) + +(signed_integer_type_definition + "range" @keyword.type) + +(index_subtype_definition + "range" @keyword.type) + +(record_type_definition + "abstract" @keyword.type) + +(record_type_definition + "tagged" @keyword.type) + +(record_type_definition + "limited" @keyword.type) + +(record_type_definition + (record_definition + "null" @keyword.type)) + +(private_type_declaration + "is" @keyword.type + "private" @keyword.type) + +(private_type_declaration + "tagged" @keyword.type) + +(private_type_declaration + "limited" @keyword.type) + +(task_type_declaration + "task" @keyword.type + "is" @keyword.type) + +; Gray the body of expression functions (expression_function_declaration - (function_specification) - "is" - (_) @attribute -) -(subprogram_declaration (aspect_specification) @attribute) + (function_specification) + "is" + (_) @attribute) + +(subprogram_declaration + (aspect_specification) @attribute) -;; Highlight full subprogram specifications +; Highlight full subprogram specifications ;(subprogram_body ; [ ; (procedure_specification) ; (function_specification) ; ] @function.spec ;) - ((comment) @comment.documentation - . [ - (entry_declaration) - (subprogram_declaration) - (parameter_specification) - ]) + . + [ + (entry_declaration) + (subprogram_declaration) + (parameter_specification) + ]) -(compilation_unit - . (comment) @comment.documentation) +(compilation_unit + . + (comment) @comment.documentation) (component_list (component_declaration) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) -(enumeration_type_definition +(enumeration_type_definition (identifier) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) diff --git a/queries/ada/locals.scm b/queries/ada/locals.scm index 2d61b3123..bdfc38be8 100644 --- a/queries/ada/locals.scm +++ b/queries/ada/locals.scm @@ -1,33 +1,91 @@ -;; Better highlighting by referencing to the definition, for variable -;; references. However, this is not yet supported by neovim -;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables - +; Better highlighting by referencing to the definition, for variable +; references. However, this is not yet supported by neovim +; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables (compilation) @local.scope + (package_declaration) @local.scope + (package_body) @local.scope + (subprogram_declaration) @local.scope + (subprogram_body) @local.scope + (block_statement) @local.scope -(with_clause (identifier) @local.definition.import) -(procedure_specification name: (_) @local.definition.function) -(function_specification name: (_) @local.definition.function) -(package_declaration name: (_) @local.definition.var) -(package_body name: (_) @local.definition.var) -(generic_instantiation . name: (_) @local.definition.var) -(component_declaration . (identifier) @local.definition.var) -(exception_declaration . (identifier) @local.definition.var) -(formal_object_declaration . (identifier) @local.definition.var) -(object_declaration . (identifier) @local.definition.var) -(parameter_specification . (identifier) @local.definition.var) -(full_type_declaration . (identifier) @local.definition.type) -(private_type_declaration . (identifier) @local.definition.type) -(private_extension_declaration . (identifier) @local.definition.type) -(incomplete_type_declaration . (identifier) @local.definition.type) -(protected_type_declaration . (identifier) @local.definition.type) -(formal_complete_type_declaration . (identifier) @local.definition.type) -(formal_incomplete_type_declaration . (identifier) @local.definition.type) -(task_type_declaration . (identifier) @local.definition.type) -(subtype_declaration . (identifier) @local.definition.type) +(with_clause + (identifier) @local.definition.import) + +(procedure_specification + name: (_) @local.definition.function) + +(function_specification + name: (_) @local.definition.function) + +(package_declaration + name: (_) @local.definition.var) + +(package_body + name: (_) @local.definition.var) + +(generic_instantiation + . + name: (_) @local.definition.var) + +(component_declaration + . + (identifier) @local.definition.var) + +(exception_declaration + . + (identifier) @local.definition.var) + +(formal_object_declaration + . + (identifier) @local.definition.var) + +(object_declaration + . + (identifier) @local.definition.var) + +(parameter_specification + . + (identifier) @local.definition.var) + +(full_type_declaration + . + (identifier) @local.definition.type) + +(private_type_declaration + . + (identifier) @local.definition.type) + +(private_extension_declaration + . + (identifier) @local.definition.type) + +(incomplete_type_declaration + . + (identifier) @local.definition.type) + +(protected_type_declaration + . + (identifier) @local.definition.type) + +(formal_complete_type_declaration + . + (identifier) @local.definition.type) + +(formal_incomplete_type_declaration + . + (identifier) @local.definition.type) + +(task_type_declaration + . + (identifier) @local.definition.type) + +(subtype_declaration + . + (identifier) @local.definition.type) (identifier) @local.reference |
