chore: query formatting

This commit is contained in:
Pham Huy Hoang 2024-01-06 15:05:50 +09:00 committed by Christian Clason
parent 79975d6557
commit 57a8acf0c4
674 changed files with 18466 additions and 12648 deletions

View file

@ -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)
(func_def name: (_ (identifier) @function) @function)
(func_call name: (_ (identifier) @function) @function)
(ns_qualified_name
"::" @punctuation.delimiter)
(func_def (param_list (identifier) @variable.parameter))
(func_def
name:
(_
(identifier) @function) @function)
(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
[
"("

View file

@ -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"))