From cbc42914bf0c8edcaa7ba0023d9175e8a16e13de Mon Sep 17 00:00:00 2001 From: maxxnino Date: Tue, 24 Aug 2021 13:39:52 +0900 Subject: highlight(zig) highlight all caps is a constant * in some context, like translate c macro * which is use all CAPS for define constant --- queries/zig/highlights.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index a7f1071a2..24c41d6d3 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -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) -- cgit v1.2.3-70-g09d2