mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add cue
This commit is contained in:
parent
d7cef15b01
commit
376d74006f
8 changed files with 237 additions and 0 deletions
|
|
@ -196,6 +196,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [cpp](https://github.com/tree-sitter/tree-sitter-cpp) (maintained by @theHamsta)
|
||||
- [x] [css](https://github.com/tree-sitter/tree-sitter-css) (maintained by @TravonteD)
|
||||
- [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] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar)
|
||||
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho)
|
||||
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@
|
|||
"cuda": {
|
||||
"revision": "91c3ca3e42326e0f7b83c82765940bbf7f91c847"
|
||||
},
|
||||
"cue": {
|
||||
"revision": "4ffcda8c2bdfee1c2ba786cd503d0508ea92cca2"
|
||||
},
|
||||
"d": {
|
||||
"revision": "c2fbf21bd3aa45495fe13247e040ad5815250032"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -271,6 +271,14 @@ list.cuda = {
|
|||
maintainers = { "@theHamsta" },
|
||||
}
|
||||
|
||||
list.cue = {
|
||||
install_info = {
|
||||
url = "https://github.com/eonpatapon/tree-sitter-cue",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
},
|
||||
maintainers = { "@amaanq" },
|
||||
}
|
||||
|
||||
list.d = {
|
||||
install_info = {
|
||||
url = "https://github.com/CyberShadow/tree-sitter-d",
|
||||
|
|
|
|||
5
queries/cue/folds.scm
Normal file
5
queries/cue/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(import_spec_list)
|
||||
(field)
|
||||
(string)
|
||||
] @fold
|
||||
164
queries/cue/highlights.scm
Normal file
164
queries/cue/highlights.scm
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
; Includes
|
||||
|
||||
[
|
||||
"package"
|
||||
"import"
|
||||
] @include
|
||||
|
||||
; Namespaces
|
||||
|
||||
(package_identifier) @namespace
|
||||
|
||||
(import_spec ["." "_"] @punctuation.special)
|
||||
|
||||
[
|
||||
(attr_path)
|
||||
(package_path)
|
||||
] @text.uri ;; In attributes
|
||||
|
||||
; Attributes
|
||||
|
||||
(attribute) @attribute
|
||||
|
||||
; Conditionals
|
||||
|
||||
"if" @conditional
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"for"
|
||||
] @repeat
|
||||
|
||||
(for_clause "_" @punctuation.special)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"let"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"in"
|
||||
] @keyword.operator
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"|"
|
||||
"&"
|
||||
"||"
|
||||
"&&"
|
||||
"=="
|
||||
"!="
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"=~"
|
||||
"!~"
|
||||
"!"
|
||||
"="
|
||||
] @operator
|
||||
|
||||
; Fields & Properties
|
||||
|
||||
(field
|
||||
(label
|
||||
(identifier) @field))
|
||||
|
||||
(selector_expression
|
||||
(_)
|
||||
(identifier) @property)
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
(_)
|
||||
(identifier) @function.call))
|
||||
(call_expression
|
||||
function: (builtin_function) @function.call)
|
||||
|
||||
(builtin_function) @function.builtin
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Types
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((identifier) @type
|
||||
(#match? @type "^(#|_#)"))
|
||||
|
||||
[
|
||||
(slice_type)
|
||||
(pointer_type)
|
||||
] @type ;; In attributes
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "<" ">" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
(ellipsis)
|
||||
"?"
|
||||
] @punctuation.special
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
|
||||
[
|
||||
(escape_char)
|
||||
(escape_unicode)
|
||||
] @string.escape
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @float
|
||||
|
||||
(si_unit
|
||||
(float)
|
||||
(_) @symbol)
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
[
|
||||
(null)
|
||||
(top)
|
||||
(bottom)
|
||||
] @constant.builtin
|
||||
|
||||
; Interpolations
|
||||
|
||||
(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none
|
||||
|
||||
(interpolation "\\(" (identifier) @variable ")")
|
||||
|
||||
; Commments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
21
queries/cue/indents.scm
Normal file
21
queries/cue/indents.scm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[
|
||||
(import_spec_list)
|
||||
(field)
|
||||
] @indent
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent_end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
1
queries/cue/injections.scm
Normal file
1
queries/cue/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment
|
||||
34
queries/cue/locals.scm
Normal file
34
queries/cue/locals.scm
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(source_file)
|
||||
(field)
|
||||
(for_clause)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(import_spec
|
||||
path: (string) @definition.import)
|
||||
|
||||
(field
|
||||
(label
|
||||
(identifier) @definition.field))
|
||||
|
||||
(package_identifier) @definition.namespace
|
||||
|
||||
(for_clause
|
||||
(identifier) @definition.variable
|
||||
(expression))
|
||||
|
||||
(for_clause
|
||||
(identifier)
|
||||
(identifier) @definition.variable
|
||||
(expression))
|
||||
|
||||
(let_clause
|
||||
(identifier) @definition.variable)
|
||||
Loading…
Add table
Add a link
Reference in a new issue