Update highlights and c3 to v0.8.0

This commit is contained in:
Christian Buttner 2025-05-27 15:10:14 +02:00
parent 2afba4543d
commit ff18a3038f
2 changed files with 41 additions and 27 deletions

View file

@ -166,7 +166,7 @@ return {
}, },
c3 = { c3 = {
install_info = { install_info = {
revision = '02d80569f0b713c8059e00e1719658950493cd35', revision = 'dce56ccc5d2731ac14a0f6bb3fd1666d994b2a25',
url = 'https://github.com/c3lang/tree-sitter-c3', url = 'https://github.com/c3lang/tree-sitter-c3',
}, },
maintainers = { '@cbuttner' }, maintainers = { '@cbuttner' },

View file

@ -31,6 +31,7 @@
[ [
(ident) (ident)
(ct_ident) (ct_ident)
(hash_ident)
] @variable ] @variable
; 1) Member ; 1) Member
@ -49,25 +50,31 @@
(ident) @variable.member) (ident) @variable.member)
(initializer_list (initializer_list
(arg (initializer_element
(param_path (param_path
(param_path_element (param_path_element
(ident) @variable.member)))) (access_ident
(ident) @variable.member)))))
; 2) Parameter ; 2) Parameter
(param (param
name: (_) @variable.parameter) name: (_) @variable.parameter)
(trailing_block_param
(at_ident) @variable.parameter)
(call_arg_list (call_arg_list
(call_arg (call_arg
name: (_) @variable.parameter)) name: (_) @variable.parameter))
(enum_param_declaration (enum_param
(ident) @variable.parameter) (ident) @variable.parameter)
; Keyword (from `c3c --list-keywords`) ; Keyword (from `c3c --list-keywords`)
[ [
"alias"
"asm" "asm"
"attrdef"
"catch" "catch"
"defer" "defer"
"try" "try"
@ -128,8 +135,6 @@
"module" @keyword "module" @keyword
[ [
"alias"
"attrdef"
"bitstruct" "bitstruct"
"enum" "enum"
"faultdef" "faultdef"
@ -253,8 +258,7 @@
(escape_sequence) @string.escape (escape_sequence) @string.escape
; Builtin (constants) ; Builtin (constants)
((builtin) @constant.builtin (builtin_const) @constant.builtin
(#match? @constant.builtin "_*[A-Z][_A-Z0-9]*"))
; Type Property (from `c3c --list-type-properties`) ; Type Property (from `c3c --list-type-properties`)
(type_access_expr (type_access_expr
@ -286,10 +290,9 @@
; Attribute ; Attribute
(attribute (attribute
name: (_) @attribute) name: (at_ident) @attribute)
(attrdef_declaration (at_type_ident) @attribute
name: (_) @attribute)
(call_inline_attributes (call_inline_attributes
(at_ident) @attribute) (at_ident) @attribute)
@ -322,26 +325,19 @@
; Function Call ; Function Call
(call_expr (call_expr
function: [ function: (ident_expr
(ident) [
(at_ident)
] @function.call)
(call_expr
function: (trailing_generic_expr
argument: [
(ident) (ident)
(at_ident) (at_ident)
] @function.call)) ] @function.call))
(call_expr
function: (module_ident_expr
ident: (_) @function.call))
(call_expr (call_expr
function: (trailing_generic_expr function: (trailing_generic_expr
argument: (module_ident_expr argument: (ident_expr
ident: (_) @function.call))) [
(ident)
(at_ident)
] @function.call)))
; Method call ; Method call
(call_expr (call_expr
@ -389,5 +385,23 @@
(doc_comment_text) @spell (doc_comment_text) @spell
(doc_comment_contract (doc_comment_contract
name: (_) @markup.strong name: (_) @attribute)
(#any-of? @markup.strong "@param" "@return" "@deprecated" "@require" "@ensure" "@pure"))
(doc_comment_contract
parameter: [
(ident)
(ct_ident)
(hash_ident)
] @variable.parameter
(#set! priority 110))
(doc_comment_contract
[
":"
"?"
] @comment.documentation
(#set! priority 110))
(doc_comment_contract
description: (_) @comment.documentation
(#set! priority 110))