diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /queries/java | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'queries/java')
| -rw-r--r-- | queries/java/folds.scm | 8 | ||||
| -rw-r--r-- | queries/java/highlights.scm | 330 | ||||
| -rw-r--r-- | queries/java/indents.scm | 40 | ||||
| -rw-r--r-- | queries/java/injections.scm | 31 | ||||
| -rw-r--r-- | queries/java/locals.scm | 100 |
5 files changed, 0 insertions, 509 deletions
diff --git a/queries/java/folds.scm b/queries/java/folds.scm deleted file mode 100644 index 2cc143a78..000000000 --- a/queries/java/folds.scm +++ /dev/null @@ -1,8 +0,0 @@ -[ - (block) - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) - (import_declaration)+ -] @fold diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm deleted file mode 100644 index df9ca14d4..000000000 --- a/queries/java/highlights.scm +++ /dev/null @@ -1,330 +0,0 @@ -; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com) -; Variables -(identifier) @variable - -(underscore_pattern) @character.special - -; Methods -(method_declaration - name: (identifier) @function.method) - -(method_invocation - name: (identifier) @function.method.call) - -(super) @function.builtin - -; Parameters -(formal_parameter - name: (identifier) @variable.parameter) - -(spread_parameter - (variable_declarator - name: (identifier) @variable.parameter)) ; int... foo - -; Lambda parameter -(inferred_parameters - (identifier) @variable.parameter) ; (x,y) -> ... - -(lambda_expression - parameters: (identifier) @variable.parameter) ; x -> ... - -; Operators -[ - "+" - ":" - "++" - "-" - "--" - "&" - "&&" - "|" - "||" - "!" - "!=" - "==" - "*" - "/" - "%" - "<" - "<=" - ">" - ">=" - "=" - "-=" - "+=" - "*=" - "/=" - "%=" - "->" - "^" - "^=" - "&=" - "|=" - "~" - ">>" - ">>>" - "<<" - "::" -] @operator - -; Types -(interface_declaration - name: (identifier) @type) - -(annotation_type_declaration - name: (identifier) @type) - -(class_declaration - name: (identifier) @type) - -(record_declaration - name: (identifier) @type) - -(enum_declaration - name: (identifier) @type) - -(constructor_declaration - name: (identifier) @type) - -(compact_constructor_declaration - name: (identifier) @type) - -(type_identifier) @type - -((type_identifier) @type.builtin - (#eq? @type.builtin "var")) - -((method_invocation - object: (identifier) @type) - (#lua-match? @type "^[A-Z]")) - -((method_reference - . - (identifier) @type) - (#lua-match? @type "^[A-Z]")) - -((field_access - object: (identifier) @type) - (#lua-match? @type "^[A-Z]")) - -(scoped_identifier - (identifier) @type - (#lua-match? @type "^[A-Z]")) - -; Fields -(field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) - -(field_access - field: (identifier) @variable.member) - -[ - (boolean_type) - (integral_type) - (floating_point_type) - (void_type) -] @type.builtin - -; Variables -((identifier) @constant - (#lua-match? @constant "^[A-Z_][A-Z%d_]+$")) - -(this) @variable.builtin - -; Annotations -(annotation - "@" @attribute - name: (identifier) @attribute) - -(marker_annotation - "@" @attribute - name: (identifier) @attribute) - -; Literals -(string_literal) @string - -(escape_sequence) @string.escape - -(character_literal) @character - -[ - (hex_integer_literal) - (decimal_integer_literal) - (octal_integer_literal) - (binary_integer_literal) -] @number - -[ - (decimal_floating_point_literal) - (hex_floating_point_literal) -] @number.float - -[ - (true) - (false) -] @boolean - -(null_literal) @constant.builtin - -; Keywords -[ - "assert" - "default" - "extends" - "implements" - "instanceof" - "@interface" - "permits" - "to" - "with" -] @keyword - -[ - "record" - "class" - "enum" - "interface" -] @keyword.type - -(synchronized_statement - "synchronized" @keyword) - -[ - "abstract" - "final" - "native" - "non-sealed" - "open" - "private" - "protected" - "public" - "sealed" - "static" - "strictfp" - "transitive" -] @keyword.modifier - -(modifiers - "synchronized" @keyword.modifier) - -[ - "transient" - "volatile" -] @keyword.modifier - -[ - "return" - "yield" -] @keyword.return - -"new" @keyword.operator - -; Conditionals -[ - "if" - "else" - "switch" - "case" - "when" -] @keyword.conditional - -(ternary_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -; Loops -[ - "for" - "while" - "do" - "continue" - "break" -] @keyword.repeat - -; Includes -[ - "exports" - "import" - "module" - "opens" - "package" - "provides" - "requires" - "uses" -] @keyword.import - -(import_declaration - (asterisk - "*" @character.special)) - -; Punctuation -[ - ";" - "." - "..." - "," -] @punctuation.delimiter - -[ - "{" - "}" -] @punctuation.bracket - -[ - "[" - "]" -] @punctuation.bracket - -[ - "(" - ")" -] @punctuation.bracket - -(type_arguments - [ - "<" - ">" - ] @punctuation.bracket) - -(type_parameters - [ - "<" - ">" - ] @punctuation.bracket) - -(string_interpolation - [ - "\\{" - "}" - ] @punctuation.special) - -; Exceptions -[ - "throw" - "throws" - "finally" - "try" - "catch" -] @keyword.exception - -; Labels -(labeled_statement - (identifier) @label) - -; Comments -[ - (line_comment) - (block_comment) -] @comment @spell - -((block_comment) @comment.documentation - (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) - -((line_comment) @comment.documentation - (#lua-match? @comment.documentation "^///[^/]")) - -((line_comment) @comment.documentation - (#lua-match? @comment.documentation "^///$")) diff --git a/queries/java/indents.scm b/queries/java/indents.scm deleted file mode 100644 index 9e4d0a5e1..000000000 --- a/queries/java/indents.scm +++ /dev/null @@ -1,40 +0,0 @@ -; format-ignore -[ - ; ... refers to the portion that this indent query will have effects on - (class_body) ; { ... } of `class X` - (enum_body) ; { ... } of `enum X` - (interface_body) ; { ... } of `interface X` - (constructor_body) ; { `modifier` X() {...} } inside `class X` - (annotation_type_body) ; { ... } of `@interface X` - (block) ; { ... } that's not mentioned in this scope - (switch_block) ; { ... } in `switch X` - (array_initializer) ; [1, 2] - (argument_list) ; foo(...) - (formal_parameters) ; method foo(...) - (annotation_argument_list) ; @Annotation(...) - (element_value_array_initializer) ; { a, b } inside @Annotation() -] @indent.begin - -(expression_statement - (method_invocation) @indent.begin) - -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @indent.branch - -(annotation_argument_list - ")" @indent.end) ; This should be a special cased as `()` here doesn't have ending `;` - -"}" @indent.end - -(line_comment) @indent.ignore - -[ - (ERROR) - (block_comment) -] @indent.auto diff --git a/queries/java/injections.scm b/queries/java/injections.scm deleted file mode 100644 index 7728a0956..000000000 --- a/queries/java/injections.scm +++ /dev/null @@ -1,31 +0,0 @@ -([ - (block_comment) - (line_comment) -] @injection.content - (#set! injection.language "comment")) - -((block_comment) @injection.content - (#lua-match? @injection.content "/[*][*][%s]") - (#set! injection.language "javadoc")) - -; markdown-style javadocs https://openjdk.org/jeps/467 -((line_comment) @injection.content - (#lua-match? @injection.content "^///%s") - (#set! injection.language "javadoc")) - -((method_invocation - name: (identifier) @_method - arguments: (argument_list - . - (string_literal - . - (_) @injection.content))) - (#any-of? @_method "format" "printf") - (#set! injection.language "printf")) - -((method_invocation - object: (string_literal - (string_fragment) @injection.content) - name: (identifier) @_method) - (#eq? @_method "formatted") - (#set! injection.language "printf")) diff --git a/queries/java/locals.scm b/queries/java/locals.scm deleted file mode 100644 index 53e950908..000000000 --- a/queries/java/locals.scm +++ /dev/null @@ -1,100 +0,0 @@ -; SCOPES -; declarations -(program) @local.scope - -(class_declaration - body: (_) @local.scope) - -(record_declaration - body: (_) @local.scope) - -(enum_declaration - body: (_) @local.scope) - -(lambda_expression) @local.scope - -(enhanced_for_statement) @local.scope - -; block -(block) @local.scope - -; if/else -(if_statement) @local.scope ; if+else - -(if_statement - consequence: (_) @local.scope) ; if body in case there are no braces - -(if_statement - alternative: (_) @local.scope) ; else body in case there are no braces - -; try/catch -(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) - -(catch_clause) @local.scope ; needed because `Exception` variable - -; loops -(for_statement) @local.scope ; whole for_statement because loop iterator variable - -(for_statement - ; "for" body in case there are no braces - body: (_) @local.scope) - -(do_statement - body: (_) @local.scope) - -(while_statement - body: (_) @local.scope) - -; Functions -(constructor_declaration) @local.scope - -(method_declaration) @local.scope - -; DEFINITIONS -(package_declaration - (identifier) @local.definition.namespace) - -(class_declaration - name: (identifier) @local.definition.type) - -(record_declaration - name: (identifier) @local.definition.type) - -(enum_declaration - name: (identifier) @local.definition.enum) - -(method_declaration - name: (identifier) @local.definition.method) - -(local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) - -(enhanced_for_statement - ; for (var item : items) { - name: (identifier) @local.definition.var) - -(formal_parameter - name: (identifier) @local.definition.parameter) - -(catch_formal_parameter - name: (identifier) @local.definition.parameter) - -(inferred_parameters - (identifier) @local.definition.parameter) ; (x,y) -> ... - -(lambda_expression - parameters: (identifier) @local.definition.parameter) ; x -> ... - -((scoped_identifier - (identifier) @local.definition.import) - (#has-ancestor? @local.definition.import import_declaration)) - -(field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -; REFERENCES -(identifier) @local.reference - -(type_identifier) @local.reference |
