highlight(zig) highlight all caps is a constant

* in some context, like translate c macro
 * which is use all CAPS for define constant
This commit is contained in:
maxxnino 2021-08-24 13:39:52 +09:00 committed by Stephan Seitz
parent 7241ddaff4
commit cbc42914bf

View file

@ -23,7 +23,7 @@ parameter: (IDENTIFIER) @parameter
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @type
(#match? @type "^[A-Z]")
(#match? @type "^[A-Z]([a-z0-9]+[A-Za-z0-9]*)*$")
)
;; assume camelCase is a function
(
@ -35,6 +35,15 @@ parameter: (IDENTIFIER) @parameter
(#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
)
;; assume all CAPS_1 is a constant
(
[
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
] @constant
(#match? @constant "^[A-Z][A-Z_0-9]+$")
)
[
function_call: (IDENTIFIER)
function: (IDENTIFIER)