mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
c: don't treat uppercase functions as constants
A macro function such as
#define FOO(x) ...
should be highlighted with @function.macro, even though the name is in
all-caps (which would otherwise be treated as a constant). Similarly,
call sites of such functions, e.g.
int y = FOO(x);
should be highlighted with @function instead of @constant.
This is as simple as moving the query definition for macro functions
after the query definition for constants.
This commit is contained in:
parent
21a7f61b06
commit
27f5e99cdd
1 changed files with 9 additions and 9 deletions
|
|
@ -111,15 +111,6 @@
|
|||
(number_literal) @number
|
||||
(char_literal) @character
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
[
|
||||
(preproc_arg)
|
||||
(preproc_defined)
|
||||
|
|
@ -157,6 +148,15 @@
|
|||
argument: (_) @constant
|
||||
(#eq? @_u "#undef"))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function))
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(comment) @comment
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue