highlights.scm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. (identifier) @variable
  2. [
  3. "const"
  4. "default"
  5. "enum"
  6. "extern"
  7. "inline"
  8. "return"
  9. "sizeof"
  10. "static"
  11. "struct"
  12. "typedef"
  13. "union"
  14. "volatile"
  15. "goto"
  16. "register"
  17. ] @keyword
  18. [
  19. "while"
  20. "for"
  21. "do"
  22. "continue"
  23. "break"
  24. ] @repeat
  25. [
  26. "if"
  27. "else"
  28. "case"
  29. "switch"
  30. ] @conditional
  31. "#define" @constant.macro
  32. [
  33. "#if"
  34. "#ifdef"
  35. "#ifndef"
  36. "#else"
  37. "#elif"
  38. "#endif"
  39. (preproc_directive)
  40. ] @keyword
  41. "#include" @include
  42. [
  43. "="
  44. "-"
  45. "*"
  46. "/"
  47. "+"
  48. "%"
  49. "~"
  50. "|"
  51. "&"
  52. "^"
  53. "<<"
  54. ">>"
  55. "->"
  56. "<"
  57. "<="
  58. ">="
  59. ">"
  60. "=="
  61. "!="
  62. "!"
  63. "&&"
  64. "||"
  65. "-="
  66. "+="
  67. "*="
  68. "/="
  69. "%="
  70. "|="
  71. "&="
  72. "^="
  73. ">>="
  74. "<<="
  75. "--"
  76. "++"
  77. ] @operator
  78. [
  79. (true)
  80. (false)
  81. ] @boolean
  82. [ "." ";" ":" "," ] @punctuation.delimiter
  83. (conditional_expression [ "?" ":" ] @conditional)
  84. [ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
  85. (string_literal) @string
  86. (string_literal) @spell
  87. (system_lib_string) @string
  88. (null) @constant.builtin
  89. (number_literal) @number
  90. (char_literal) @number
  91. (call_expression
  92. function: (identifier) @function)
  93. (call_expression
  94. function: (field_expression
  95. field: (field_identifier) @function))
  96. (function_declarator
  97. declarator: (identifier) @function)
  98. (preproc_function_def
  99. name: (identifier) @function.macro)
  100. [
  101. (preproc_arg)
  102. (preproc_defined)
  103. ] @function.macro
  104. (field_identifier) @property
  105. (statement_identifier) @label
  106. [
  107. (type_identifier)
  108. (primitive_type)
  109. (sized_type_specifier)
  110. (type_descriptor)
  111. ] @type
  112. (declaration (type_qualifier) @type)
  113. (cast_expression type: (type_descriptor) @type)
  114. (sizeof_expression value: (parenthesized_expression (identifier) @type))
  115. ((identifier) @constant
  116. (#match? @constant "^[A-Z][A-Z0-9_]+$"))
  117. ;; Preproc def / undef
  118. (preproc_def
  119. name: (_) @constant)
  120. (preproc_call
  121. directive: (preproc_directive) @_u
  122. argument: (_) @constant
  123. (#eq? @_u "#undef"))
  124. (comment) @comment
  125. (comment) @spell
  126. ;; Parameters
  127. (parameter_declaration
  128. declarator: (identifier) @parameter)
  129. (parameter_declaration
  130. declarator: (pointer_declarator) @parameter)
  131. (preproc_params
  132. (identifier)) @parameter
  133. (ERROR) @error