build(deps): bump tree-sitter-c to v0.20.5

also update highlight queries and test

fixup: tests
This commit is contained in:
Christian Clason 2023-08-10 18:38:21 +02:00
parent 5ef7bc50cc
commit f5e6f592b6
4 changed files with 46 additions and 20 deletions

View File

@ -185,8 +185,8 @@ set(GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47
set(LIBICONV_URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz)
set(LIBICONV_SHA256 ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178)
set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz)
set(TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2 )
set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.5.tar.gz)
set(TREESITTER_C_SHA256 694a5408246ee45d535df9df025febecdb50bee764df64a94346b9805a5f349b )
set(TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.17.tar.gz)
set(TREESITTER_LUA_SHA256 8963fd0a185d786c164dfca3824941c7eaec497ce49a3a0bc24bf753f5e0e59c)
set(TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz)

View File

@ -13,7 +13,8 @@
(preproc_else)
(preproc_ifdef)
(initializer_list)
(gnu_asm_expression)
] @fold
(compound_statement
(compound_statement
(compound_statement) @fold)

View File

@ -1,5 +1,6 @@
; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
((identifier) @variable (#set! "priority" 95))
(preproc_def (preproc_arg) @variable)
[
"default"
@ -8,9 +9,14 @@
"typedef"
"union"
"goto"
"asm"
"__asm__"
] @keyword
"sizeof" @keyword.operator
[
"sizeof"
"offsetof"
] @keyword.operator
"return" @keyword.return
@ -36,6 +42,8 @@
"#else"
"#elif"
"#endif"
"#elifdef"
"#elifndef"
(preproc_directive)
] @preproc
@ -43,7 +51,7 @@
"#include" @include
[ ";" ":" "," ] @punctuation.delimiter
[ ";" ":" "," "::" ] @punctuation.delimiter
"..." @punctuation.special
@ -98,8 +106,8 @@
(comma_expression [ "," ] @operator)
[
(true)
(false)
(true)
(false)
] @boolean
(conditional_expression [ "?" ":" ] @conditional.ternary)
@ -112,10 +120,17 @@
(number_literal) @number
(char_literal) @character
[
(preproc_arg)
(preproc_defined)
] @function.macro
((preproc_arg) @function.macro (#set! "priority" 90))
(preproc_defined) @function.macro
(((field_expression
(field_identifier) @property)) @_parent
(#not-has-parent? @_parent template_method function_declarator call_expression))
(field_designator) @property
(((field_identifier) @property)
(#has-ancestor? @property field_declaration)
(#not-has-ancestor? @property function_declarator))
(statement_identifier) @label
@ -126,7 +141,10 @@
(storage_class_specifier) @storageclass
(type_qualifier) @type.qualifier
[
(type_qualifier)
(gnu_asm_qualifier)
] @type.qualifier
(linkage_specification
"extern" @storageclass)
@ -140,6 +158,8 @@
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
(preproc_def (preproc_arg) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
(enumerator
name: (identifier) @constant)
(case_statement
@ -147,6 +167,8 @@
((identifier) @constant.builtin
(#any-of? @constant.builtin "stderr" "stdin" "stdout"))
(preproc_def (preproc_arg) @constant.builtin
(#any-of? @constant.builtin "stderr" "stdin" "stdout"))
;; Preproc def / undef
(preproc_def
@ -179,6 +201,9 @@
(parameter_declaration
declarator: (identifier) @parameter)
(parameter_declaration
declarator: (array_declarator) @parameter)
(parameter_declaration
declarator: (pointer_declarator) @parameter)
@ -186,15 +211,15 @@
[
"__attribute__"
"__declspec"
"__based"
"__cdecl"
"__clrcall"
"__stdcall"
"__fastcall"
"__thiscall"
"__vectorcall"
"_unaligned"
"__unaligned"
"__declspec"
(ms_pointer_modifier)
(attribute_declaration)
] @attribute

View File

@ -194,8 +194,8 @@ void ui_refresh(void)
local firstrun = q(1)
local manyruns = q(100)
-- First run should be at least 400x slower than an 100 subsequent runs.
local factor = is_os('win') and 200 or 400
-- First run should be at least 200x slower than an 100 subsequent runs.
local factor = is_os('win') and 100 or 200
assert(factor * manyruns < firstrun, ('firstrun: %f ms, manyruns: %f ms'):format(firstrun / 1e6, manyruns / 1e6))
end)
@ -765,9 +765,9 @@ int x = INT_MAX;
eq("table", exec_lua("return type(parser:children().c)"))
eq({
{0, 0, 7, 0}, -- root tree
{3, 15, 3, 16}, -- VALUE 123
{4, 16, 4, 17}, -- VALUE1 123
{5, 16, 5, 17}, -- VALUE2 123
{3, 16, 3, 16}, -- VALUE 123
{4, 17, 4, 17}, -- VALUE1 123
{5, 17, 5, 17}, -- VALUE2 123
{1, 26, 1, 63}, -- READ_STRING(x, y) (char *)read_string((x), (size_t)(y))
{2, 29, 2, 66} -- READ_STRING_OK(x, y) (char *)read_string((x), (size_t)(y))
}, get_ranges())