diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 403aab41f..5b30d8003 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -166,7 +166,7 @@ return { }, c3 = { install_info = { - revision = '02d80569f0b713c8059e00e1719658950493cd35', + revision = 'dce56ccc5d2731ac14a0f6bb3fd1666d994b2a25', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, diff --git a/runtime/queries/c3/highlights.scm b/runtime/queries/c3/highlights.scm index 065b856b6..7b7bd33d0 100644 --- a/runtime/queries/c3/highlights.scm +++ b/runtime/queries/c3/highlights.scm @@ -31,6 +31,7 @@ [ (ident) (ct_ident) + (hash_ident) ] @variable ; 1) Member @@ -49,25 +50,31 @@ (ident) @variable.member) (initializer_list - (arg + (initializer_element (param_path (param_path_element - (ident) @variable.member)))) + (access_ident + (ident) @variable.member))))) ; 2) Parameter (param name: (_) @variable.parameter) +(trailing_block_param + (at_ident) @variable.parameter) + (call_arg_list (call_arg name: (_) @variable.parameter)) -(enum_param_declaration +(enum_param (ident) @variable.parameter) ; Keyword (from `c3c --list-keywords`) [ + "alias" "asm" + "attrdef" "catch" "defer" "try" @@ -128,8 +135,6 @@ "module" @keyword [ - "alias" - "attrdef" "bitstruct" "enum" "faultdef" @@ -253,8 +258,7 @@ (escape_sequence) @string.escape ; Builtin (constants) -((builtin) @constant.builtin - (#match? @constant.builtin "_*[A-Z][_A-Z0-9]*")) +(builtin_const) @constant.builtin ; Type Property (from `c3c --list-type-properties`) (type_access_expr @@ -286,10 +290,9 @@ ; Attribute (attribute - name: (_) @attribute) + name: (at_ident) @attribute) -(attrdef_declaration - name: (_) @attribute) +(at_type_ident) @attribute (call_inline_attributes (at_ident) @attribute) @@ -322,26 +325,19 @@ ; Function Call (call_expr - function: [ - (ident) - (at_ident) - ] @function.call) - -(call_expr - function: (trailing_generic_expr - argument: [ + function: (ident_expr + [ (ident) (at_ident) ] @function.call)) -(call_expr - function: (module_ident_expr - ident: (_) @function.call)) - (call_expr function: (trailing_generic_expr - argument: (module_ident_expr - ident: (_) @function.call))) + argument: (ident_expr + [ + (ident) + (at_ident) + ] @function.call))) ; Method call (call_expr @@ -389,5 +385,23 @@ (doc_comment_text) @spell (doc_comment_contract - name: (_) @markup.strong - (#any-of? @markup.strong "@param" "@return" "@deprecated" "@require" "@ensure" "@pure")) + name: (_) @attribute) + +(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))