From 20a6c66b769d09491247d760967bb4ef2fcf3e0d Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 24 Jun 2023 21:35:51 +0300 Subject: [PATCH] feat(awk): highlight builtin variables & shebang --- queries/awk/highlights.scm | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm index a03c43670..4faf496e6 100644 --- a/queries/awk/highlights.scm +++ b/queries/awk/highlights.scm @@ -6,6 +6,44 @@ ] @variable (field_ref (_) @variable) +; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html +((identifier) @constant.builtin + (#any-of? @constant.builtin + "ARGC" + "ARGV" + "ARGIND" + "ENVIRON" + "ERRNO" + "FILENAME" + "FNR" + "NF" + "FUNCTAB" + "NR" + "PROCINFO" + "RLENGTH" + "RSTART" + "RT" + "SYMTAB")) + +; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html +((identifier) @variable.builtin + (#any-of? @variable.builtin + "BINMODE" + "CONVFMT" + "FIELDWIDTHS" + "FPAT" + "FS" + "IGNORECASE" + "LINT" + "OFMT" + "OFS" + "ORS" + "PREC" + "ROUNDMODE" + "RS" + "SUBSEP" + "TEXTDOMAIN")) + (number) @number (string) @string @@ -14,6 +52,9 @@ (comment) @comment @spell +((program . (comment) @preproc) + (#lua-match? @preproc "^#!/")) + (ns_qualified_name (namespace) @namespace) (ns_qualified_name "::" @punctuation.delimiter)