Update cue parser and queries

Queries ported from nvim-treesitter
pull/9458/head
Michael Davis 2 months ago
parent 400a1930ad
commit f3a46c8751
No known key found for this signature in database

@ -2351,7 +2351,7 @@ formatter = { command = "cue", args = ["fmt", "-"] }
[[grammar]] [[grammar]]
name = "cue" name = "cue"
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" } source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" }
[[language]] [[language]]
name = "slint" name = "slint"

@ -1,12 +1,46 @@
(package_clause "package" @keyword.control.import) ; Includes
[
"package"
"import"
] @keyword.control.import
; Namespaces
(package_identifier) @namespace (package_identifier) @namespace
(import_declaration "import" @keyword.control.import) (import_spec
[
"."
"_"
] @punctuation.special)
[ [
"!" (attr_path)
(package_path)
] @string.special.url ; In attributes
; Attributes
(attribute) @attribute
; Conditionals
"if" @keyword.control.conditional
; Repeats
"for" @keyword.control.repeat
(for_clause
"_" @punctuation.special)
; Keywords
"let" @keyword
"in" @keyword.operator
; Operators
[
"+"
"-"
"*" "*"
"/"
"|" "|"
"&" "&"
"||" "||"
@ -19,100 +53,103 @@
">=" ">="
"=~" "=~"
"!~" "!~"
"+" "!"
"-" "="
"*"
"/"
] @operator ] @operator
(unary_expression "*" @operator) ; Fields & Properties
(field
(unary_expression "=~" @operator.regexp) (label
(identifier) @variable.other.member))
(unary_expression "!~" @operator.regexp)
(binary_expression _ "&" @operator.unify _)
(binary_expression _ "|" @operator.disjunct _)
(builtin) @function.builtin (selector_expression
(_)
(identifier) @variable.other.member)
(qualified_identifier) @function.builtin ; Functions
(call_expression
function: (identifier) @function)
(let_clause "let" @keyword.storage.type) (call_expression
function: (selector_expression
(_)
(identifier) @function))
(for_clause "for" @keyword.control.repeat) (call_expression
(for_clause "in" @keyword.control.repeat) function: (builtin_function) @function)
(guard_clause "if" @keyword.control.conditional) (builtin_function) @function.builtin
(comment) @comment ; Variables
(identifier) @variable
[ ; Types
(string_type) (primitive_type) @type.builtin
(simple_string_lit)
(multiline_string_lit)
(bytes_type)
(simple_bytes_lit)
(multiline_bytes_lit)
] @string
[ ((identifier) @type
(number_type) (#match? @type "^_?#"))
(int_lit)
(int_type)
(uint_type)
] @constant.numeric.integer
[ [
(float_lit) (slice_type)
(float_type) (pointer_type)
] @constant.numeric.float ] @type ; In attributes
[
(bool_type)
(true)
(false)
] @constant.builtin.boolean
(null) @constant.builtin
(ellipsis) @punctuation.bracket
; Punctuation
[ [
"," ","
":" ":"
] @punctuation.delimiter ] @punctuation.delimiter
[ [
"("
")"
"["
"]"
"{" "{"
"}" "}"
"["
"]"
"("
")"
"<"
">"
] @punctuation.bracket ] @punctuation.bracket
(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member [
(ellipsis)
(identifier) @variable "?"
] @punctuation.special
; Types
(primitive_type) @type.builtin
( ; Literals
(identifier) @keyword.storage.type (string) @string
(#match? @keyword.storage.type "^#")
)
[ [
(slice_type) (escape_char)
(pointer_type) (escape_unicode)
] @type ; In attributes ] @constant.character.escape
(number) @constant.numeric
(field (label (identifier) @variable.other.member)) (float) @constant.numeric.float
(field (label alias: (identifier) @label)) (si_unit
(float)
(_) @string.special.symbol)
(attribute (identifier) @attribute) (boolean) @constant.builtin.boolean
[
(null)
(top)
(bottom)
] @constant.builtin
; Interpolations
(interpolation
"\\(" @punctuation.special
(_)
")" @punctuation.special)
(interpolation
"\\("
(identifier) @variable
")")
; Comments
(comment) @comment

Loading…
Cancel
Save