Skip to content

Commit

Permalink
Improve C syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
chbk committed Feb 21, 2025
1 parent dff47a8 commit f1a9196
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions crates/languages/src/c/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@
[
(true)
(false)
] @boolean

[
(null)
] @constant
] @constant.builtin

(identifier) @variable

((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
((identifier) @constant.variable
(#match? @constant.variable "^_*[A-Z][A-Z\\d_]*$"))

(call_expression
function: (identifier) @function)
Expand Down
9 changes: 6 additions & 3 deletions crates/languages/src/cpp/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ type :(primitive_type) @type.primitive
(attribute
name: (identifier) @keyword)

((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
((identifier) @constant.variable
(#match? @constant.variable "^_*[A-Z][A-Z\\d_]*$"))

(statement_identifier) @label
(this) @variable.special
Expand Down Expand Up @@ -153,9 +153,12 @@ type :(primitive_type) @type.primitive
[
(true)
(false)
] @boolean

[
(null)
("nullptr")
] @constant
] @constant.builtin

(number_literal) @number

Expand Down

0 comments on commit f1a9196

Please sign in to comment.