aboutsummaryrefslogtreecommitdiffstats
path: root/queries/awk
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/awk
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/awk')
-rw-r--r--queries/awk/highlights.scm206
-rw-r--r--queries/awk/injections.scm16
2 files changed, 114 insertions, 108 deletions
diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm
index 6d3b7ff0b..90c9f3437 100644
--- a/queries/awk/highlights.scm
+++ b/queries/awk/highlights.scm
@@ -1,67 +1,54 @@
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
-
[
(identifier)
(field_ref)
] @variable
-(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"))
+ (#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"))
+ (#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)
+((program
+ .
+ (comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))
-(ns_qualified_name (namespace) @module)
-(ns_qualified_name "::" @punctuation.delimiter)
+(ns_qualified_name
+ (namespace) @module)
+
+(ns_qualified_name
+ "::" @punctuation.delimiter)
-(func_def name: (_ (identifier) @function) @function)
-(func_call name: (_ (identifier) @function) @function)
+(func_def
+ name:
+ (_
+ (identifier) @function) @function)
-(func_def (param_list (identifier) @variable.parameter))
+(func_call
+ name:
+ (_
+ (identifier) @function) @function)
+
+(func_def
+ (param_list
+ (identifier) @variable.parameter))
[
"print"
@@ -110,80 +97,95 @@
"@namespace" @keyword.directive
[
- "BEGIN"
- "END"
- "BEGINFILE"
- "ENDFILE"
+ "BEGIN"
+ "END"
+ "BEGINFILE"
+ "ENDFILE"
] @label
-(binary_exp [
- "^"
- "**"
- "*"
- "/"
- "%"
- "+"
- "-"
- "<"
- ">"
- "<="
- ">="
- "=="
- "!="
- "~"
- "!~"
- "in"
- "&&"
- "||"
-] @operator)
+(binary_exp
+ [
+ "^"
+ "**"
+ "*"
+ "/"
+ "%"
+ "+"
+ "-"
+ "<"
+ ">"
+ "<="
+ ">="
+ "=="
+ "!="
+ "~"
+ "!~"
+ "in"
+ "&&"
+ "||"
+ ] @operator)
-(unary_exp [
- "!"
- "+"
- "-"
-] @operator)
+(unary_exp
+ [
+ "!"
+ "+"
+ "-"
+ ] @operator)
-(assignment_exp [
- "="
- "+="
- "-="
- "*="
- "/="
- "%="
- "^="
-] @operator)
+(assignment_exp
+ [
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "^="
+ ] @operator)
-(ternary_exp [
- "?"
- ":"
-] @keyword.conditional.ternary)
+(ternary_exp
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
-(update_exp [
- "++"
- "--"
-] @operator)
+(update_exp
+ [
+ "++"
+ "--"
+ ] @operator)
-(redirected_io_statement [
- ">"
- ">>"
-] @operator)
+(redirected_io_statement
+ [
+ ">"
+ ">>"
+ ] @operator)
-(piped_io_statement [
- "|"
- "|&"
-] @operator)
+(piped_io_statement
+ [
+ "|"
+ "|&"
+ ] @operator)
-(piped_io_exp [
- "|"
- "|&"
-] @operator)
+(piped_io_exp
+ [
+ "|"
+ "|&"
+ ] @operator)
-(field_ref "$" @punctuation.delimiter)
+(field_ref
+ "$" @punctuation.delimiter)
-(regex "/" @punctuation.delimiter)
-(regex_constant "@" @punctuation.delimiter)
+(regex
+ "/" @punctuation.delimiter)
-[ ";" "," ] @punctuation.delimiter
+(regex_constant
+ "@" @punctuation.delimiter)
+
+[
+ ";"
+ ","
+] @punctuation.delimiter
[
"("
diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm
index 24db57d67..3e67da245 100644
--- a/queries/awk/injections.scm
+++ b/queries/awk/injections.scm
@@ -1,13 +1,17 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
((regex) @injection.content
- (#set! injection.language "regex"))
+ (#set! injection.language "regex"))
((print_statement
- (exp_list . (string) @injection.content))
- (#set! injection.language "printf"))
+ (exp_list
+ .
+ (string) @injection.content))
+ (#set! injection.language "printf"))
((printf_statement
- (exp_list . (string) @injection.content))
- (#set! injection.language "printf"))
+ (exp_list
+ .
+ (string) @injection.content))
+ (#set! injection.language "printf"))