diff options
Diffstat (limited to 'web/assets/c.scm')
| -rw-r--r-- | web/assets/c.scm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/web/assets/c.scm b/web/assets/c.scm new file mode 100644 index 0000000..789bf93 --- /dev/null +++ b/web/assets/c.scm @@ -0,0 +1,36 @@ +; C highlights, from tree-sitter/tree-sitter-c v0.24.2 queries/highlights.scm +; (MIT). Reordered for later-patterns-win, capture names mapped onto zed syntax +; keys (preprocessor directives get @preproc rather than upstream's @keyword, +; which zed themes colour separately). Also loaded ahead of cpp.scm, the way +; upstream composes the C++ highlights. + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[";" "," "."] @punctuation.delimiter +["--" "-" "-=" "->" "=" "!=" "*" "&" "&&" "+" "++" "+=" "<" "==" ">" + "||"] @operator + +["break" "case" "const" "continue" "default" "do" "else" "enum" "extern" + "for" "if" "inline" "return" "sizeof" "static" "struct" "switch" "typedef" + "union" "volatile" "while"] @keyword + +["#define" "#elif" "#else" "#endif" "#if" "#ifdef" "#ifndef" + "#include"] @preproc +(preproc_directive) @preproc + +[(type_identifier) (primitive_type) (sized_type_specifier)] @type +(field_identifier) @property +(statement_identifier) @label +((identifier) @constant + (#match? @constant "^[A-Z][A-Z0-9_]*$")) + +(call_expression function: (identifier) @function) +(call_expression function: (field_expression + field: (field_identifier) @function.method)) +(function_declarator declarator: (identifier) @function) +(preproc_function_def name: (identifier) @function) + +(number_literal) @number +(null) @constant +[(string_literal) (char_literal) (system_lib_string)] @string +(escape_sequence) @string.escape +(comment) @comment |
