aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/awk/highlights.scm
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/awk/highlights.scm
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/awk/highlights.scm')
-rw-r--r--runtime/queries/awk/highlights.scm233
1 files changed, 233 insertions, 0 deletions
diff --git a/runtime/queries/awk/highlights.scm b/runtime/queries/awk/highlights.scm
new file mode 100644
index 000000000..51ec9c08e
--- /dev/null
+++ b/runtime/queries/awk/highlights.scm
@@ -0,0 +1,233 @@
+; adapted from https://github.com/Beaglefoot/tree-sitter-awk
+[
+ (identifier)
+ (field_ref)
+] @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
+
+(regex) @string.regexp
+
+(escape_sequence) @string.escape
+
+(comment) @comment @spell
+
+((program
+ .
+ (comment) @keyword.directive @nospell)
+ (#lua-match? @keyword.directive "^#!/"))
+
+(ns_qualified_name
+ (namespace) @module)
+
+(ns_qualified_name
+ "::" @punctuation.delimiter)
+
+(func_def
+ name: (_
+ (identifier) @function) @function)
+
+(func_call
+ name: (_
+ (identifier) @function) @function)
+
+(func_def
+ (param_list
+ (identifier) @variable.parameter))
+
+[
+ "asort"
+ "asorti"
+ "bindtextdomain"
+ "compl"
+ "cos"
+ "dcgettext"
+ "dcngettext"
+ "exp"
+ "gensub"
+ "gsub"
+ "index"
+ "int"
+ "isarray"
+ "length"
+ "log"
+ "lshift"
+ "match"
+ "mktime"
+ "patsplit"
+ "rand"
+ "rshift"
+ "sin"
+ "split"
+ "sprintf"
+ "sqrt"
+ "srand"
+ "strftime"
+ "strtonum"
+ "sub"
+ "substr"
+ "systime"
+ "tolower"
+ "toupper"
+ "typeof"
+ "print"
+ "printf"
+ "getline"
+] @function.builtin
+
+[
+ (delete_statement)
+ (break_statement)
+ (continue_statement)
+ (next_statement)
+ (nextfile_statement)
+] @keyword
+
+[
+ "func"
+ "function"
+] @keyword.function
+
+[
+ "return"
+ "exit"
+] @keyword.return
+
+[
+ "do"
+ "while"
+ "for"
+ "in"
+] @keyword.repeat
+
+[
+ "if"
+ "else"
+ "switch"
+ "case"
+ "default"
+] @keyword.conditional
+
+[
+ "@include"
+ "@load"
+] @keyword.import
+
+"@namespace" @keyword.directive
+
+[
+ "BEGIN"
+ "END"
+ "BEGINFILE"
+ "ENDFILE"
+] @label
+
+(binary_exp
+ [
+ "^"
+ "**"
+ "*"
+ "/"
+ "%"
+ "+"
+ "-"
+ "<"
+ ">"
+ "<="
+ ">="
+ "=="
+ "!="
+ "~"
+ "!~"
+ "in"
+ "&&"
+ "||"
+ ] @operator)
+
+(unary_exp
+ [
+ "!"
+ "+"
+ "-"
+ ] @operator)
+
+(assignment_exp
+ [
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "^="
+ ] @operator)
+
+(ternary_exp
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
+
+(update_exp
+ [
+ "++"
+ "--"
+ ] @operator)
+
+(redirected_io_statement
+ [
+ ">"
+ ">>"
+ ] @operator)
+
+(piped_io_statement
+ [
+ "|"
+ "|&"
+ ] @operator)
+
+(piped_io_exp
+ [
+ "|"
+ "|&"
+ ] @operator)
+
+(field_ref
+ "$" @punctuation.delimiter)
+
+(regex
+ "/" @punctuation.delimiter)
+
+(regex_constant
+ "@" @punctuation.delimiter)
+
+[
+ ";"
+ ","
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket