mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
feat: add awk
This commit is contained in:
parent
580c59cb50
commit
a715e93312
3 changed files with 163 additions and 0 deletions
|
|
@ -1293,6 +1293,13 @@ list.vhs = {
|
||||||
filetype = "tape",
|
filetype = "tape",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.awk = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/Beaglefoot/tree-sitter-awk",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
list = list,
|
list = list,
|
||||||
filetype_to_parsername = filetype_to_parsername,
|
filetype_to_parsername = filetype_to_parsername,
|
||||||
|
|
|
||||||
154
queries/awk/highlights.scm
Normal file
154
queries/awk/highlights.scm
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
||||||
|
|
||||||
|
[
|
||||||
|
(identifier)
|
||||||
|
(field_ref)
|
||||||
|
] @variable
|
||||||
|
(field_ref (_) @variable)
|
||||||
|
|
||||||
|
(number) @number
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
(regex) @string.regex
|
||||||
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
(comment) @comment @spell
|
||||||
|
|
||||||
|
(ns_qualified_name (namespace) @namespace)
|
||||||
|
(ns_qualified_name "::" @punctuation.delimiter)
|
||||||
|
|
||||||
|
(func_def name: (_ (identifier) @function) @function)
|
||||||
|
(func_call name: (_ (identifier) @function) @function)
|
||||||
|
|
||||||
|
(func_def (param_list (identifier) @parameter))
|
||||||
|
|
||||||
|
[
|
||||||
|
"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"
|
||||||
|
] @repeat
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"switch"
|
||||||
|
"case"
|
||||||
|
"default"
|
||||||
|
] @conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"@include"
|
||||||
|
"@load"
|
||||||
|
] @include
|
||||||
|
|
||||||
|
"@namespace" @preproc
|
||||||
|
|
||||||
|
[
|
||||||
|
"BEGIN"
|
||||||
|
"END"
|
||||||
|
"BEGINFILE"
|
||||||
|
"ENDFILE"
|
||||||
|
] @label
|
||||||
|
|
||||||
|
(binary_exp [
|
||||||
|
"^"
|
||||||
|
"**"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"%"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"<="
|
||||||
|
">="
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"~"
|
||||||
|
"!~"
|
||||||
|
"in"
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(unary_exp [
|
||||||
|
"!"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(assignment_exp [
|
||||||
|
"="
|
||||||
|
"+="
|
||||||
|
"-="
|
||||||
|
"*="
|
||||||
|
"/="
|
||||||
|
"%="
|
||||||
|
"^="
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(ternary_exp [
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(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
|
||||||
2
queries/awk/injections.scm
Normal file
2
queries/awk/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(comment) @comment
|
||||||
|
(regex) @regex
|
||||||
Loading…
Add table
Add a link
Reference in a new issue