highlights.scm 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ; Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. ; Exceptions. See /LICENSE for license information.
  3. ; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. ; This maps syntax node patterns to highlighting scopes.
  5. ; The scopes are used themes and editors to select style for that node.
  6. (comment) @comment
  7. (builtin_type) @type.builtin
  8. (bool_literal) @constant.builtin
  9. (string) @string
  10. (numeric_literal) @constant.builtin
  11. (numeric_type_literal) @type.builtin
  12. ; function declaration or call expression => function
  13. (function_declaration (declared_name (ident) @function))
  14. (call_expression (ident) @function)
  15. (namespace_declaration (declared_name) @namespace)
  16. (interface_declaration (declared_name) @type)
  17. (constraint_declaration (declared_name) @type)
  18. (class_declaration (declared_name) @type)
  19. (choice_declaration (declared_name) @type)
  20. (binding_lhs) @variable
  21. ; upper case => type
  22. ((ident) @type
  23. (#match? @type "^[A-Z]"))
  24. ; lower case => variable
  25. ((ident) @variable
  26. (#match? @variable "^[a-z_]"))
  27. [
  28. "("
  29. ")"
  30. "{"
  31. "}"
  32. "["
  33. "]"
  34. ] @punctuation.bracket
  35. [
  36. "."
  37. ";"
  38. ","
  39. ":"
  40. ":!"
  41. "=>"
  42. ] @punctuation.delimiter
  43. "->" @punctuation
  44. [
  45. "+"
  46. "-"
  47. (binary_star)
  48. "/"
  49. "%"
  50. "=="
  51. "!="
  52. "<"
  53. "<="
  54. ">"
  55. ">="
  56. "not"
  57. "and"
  58. "or"
  59. "|"
  60. "&"
  61. "^"
  62. ">>"
  63. "<<"
  64. "*" ; prefix star
  65. (postfix_star)
  66. "++"
  67. "--"
  68. ] @operator
  69. ; keywords not used in grammar.js are commented out
  70. [
  71. "abstract"
  72. ; "adapt"
  73. "addr"
  74. "alias"
  75. "and"
  76. "api"
  77. "as"
  78. "auto"
  79. "base"
  80. "break"
  81. ; "Core"
  82. "case"
  83. "choice"
  84. "class"
  85. "constraint"
  86. "continue"
  87. "default"
  88. "destructor"
  89. "else"
  90. "extend"
  91. ; "final"
  92. "fn"
  93. "for"
  94. "forall"
  95. ; "friend"
  96. "if"
  97. "impl"
  98. "impls"
  99. "import"
  100. "in"
  101. "interface"
  102. "let"
  103. "library"
  104. ; "like"
  105. "match"
  106. "namespace"
  107. "not"
  108. ; "observe"
  109. "or"
  110. ; "override"
  111. "package"
  112. ; "partial"
  113. ; "private"
  114. ; "protected"
  115. "require"
  116. "return"
  117. "returned"
  118. "Self"
  119. ; "self"
  120. "template"
  121. "then"
  122. "type"
  123. "var"
  124. "virtual"
  125. "where"
  126. "while"
  127. ] @keyword