aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaxxnino <idonthaveemail@dontknow.com>2021-08-24 13:39:52 +0900
committerStephan Seitz <stephan.seitz@fau.de>2021-09-17 21:06:36 +0200
commit70987d8f84fe3a35e3c04556c88aa92919ab8865 (patch)
treedff5b0251faf641c4327eb26701b11a1e7b50c62
parentchore(issues): make bug_report an issue form (diff)
downloadnvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar.gz
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar.bz2
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar.lz
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar.xz
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.tar.zst
nvim-treesitter-70987d8f84fe3a35e3c04556c88aa92919ab8865.zip
highlight(zig) highlight all caps is a constant
* in some context, like translate c macro * which is use all CAPS for define constant
-rw-r--r--queries/zig/highlights.scm11
1 files changed, 10 insertions, 1 deletions
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)