mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 09:50:04 -04:00
feat(c_sharp): update parser & queries
This commit is contained in:
parent
fa1515b015
commit
6587d8e694
6 changed files with 183 additions and 74 deletions
|
|
@ -190,7 +190,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [bitbake](https://github.com/amaanq/tree-sitter-bitbake) (maintained by @amaanq)
|
- [x] [bitbake](https://github.com/amaanq/tree-sitter-bitbake) (maintained by @amaanq)
|
||||||
- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus)
|
- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus)
|
||||||
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @amaanq)
|
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @amaanq)
|
||||||
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @Luxed)
|
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @amaanq)
|
||||||
- [x] [cairo](https://github.com/amaanq/tree-sitter-cairo) (maintained by @amaanq)
|
- [x] [cairo](https://github.com/amaanq/tree-sitter-cairo) (maintained by @amaanq)
|
||||||
- [x] [capnp](https://github.com/amaanq/tree-sitter-capnp) (maintained by @amaanq)
|
- [x] [capnp](https://github.com/amaanq/tree-sitter-capnp) (maintained by @amaanq)
|
||||||
- [x] [chatito](https://github.com/ObserverOfTime/tree-sitter-chatito) (maintained by @ObserverOfTime)
|
- [x] [chatito](https://github.com/ObserverOfTime/tree-sitter-chatito) (maintained by @ObserverOfTime)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
"revision": "82fb86aa544843bd17a9f0f3dc16edf645a34349"
|
"revision": "82fb86aa544843bd17a9f0f3dc16edf645a34349"
|
||||||
},
|
},
|
||||||
"c_sharp": {
|
"c_sharp": {
|
||||||
"revision": "e1384e2f132936019b43aaaae154cd780fb497ce"
|
"revision": "f47328563999efb9d6438d8ea28999711fbe473f"
|
||||||
},
|
},
|
||||||
"cairo": {
|
"cairo": {
|
||||||
"revision": "6238f609bea233040fe927858156dee5515a0745"
|
"revision": "6238f609bea233040fe927858156dee5515a0745"
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ list.c_sharp = {
|
||||||
files = { "src/parser.c", "src/scanner.c" },
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
},
|
},
|
||||||
filetype = "cs",
|
filetype = "cs",
|
||||||
maintainers = { "@Luxed" },
|
maintainers = { "@amaanq" },
|
||||||
}
|
}
|
||||||
|
|
||||||
list.cairo = {
|
list.cairo = {
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,8 @@ initializer: (initializer_expression) @fold
|
||||||
|
|
||||||
[
|
[
|
||||||
(block)
|
(block)
|
||||||
|
(preproc_if)
|
||||||
|
(preproc_elif)
|
||||||
|
(preproc_else)
|
||||||
(using_directive)+
|
(using_directive)+
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
(identifier) @variable
|
[
|
||||||
|
(identifier)
|
||||||
|
(preproc_arg)
|
||||||
|
] @variable
|
||||||
|
|
||||||
|
((preproc_arg) @constant.macro
|
||||||
|
(#lua-match? @constant.macro "^[_A-Z][_A-Z0-9]*$"))
|
||||||
|
|
||||||
((identifier) @keyword
|
((identifier) @keyword
|
||||||
(#eq? @keyword "value")
|
(#eq? @keyword "value")
|
||||||
(#has-ancestor? @keyword accessor_declaration))
|
(#has-ancestor? @keyword accessor_declaration))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
|
||||||
(#eq? @variable.builtin "_"))
|
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
|
|
@ -14,8 +17,23 @@
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
|
returns: [
|
||||||
|
(identifier) @type
|
||||||
|
(generic_name
|
||||||
|
(identifier) @type)
|
||||||
|
])
|
||||||
|
|
||||||
|
(event_declaration
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(event_declaration
|
||||||
|
name: (identifier) @variable.member)
|
||||||
|
|
||||||
|
(event_field_declaration
|
||||||
|
(variable_declaration
|
||||||
|
(variable_declarator
|
||||||
|
name: (identifier) @variable.member)))
|
||||||
|
|
||||||
(declaration_pattern
|
(declaration_pattern
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
|
@ -46,11 +64,16 @@
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(namespace_declaration
|
(namespace_declaration
|
||||||
name: [
|
name: (identifier) @module)
|
||||||
(qualified_name
|
|
||||||
(identifier) @module)
|
(file_scoped_namespace_declaration
|
||||||
(identifier) @module
|
name: (identifier) @module)
|
||||||
])
|
|
||||||
|
(qualified_name
|
||||||
|
(identifier) @module
|
||||||
|
(#not-has-ancestor? @module method_declaration)
|
||||||
|
(#not-has-ancestor? @module record_declaration)
|
||||||
|
(#has-ancestor? @module namespace_declaration file_scoped_namespace_declaration))
|
||||||
|
|
||||||
(invocation_expression
|
(invocation_expression
|
||||||
(identifier) @function.method.call)
|
(identifier) @function.method.call)
|
||||||
|
|
@ -64,13 +87,16 @@
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier) @variable.member))
|
left: (identifier) @variable.member))
|
||||||
|
|
||||||
(parameter_list
|
(parameter
|
||||||
(parameter
|
name: (identifier) @variable.parameter)
|
||||||
name: (identifier) @variable.parameter))
|
|
||||||
|
|
||||||
(implicit_parameter_list
|
(parameter_list
|
||||||
(parameter
|
name: (identifier) @variable.parameter)
|
||||||
name: (identifier) @variable.parameter))
|
|
||||||
|
(bracketed_parameter_list
|
||||||
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(implicit_parameter) @variable.parameter
|
||||||
|
|
||||||
(parameter_list
|
(parameter_list
|
||||||
(parameter
|
(parameter
|
||||||
|
|
@ -82,6 +108,15 @@
|
||||||
|
|
||||||
(null_literal) @constant.builtin
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
|
(calling_convention
|
||||||
|
[
|
||||||
|
(identifier)
|
||||||
|
"Cdecl"
|
||||||
|
"Stdcall"
|
||||||
|
"Thiscall"
|
||||||
|
"Fastcall"
|
||||||
|
] @attribute.builtin)
|
||||||
|
|
||||||
(character_literal) @character
|
(character_literal) @character
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -93,7 +128,10 @@
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(boolean_literal) @boolean
|
[
|
||||||
|
"true"
|
||||||
|
"false"
|
||||||
|
] @boolean
|
||||||
|
|
||||||
(predefined_type) @type.builtin
|
(predefined_type) @type.builtin
|
||||||
|
|
||||||
|
|
@ -114,8 +152,7 @@
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(using_directive
|
(using_directive
|
||||||
(name_equals
|
(type) @type.definition)
|
||||||
(identifier) @type.definition))
|
|
||||||
|
|
||||||
(property_declaration
|
(property_declaration
|
||||||
name: (identifier) @property)
|
name: (identifier) @property)
|
||||||
|
|
@ -124,7 +161,16 @@
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
(nullable_type
|
(nullable_type
|
||||||
(identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(array_type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(ref_type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(pointer_type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
(catch_declaration
|
(catch_declaration
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
@ -138,15 +184,48 @@
|
||||||
(record_declaration
|
(record_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(enum_member_declaration
|
(enum_member_declaration
|
||||||
name: (identifier) @variable.member)
|
name: (identifier) @variable.member)
|
||||||
|
|
||||||
|
(operator_declaration
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(conversion_operator_declaration
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(explicit_interface_specifier
|
||||||
|
[
|
||||||
|
(identifier) @type
|
||||||
|
(generic_name
|
||||||
|
(identifier) @type)
|
||||||
|
])
|
||||||
|
|
||||||
|
(explicit_interface_specifier
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
(primary_constructor_base_type
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
[
|
||||||
|
"assembly"
|
||||||
|
"module"
|
||||||
|
"this"
|
||||||
|
"base"
|
||||||
|
(discard)
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
(constructor_declaration
|
(constructor_declaration
|
||||||
name: (identifier) @constructor)
|
name: (identifier) @constructor)
|
||||||
|
|
||||||
|
(destructor_declaration
|
||||||
|
name: (identifier) @constructor)
|
||||||
|
|
||||||
(constructor_initializer
|
(constructor_initializer
|
||||||
"base" @constructor)
|
"base" @constructor)
|
||||||
|
|
||||||
|
|
@ -157,7 +236,7 @@
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
; Generic Types.
|
; Generic Types.
|
||||||
(type_of_expression
|
(typeof_expression
|
||||||
(generic_name
|
(generic_name
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
|
|
||||||
|
|
@ -169,9 +248,13 @@
|
||||||
(generic_name
|
(generic_name
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
|
|
||||||
(type_constraint
|
(type_parameter_constraint
|
||||||
(generic_name
|
[
|
||||||
(identifier) @type))
|
(identifier) @type
|
||||||
|
(type
|
||||||
|
(generic_name
|
||||||
|
(identifier) @type))
|
||||||
|
])
|
||||||
|
|
||||||
(object_creation_expression
|
(object_creation_expression
|
||||||
(generic_name
|
(generic_name
|
||||||
|
|
@ -205,15 +288,26 @@
|
||||||
(type_parameter_list
|
(type_parameter_list
|
||||||
(type_parameter) @type)
|
(type_parameter) @type)
|
||||||
|
|
||||||
|
(type_parameter
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
(type_parameter_constraints_clause
|
(type_parameter_constraints_clause
|
||||||
target: (identifier) @type)
|
"where"
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
(attribute
|
(attribute
|
||||||
name: (identifier) @attribute)
|
name: (identifier) @attribute)
|
||||||
|
|
||||||
(for_each_statement
|
(foreach_statement
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(goto_statement
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
|
(labeled_statement
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
(tuple_element
|
(tuple_element
|
||||||
type: (identifier) @type)
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
|
@ -222,43 +316,48 @@
|
||||||
(declaration_expression
|
(declaration_expression
|
||||||
type: (identifier) @type)))
|
type: (identifier) @type)))
|
||||||
|
|
||||||
|
(cast_expression
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
|
(lambda_expression
|
||||||
|
type: (identifier) @type)
|
||||||
|
|
||||||
(as_expression
|
(as_expression
|
||||||
right: (identifier) @type)
|
right: (identifier) @type)
|
||||||
|
|
||||||
(type_of_expression
|
(typeof_expression
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(name_colon
|
(preproc_error) @keyword.exception
|
||||||
(identifier) @variable.parameter)
|
|
||||||
|
|
||||||
(warning_directive) @comment.warning
|
|
||||||
|
|
||||||
(error_directive) @keyword.exception
|
|
||||||
|
|
||||||
(define_directive
|
|
||||||
(identifier) @constant) @constant.macro
|
|
||||||
|
|
||||||
(undef_directive
|
|
||||||
(identifier) @constant) @constant.macro
|
|
||||||
|
|
||||||
(line_directive) @constant.macro
|
|
||||||
|
|
||||||
(line_directive
|
|
||||||
(preproc_integer_literal) @constant
|
|
||||||
(preproc_string_literal)? @string)
|
|
||||||
|
|
||||||
(pragma_directive
|
|
||||||
(identifier) @constant) @constant.macro
|
|
||||||
|
|
||||||
(pragma_directive
|
|
||||||
(preproc_string_literal) @string) @constant.macro
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(nullable_directive)
|
"#define"
|
||||||
(region_directive)
|
"#undef"
|
||||||
(endregion_directive)
|
] @keyword.directive.define
|
||||||
|
|
||||||
|
[
|
||||||
|
"#if"
|
||||||
|
"#elif"
|
||||||
|
"#else"
|
||||||
|
"#endif"
|
||||||
|
"#region"
|
||||||
|
"#endregion"
|
||||||
|
"#line"
|
||||||
|
"#pragma"
|
||||||
|
"#nullable"
|
||||||
|
"#error"
|
||||||
|
(shebang_directive)
|
||||||
|
] @keyword.directive
|
||||||
|
|
||||||
|
[
|
||||||
|
(preproc_line)
|
||||||
|
(preproc_pragma)
|
||||||
|
(preproc_nullable)
|
||||||
] @constant.macro
|
] @constant.macro
|
||||||
|
|
||||||
|
(preproc_pragma
|
||||||
|
(identifier) @constant)
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
|
|
@ -266,16 +365,15 @@
|
||||||
"break"
|
"break"
|
||||||
"case"
|
"case"
|
||||||
"when"
|
"when"
|
||||||
(if_directive)
|
|
||||||
(elif_directive)
|
|
||||||
(else_directive)
|
|
||||||
(endif_directive)
|
|
||||||
] @keyword.conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
(if_directive
|
(preproc_pragma
|
||||||
(identifier) @constant)
|
(identifier) @constant)
|
||||||
|
|
||||||
(elif_directive
|
(preproc_if
|
||||||
|
(identifier) @constant)
|
||||||
|
|
||||||
|
(preproc_if
|
||||||
(identifier) @constant)
|
(identifier) @constant)
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -335,6 +433,7 @@
|
||||||
"=>"
|
"=>"
|
||||||
"??"
|
"??"
|
||||||
"??="
|
"??="
|
||||||
|
".."
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -359,18 +458,14 @@
|
||||||
")"
|
")"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(interpolation_brace) @punctuation.special
|
||||||
|
|
||||||
(type_argument_list
|
(type_argument_list
|
||||||
[
|
[
|
||||||
"<"
|
"<"
|
||||||
">"
|
">"
|
||||||
] @punctuation.bracket)
|
] @punctuation.bracket)
|
||||||
|
|
||||||
[
|
|
||||||
(this_expression)
|
|
||||||
(base_expression)
|
|
||||||
"this"
|
|
||||||
] @variable.builtin
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"using"
|
"using"
|
||||||
"as"
|
"as"
|
||||||
|
|
@ -390,6 +485,9 @@
|
||||||
"or"
|
"or"
|
||||||
"not"
|
"not"
|
||||||
"stackalloc"
|
"stackalloc"
|
||||||
|
"__makeref"
|
||||||
|
"__reftype"
|
||||||
|
"__refvalue"
|
||||||
"in"
|
"in"
|
||||||
"out"
|
"out"
|
||||||
"ref"
|
"ref"
|
||||||
|
|
@ -413,8 +511,14 @@
|
||||||
"unchecked"
|
"unchecked"
|
||||||
"fixed"
|
"fixed"
|
||||||
"alias"
|
"alias"
|
||||||
|
"file"
|
||||||
|
"unsafe"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
(attribute_target_specifier
|
||||||
|
.
|
||||||
|
_ @keyword)
|
||||||
|
|
||||||
[
|
[
|
||||||
"enum"
|
"enum"
|
||||||
"record"
|
"record"
|
||||||
|
|
@ -438,9 +542,9 @@
|
||||||
"static"
|
"static"
|
||||||
"volatile"
|
"volatile"
|
||||||
"required"
|
"required"
|
||||||
] @keyword.modifier
|
"managed"
|
||||||
|
"unmanaged"
|
||||||
[
|
"notnull"
|
||||||
"abstract"
|
"abstract"
|
||||||
"private"
|
"private"
|
||||||
"protected"
|
"protected"
|
||||||
|
|
@ -449,9 +553,11 @@
|
||||||
"partial"
|
"partial"
|
||||||
"sealed"
|
"sealed"
|
||||||
"virtual"
|
"virtual"
|
||||||
|
"global"
|
||||||
] @keyword.modifier
|
] @keyword.modifier
|
||||||
|
|
||||||
(parameter_modifier) @operator
|
(scoped_type
|
||||||
|
"scoped" @keyword.modifier)
|
||||||
|
|
||||||
(query_expression
|
(query_expression
|
||||||
(_
|
(_
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
(declaration_expression
|
(declaration_expression
|
||||||
name: (identifier) @local.definition.var)
|
name: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(for_each_statement
|
(foreach_statement
|
||||||
left: (identifier) @local.definition.var)
|
left: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(for_each_statement
|
(foreach_statement
|
||||||
left: (tuple_pattern
|
left: (tuple_pattern
|
||||||
(identifier) @local.definition.var))
|
(identifier) @local.definition.var))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue