nvim-treesitter/queries/c/highlights.scm

170 lines
2.3 KiB
Scheme
Raw Normal View History

(identifier) @variable
2020-08-15 09:24:24 -05:00
[
"const"
"default"
"enum"
"extern"
"inline"
"return"
"sizeof"
"static"
"struct"
"typedef"
"union"
"volatile"
"goto"
"register"
] @keyword
2020-07-06 23:01:46 +02:00
[
"while"
"for"
"do"
"continue"
"break"
] @repeat
[
"if"
"else"
"case"
2020-07-06 23:01:46 +02:00
"switch"
] @conditional
"#define" @constant.macro
2020-06-27 21:06:11 +02:00
[
"#if"
"#ifdef"
"#ifndef"
"#else"
"#elif"
"#endif"
(preproc_directive)
] @keyword
"#include" @include
[
2020-07-06 23:01:46 +02:00
"="
"-"
"*"
"/"
"+"
2020-07-20 08:56:27 +02:00
"%"
2020-07-06 23:01:46 +02:00
"~"
"|"
"&"
2020-08-27 01:17:44 +02:00
"^"
2020-07-06 23:01:46 +02:00
"<<"
">>"
"->"
"<"
"<="
">="
2020-07-06 23:01:46 +02:00
">"
"=="
"!="
"!"
2020-07-06 23:01:46 +02:00
"&&"
"||"
"-="
"+="
"*="
"/="
2020-07-20 08:56:27 +02:00
"%="
"|="
"&="
2020-08-27 01:17:44 +02:00
"^="
">>="
"<<="
2020-07-06 23:01:46 +02:00
"--"
"++"
] @operator
2020-07-06 23:01:46 +02:00
[
(true)
(false)
] @boolean
[ "." ";" ":" "," ] @punctuation.delimiter
2020-07-06 23:01:46 +02:00
(conditional_expression [ "?" ":" ] @conditional)
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
(string_literal) @string
(system_lib_string) @string
(null) @constant.builtin
(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)
] @function.macro
(((field_expression
(field_identifier) @property)) @_parent
(#not-has-parent? @_parent template_method function_declarator call_expression))
(((field_identifier) @property)
(#has-ancestor? @property field_declaration)
(#not-has-ancestor? @property function_declarator))
(statement_identifier) @label
2020-07-06 23:01:46 +02:00
[
(type_identifier)
(primitive_type)
(sized_type_specifier)
(type_descriptor)
] @type
(declaration (type_qualifier) @type)
(cast_expression type: (type_descriptor) @type)
2020-07-06 23:01:46 +02:00
(sizeof_expression value: (parenthesized_expression (identifier) @type))
2020-05-23 21:02:43 +02:00
((identifier) @constant
2020-06-14 15:12:38 +02:00
(#match? @constant "^[A-Z][A-Z0-9_]+$"))
;; Preproc def / undef
(preproc_def
name: (_) @constant)
(preproc_call
directive: (preproc_directive) @_u
argument: (_) @constant
(#eq? @_u "#undef"))
(comment) @comment
2020-05-23 21:50:52 +02:00
;; Parameters
2020-08-15 09:24:24 -05:00
(parameter_declaration
declarator: (identifier) @parameter)
2020-05-23 21:50:52 +02:00
(parameter_declaration
declarator: (pointer_declarator) @parameter)
(preproc_params
(identifier)) @parameter
(ERROR) @error