mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(d)!: switch upstream parser to gdamore/tree-sitter-d
This commit is contained in:
parent
cbf0dfd92f
commit
76700e147b
8 changed files with 463 additions and 272 deletions
|
|
@ -205,7 +205,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [csv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
|
- [x] [csv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
|
||||||
- [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta)
|
- [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta)
|
||||||
- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq)
|
- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq)
|
||||||
- [x] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar)
|
- [x] [d](https://github.com/gdamore/tree-sitter-d) (maintained by @amaanq)
|
||||||
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho)
|
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho)
|
||||||
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
|
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
|
||||||
- [x] [dhall](https://github.com/jbellerb/tree-sitter-dhall) (maintained by @amaanq)
|
- [x] [dhall](https://github.com/jbellerb/tree-sitter-dhall) (maintained by @amaanq)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
"revision": "2df92e6755337e9234ad18ffef37f35d95e2ba9d"
|
"revision": "2df92e6755337e9234ad18ffef37f35d95e2ba9d"
|
||||||
},
|
},
|
||||||
"d": {
|
"d": {
|
||||||
"revision": "c2fbf21bd3aa45495fe13247e040ad5815250032"
|
"revision": "d9a1a2ed77017c23f715643f4739433a5ea7ab6f"
|
||||||
},
|
},
|
||||||
"dart": {
|
"dart": {
|
||||||
"revision": "f71e310a93010863f4b17a2a501ea8e2032c345b"
|
"revision": "f71e310a93010863f4b17a2a501ea8e2032c345b"
|
||||||
|
|
|
||||||
|
|
@ -346,13 +346,10 @@ list.cue = {
|
||||||
|
|
||||||
list.d = {
|
list.d = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/CyberShadow/tree-sitter-d",
|
url = "https://github.com/gdamore/tree-sitter-d",
|
||||||
files = { "src/parser.c", "src/scanner.cc" },
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
requires_generate_from_grammar = true,
|
|
||||||
},
|
},
|
||||||
-- Generating grammar takes ~60s
|
maintainers = { "@amaanq" },
|
||||||
experimental = true,
|
|
||||||
maintainers = { "@nawordar" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list.dart = {
|
list.dart = {
|
||||||
|
|
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
(block_statement) @fold
|
[
|
||||||
|
(block_statement)
|
||||||
|
(aggregate_body)
|
||||||
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,317 @@
|
||||||
; Misc
|
; Keywords
|
||||||
[
|
[
|
||||||
(line_comment)
|
(directive)
|
||||||
(block_comment)
|
(shebang)
|
||||||
(nesting_block_comment)
|
] @keyword.directive
|
||||||
] @comment @spell
|
|
||||||
|
|
||||||
((line_comment) @comment.documentation
|
[
|
||||||
(#lua-match? @comment.documentation "^///[^/]"))
|
(import)
|
||||||
|
(module)
|
||||||
|
] @keyword.import
|
||||||
|
|
||||||
((line_comment) @comment.documentation
|
[
|
||||||
(#lua-match? @comment.documentation "^///$"))
|
(alias)
|
||||||
|
(asm)
|
||||||
|
(class)
|
||||||
|
(delegate)
|
||||||
|
(delete)
|
||||||
|
(enum)
|
||||||
|
(interface)
|
||||||
|
(invariant)
|
||||||
|
(mixin)
|
||||||
|
(pragma)
|
||||||
|
(struct)
|
||||||
|
(template)
|
||||||
|
(union)
|
||||||
|
(unittest)
|
||||||
|
(version)
|
||||||
|
(with)
|
||||||
|
(traits)
|
||||||
|
(vector)
|
||||||
|
(parameters_)
|
||||||
|
(default)
|
||||||
|
(goto)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
((block_comment) @comment.documentation
|
(function) @keyword.function
|
||||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
|
||||||
|
|
||||||
((nesting_block_comment) @comment.documentation
|
(synchronized) @keyword.coroutine
|
||||||
(#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$"))
|
|
||||||
|
[
|
||||||
|
(if)
|
||||||
|
(else)
|
||||||
|
(switch)
|
||||||
|
(case)
|
||||||
|
(break)
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
(do)
|
||||||
|
(for)
|
||||||
|
(foreach)
|
||||||
|
(foreach_reverse)
|
||||||
|
(while)
|
||||||
|
(continue)
|
||||||
|
] @keyword.repeat
|
||||||
|
|
||||||
|
(return) @keyword.return
|
||||||
|
|
||||||
|
[
|
||||||
|
(abstract)
|
||||||
|
(deprecated)
|
||||||
|
(private)
|
||||||
|
(protected)
|
||||||
|
(public)
|
||||||
|
(package)
|
||||||
|
(immutable)
|
||||||
|
(final)
|
||||||
|
(const)
|
||||||
|
(override)
|
||||||
|
(static)
|
||||||
|
] @type.qualifier
|
||||||
|
|
||||||
|
[
|
||||||
|
(assert)
|
||||||
|
(try)
|
||||||
|
(catch)
|
||||||
|
(finally)
|
||||||
|
(throw)
|
||||||
|
(nothrow)
|
||||||
|
] @keyword.exception
|
||||||
|
|
||||||
|
[
|
||||||
|
(cast)
|
||||||
|
(new)
|
||||||
|
(in)
|
||||||
|
(is)
|
||||||
|
(not_in)
|
||||||
|
(not_is)
|
||||||
|
(typeid)
|
||||||
|
(typeof)
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
(lazy)
|
||||||
|
(align)
|
||||||
|
(extern)
|
||||||
|
(scope)
|
||||||
|
(ref)
|
||||||
|
(pure)
|
||||||
|
(export)
|
||||||
|
(shared)
|
||||||
|
(gshared)
|
||||||
|
(out)
|
||||||
|
(inout)
|
||||||
|
] @keyword.storage
|
||||||
|
|
||||||
|
(parameter_attribute
|
||||||
|
(return) @keyword.storage)
|
||||||
|
|
||||||
|
(parameter_attribute
|
||||||
|
(in) @keyword.storage)
|
||||||
|
|
||||||
|
(parameter_attribute
|
||||||
|
(out) @keyword.storage)
|
||||||
|
|
||||||
|
(debug) @keyword.debug
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
[
|
||||||
|
"/="
|
||||||
|
"/"
|
||||||
|
".."
|
||||||
|
"&"
|
||||||
|
"&="
|
||||||
|
"&&"
|
||||||
|
"|"
|
||||||
|
"|="
|
||||||
|
"||"
|
||||||
|
"-"
|
||||||
|
"-="
|
||||||
|
"--"
|
||||||
|
"+"
|
||||||
|
"+="
|
||||||
|
"++"
|
||||||
|
"<"
|
||||||
|
"<="
|
||||||
|
"<<"
|
||||||
|
"<<="
|
||||||
|
">"
|
||||||
|
">="
|
||||||
|
">>="
|
||||||
|
">>>="
|
||||||
|
">>"
|
||||||
|
">>>"
|
||||||
|
"!"
|
||||||
|
"!="
|
||||||
|
"$"
|
||||||
|
"="
|
||||||
|
"=="
|
||||||
|
"*"
|
||||||
|
"*="
|
||||||
|
"%"
|
||||||
|
"%="
|
||||||
|
"^"
|
||||||
|
"^="
|
||||||
|
"^^"
|
||||||
|
"^^="
|
||||||
|
"~"
|
||||||
|
"~="
|
||||||
|
"@"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
[
|
||||||
|
"exit"
|
||||||
|
"success"
|
||||||
|
"failure"
|
||||||
|
(this)
|
||||||
|
(super)
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
|
(linkage_attribute
|
||||||
|
"("
|
||||||
|
_ @variable.builtin
|
||||||
|
")")
|
||||||
|
|
||||||
|
; Modules
|
||||||
|
(module_fqn
|
||||||
|
(identifier) @module)
|
||||||
|
|
||||||
|
; Attributes
|
||||||
|
(at_attribute
|
||||||
|
(identifier) @attribute)
|
||||||
|
|
||||||
|
; Constants
|
||||||
|
(enum_member
|
||||||
|
(identifier) @constant)
|
||||||
|
|
||||||
|
(manifest_declarator
|
||||||
|
.
|
||||||
|
(identifier) @constant)
|
||||||
|
|
||||||
|
; Members
|
||||||
|
(aggregate_body
|
||||||
|
(variable_declaration
|
||||||
|
(declarator
|
||||||
|
(identifier) @variable.member)))
|
||||||
|
|
||||||
|
(property_expression
|
||||||
|
"."
|
||||||
|
(identifier) @variable.member)
|
||||||
|
|
||||||
|
(type
|
||||||
|
"."
|
||||||
|
(identifier) @variable.member)
|
||||||
|
|
||||||
|
; Types
|
||||||
|
(class_declaration
|
||||||
|
(class)
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
(struct)
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
(union_declaration
|
||||||
|
(union)
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
(enum_declaration
|
||||||
|
(enum)
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
(alias_declaration
|
||||||
|
(alias)
|
||||||
|
.
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#lua-match? @type "^[A-Z].*"))
|
||||||
|
|
||||||
|
(type
|
||||||
|
.
|
||||||
|
(identifier) @type .)
|
||||||
|
|
||||||
|
[
|
||||||
|
(auto)
|
||||||
|
(void)
|
||||||
|
(bool)
|
||||||
|
(byte)
|
||||||
|
(ubyte)
|
||||||
|
(char)
|
||||||
|
(short)
|
||||||
|
(ushort)
|
||||||
|
(wchar)
|
||||||
|
(dchar)
|
||||||
|
(int)
|
||||||
|
(uint)
|
||||||
|
(long)
|
||||||
|
(ulong)
|
||||||
|
(real)
|
||||||
|
(double)
|
||||||
|
(float)
|
||||||
|
(cent)
|
||||||
|
(ucent)
|
||||||
|
(ireal)
|
||||||
|
(idouble)
|
||||||
|
(ifloat)
|
||||||
|
(creal)
|
||||||
|
(double)
|
||||||
|
(cfloat)
|
||||||
|
] @type.builtin
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
(function_declaration
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
(type
|
||||||
|
(identifier) @function .))
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
(property_expression
|
||||||
|
(call_expression)
|
||||||
|
(identifier) @function .))
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
(parameter
|
||||||
|
(_)
|
||||||
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(function_literal
|
||||||
|
"("
|
||||||
|
(type
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
; Constructors
|
||||||
|
(constructor
|
||||||
|
(this) @constructor)
|
||||||
|
|
||||||
|
(destructor
|
||||||
|
(this) @constructor)
|
||||||
|
|
||||||
|
(postblit
|
||||||
|
.
|
||||||
|
(this) @constructor)
|
||||||
|
|
||||||
|
; Punctuation
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
"."
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
"=>"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
|
|
@ -26,250 +322,53 @@
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
"..." @punctuation.special
|
||||||
","
|
|
||||||
";"
|
; Ternaries
|
||||||
"."
|
(ternary_expression
|
||||||
":"
|
[
|
||||||
] @punctuation.delimiter
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
|
; Labels
|
||||||
|
(label
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
|
(goto_statement
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
(string_literal) @string
|
||||||
|
|
||||||
[
|
[
|
||||||
".."
|
(int_literal)
|
||||||
"$"
|
(float_literal)
|
||||||
] @punctuation.special
|
] @number
|
||||||
|
|
||||||
; Constants
|
(char_literal) @character
|
||||||
[
|
|
||||||
"__FILE_FULL_PATH__"
|
|
||||||
"__FILE__"
|
|
||||||
"__FUNCTION__"
|
|
||||||
"__LINE__"
|
|
||||||
"__MODULE__"
|
|
||||||
"__PRETTY_FUNCTION__"
|
|
||||||
] @constant.macro
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(wysiwyg_string)
|
(true)
|
||||||
(alternate_wysiwyg_string)
|
(false)
|
||||||
(double_quoted_string)
|
|
||||||
(hex_string)
|
|
||||||
(delimited_string)
|
|
||||||
(token_string)
|
|
||||||
] @string
|
|
||||||
|
|
||||||
(character_literal) @character
|
|
||||||
|
|
||||||
(integer_literal) @number
|
|
||||||
|
|
||||||
(float_literal) @number.float
|
|
||||||
|
|
||||||
[
|
|
||||||
"true"
|
|
||||||
"false"
|
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
; Functions
|
|
||||||
(func_declarator
|
|
||||||
(identifier) @function)
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"__traits"
|
(null)
|
||||||
"__vector"
|
(special_keyword)
|
||||||
"assert"
|
] @constant.builtin
|
||||||
"is"
|
|
||||||
"mixin"
|
|
||||||
"pragma"
|
|
||||||
"typeid"
|
|
||||||
] @function.builtin
|
|
||||||
|
|
||||||
(import_expression
|
; Comments
|
||||||
"import" @function.builtin)
|
(comment) @comment @spell
|
||||||
|
|
||||||
(parameter
|
((comment) @comment.documentation
|
||||||
(var_declarator
|
(#lua-match? @comment.documentation "^///[^/]"))
|
||||||
(identifier) @variable.parameter))
|
|
||||||
|
|
||||||
(function_literal
|
((comment) @comment.documentation
|
||||||
(identifier) @variable.parameter)
|
(#lua-match? @comment.documentation "^///$"))
|
||||||
|
|
||||||
(constructor
|
((comment) @comment.documentation
|
||||||
"this" @constructor)
|
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||||
|
|
||||||
(destructor
|
((comment) @comment.documentation
|
||||||
"this" @constructor)
|
(#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$"))
|
||||||
|
|
||||||
; Keywords
|
|
||||||
[
|
|
||||||
"case"
|
|
||||||
"default"
|
|
||||||
"else"
|
|
||||||
"if"
|
|
||||||
"switch"
|
|
||||||
] @keyword.conditional
|
|
||||||
|
|
||||||
[
|
|
||||||
"break"
|
|
||||||
"continue"
|
|
||||||
"do"
|
|
||||||
"for"
|
|
||||||
"foreach"
|
|
||||||
"foreach_reverse"
|
|
||||||
"while"
|
|
||||||
] @keyword.repeat
|
|
||||||
|
|
||||||
[
|
|
||||||
"__parameters"
|
|
||||||
"alias"
|
|
||||||
"align"
|
|
||||||
"asm"
|
|
||||||
"auto"
|
|
||||||
"body"
|
|
||||||
"class"
|
|
||||||
"debug"
|
|
||||||
"enum"
|
|
||||||
"export"
|
|
||||||
"goto"
|
|
||||||
"interface"
|
|
||||||
"invariant"
|
|
||||||
"macro"
|
|
||||||
"out"
|
|
||||||
"override"
|
|
||||||
"package"
|
|
||||||
"static"
|
|
||||||
"struct"
|
|
||||||
"template"
|
|
||||||
"union"
|
|
||||||
"unittest"
|
|
||||||
"version"
|
|
||||||
"with"
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
[
|
|
||||||
"delegate"
|
|
||||||
"function"
|
|
||||||
] @keyword.function
|
|
||||||
|
|
||||||
"return" @keyword.return
|
|
||||||
|
|
||||||
[
|
|
||||||
"cast"
|
|
||||||
"new"
|
|
||||||
] @keyword.operator
|
|
||||||
|
|
||||||
[
|
|
||||||
"+"
|
|
||||||
"++"
|
|
||||||
"+="
|
|
||||||
"-"
|
|
||||||
"--"
|
|
||||||
"-="
|
|
||||||
"*"
|
|
||||||
"*="
|
|
||||||
"%"
|
|
||||||
"%="
|
|
||||||
"^"
|
|
||||||
"^="
|
|
||||||
"^^"
|
|
||||||
"^^="
|
|
||||||
"/"
|
|
||||||
"/="
|
|
||||||
"|"
|
|
||||||
"|="
|
|
||||||
"||"
|
|
||||||
"~"
|
|
||||||
"~="
|
|
||||||
"="
|
|
||||||
"=="
|
|
||||||
"=>"
|
|
||||||
"<"
|
|
||||||
"<="
|
|
||||||
"<<"
|
|
||||||
"<<="
|
|
||||||
">"
|
|
||||||
">="
|
|
||||||
">>"
|
|
||||||
">>="
|
|
||||||
">>>"
|
|
||||||
">>>="
|
|
||||||
"!"
|
|
||||||
"!="
|
|
||||||
"&"
|
|
||||||
"&&"
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
[
|
|
||||||
"catch"
|
|
||||||
"finally"
|
|
||||||
"throw"
|
|
||||||
"try"
|
|
||||||
] @keyword.exception
|
|
||||||
|
|
||||||
"null" @constant.builtin
|
|
||||||
|
|
||||||
[
|
|
||||||
"__gshared"
|
|
||||||
"const"
|
|
||||||
"immutable"
|
|
||||||
"shared"
|
|
||||||
] @keyword.storage
|
|
||||||
|
|
||||||
[
|
|
||||||
"abstract"
|
|
||||||
"deprecated"
|
|
||||||
"extern"
|
|
||||||
"final"
|
|
||||||
"inout"
|
|
||||||
"lazy"
|
|
||||||
"nothrow"
|
|
||||||
"private"
|
|
||||||
"protected"
|
|
||||||
"public"
|
|
||||||
"pure"
|
|
||||||
"ref"
|
|
||||||
"scope"
|
|
||||||
"synchronized"
|
|
||||||
] @type.qualifier
|
|
||||||
|
|
||||||
(alias_assignment
|
|
||||||
.
|
|
||||||
(identifier) @type.definition)
|
|
||||||
|
|
||||||
(module_declaration
|
|
||||||
"module" @keyword.import)
|
|
||||||
|
|
||||||
(import_declaration
|
|
||||||
"import" @keyword.import)
|
|
||||||
|
|
||||||
(type) @type
|
|
||||||
|
|
||||||
(catch_parameter
|
|
||||||
(qualified_identifier) @type)
|
|
||||||
|
|
||||||
(var_declarations
|
|
||||||
(qualified_identifier) @type)
|
|
||||||
|
|
||||||
(func_declaration
|
|
||||||
(qualified_identifier) @type)
|
|
||||||
|
|
||||||
(parameter
|
|
||||||
(qualified_identifier) @type)
|
|
||||||
|
|
||||||
(class_declaration
|
|
||||||
(identifier) @type)
|
|
||||||
|
|
||||||
(fundamental_type) @type.builtin
|
|
||||||
|
|
||||||
(module_fully_qualified_name
|
|
||||||
(packages
|
|
||||||
(package_name) @module))
|
|
||||||
|
|
||||||
(module_name) @module
|
|
||||||
|
|
||||||
(at_attribute) @attribute
|
|
||||||
|
|
||||||
(user_defined_attribute
|
|
||||||
"@" @attribute)
|
|
||||||
|
|
||||||
; Variables
|
|
||||||
(primary_expression
|
|
||||||
"this" @variable.builtin)
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,24 @@
|
||||||
[
|
[
|
||||||
|
(parameters)
|
||||||
|
(template_parameters)
|
||||||
|
(expression_statement)
|
||||||
|
(aggregate_body)
|
||||||
|
(function_body)
|
||||||
|
(scope_statement)
|
||||||
(block_statement)
|
(block_statement)
|
||||||
(case_statement)
|
(case_statement)
|
||||||
(token_string)
|
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
|
(comment) @indent.auto
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
(case)
|
||||||
")"
|
(default)
|
||||||
"{"
|
|
||||||
"}"
|
"}"
|
||||||
"["
|
|
||||||
"]"
|
"]"
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
(line_comment)
|
(directive)
|
||||||
(block_comment)
|
(shebang)
|
||||||
(nesting_block_comment)
|
] @indent.zero
|
||||||
] @indent.ignore
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,18 @@
|
||||||
([
|
((comment) @injection.content
|
||||||
(line_comment)
|
|
||||||
(block_comment)
|
|
||||||
(nesting_block_comment)
|
|
||||||
] @injection.content
|
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
||||||
((token_string_tokens) @injection.content
|
((call_expression
|
||||||
(#set! injection.language "d"))
|
(type) @_printf
|
||||||
|
(arguments
|
||||||
|
"("
|
||||||
|
.
|
||||||
|
(expression
|
||||||
|
(string_literal) @injection.content)))
|
||||||
|
(#eq? @_printf "printf")
|
||||||
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
|
(#set! injection.language "printf"))
|
||||||
|
|
||||||
|
; TODO: uncomment when asm is added
|
||||||
|
; ((asm_inline) @injection.content
|
||||||
|
; (#set! injection.language "asm")
|
||||||
|
; (#set! injection.combined))
|
||||||
|
|
|
||||||
79
queries/d/locals.scm
Normal file
79
queries/d/locals.scm
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
; Scopes
|
||||||
|
[
|
||||||
|
(source_file)
|
||||||
|
(block_statement)
|
||||||
|
(aggregate_body)
|
||||||
|
] @local.scope
|
||||||
|
|
||||||
|
; References
|
||||||
|
(identifier) @local.reference
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
(module_def
|
||||||
|
(module_declaration
|
||||||
|
(module_fqn) @local.definition.namespace)
|
||||||
|
(#set! "definition.namespace.scope" "global"))
|
||||||
|
|
||||||
|
(enum_declaration
|
||||||
|
(enum_member
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.enum))
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
(class)
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.type)
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
(struct)
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.type)
|
||||||
|
|
||||||
|
(union_declaration
|
||||||
|
(union)
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.type)
|
||||||
|
|
||||||
|
(enum_declaration
|
||||||
|
(enum)
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.type)
|
||||||
|
|
||||||
|
(alias_declaration
|
||||||
|
(alias_initializer
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.type))
|
||||||
|
|
||||||
|
(constructor
|
||||||
|
(this) @local.definition.method)
|
||||||
|
|
||||||
|
(destructor
|
||||||
|
(this) @local.definition.method)
|
||||||
|
|
||||||
|
(postblit
|
||||||
|
(this) @local.definition.method)
|
||||||
|
|
||||||
|
(aggregate_body
|
||||||
|
(function_declaration
|
||||||
|
(identifier) @local.definition.method))
|
||||||
|
|
||||||
|
(manifest_declarator
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.constant)
|
||||||
|
|
||||||
|
(anonymous_enum_declaration
|
||||||
|
(enum_member
|
||||||
|
.
|
||||||
|
(identifier) @local.definition.constant))
|
||||||
|
|
||||||
|
(variable_declaration
|
||||||
|
(declarator
|
||||||
|
(identifier) @local.definition.var))
|
||||||
|
|
||||||
|
(aggregate_body
|
||||||
|
(variable_declaration
|
||||||
|
(declarator
|
||||||
|
(identifier) @local.definition.field)))
|
||||||
|
|
||||||
|
(function_declaration
|
||||||
|
(identifier) @local.definition.function)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue