mirror of https://github.com/helix-editor/helix
AWK support (#3528)
parent
facde9f18c
commit
45add73fb1
@ -0,0 +1,122 @@
|
||||
; tree-sitter-awk v0.5.1
|
||||
|
||||
; https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
|
||||
; Order matters
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @operator
|
||||
|
||||
(piped_io_statement [
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(redirected_io_statement [
|
||||
">"
|
||||
">>"
|
||||
] @operator)
|
||||
|
||||
(update_exp [
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
|
||||
(ternary_exp [
|
||||
"?"
|
||||
":"
|
||||
] @operator)
|
||||
|
||||
(assignment_exp [
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^="
|
||||
] @operator)
|
||||
|
||||
(unary_exp [
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
] @operator)
|
||||
|
||||
(binary_exp [
|
||||
"^"
|
||||
"**"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"~"
|
||||
"!~"
|
||||
"in"
|
||||
"&&"
|
||||
"||"
|
||||
] @operator)
|
||||
|
||||
[
|
||||
"@include"
|
||||
"@load"
|
||||
"@namespace"
|
||||
(pattern)
|
||||
] @namespace
|
||||
|
||||
[
|
||||
"function"
|
||||
"func"
|
||||
"print"
|
||||
"printf"
|
||||
"if"
|
||||
"else"
|
||||
"do"
|
||||
"while"
|
||||
"for"
|
||||
"in"
|
||||
"delete"
|
||||
"return"
|
||||
"exit"
|
||||
"switch"
|
||||
"case"
|
||||
"default"
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
(next_statement)
|
||||
(nextfile_statement)
|
||||
(getline_input)
|
||||
(getline_file)
|
||||
] @keyword
|
||||
|
||||
(comment) @comment
|
||||
(regex) @string.regexp
|
||||
(number) @constant.numeric
|
||||
(string) @string
|
||||
|
||||
(func_call name: (identifier) @function)
|
||||
(func_def name: (identifier) @function)
|
||||
|
||||
(field_ref (_) @variable)
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
|
||||
(ns_qualified_name "::" @operator)
|
||||
(ns_qualified_name (namespace) @namespace)
|
@ -0,0 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
@ -0,0 +1,10 @@
|
||||
|
||||
(func_def name: (identifier) (block) @function.inside) @function.around
|
||||
|
||||
(param_list (_) @parameter.inside) @parameter.around
|
||||
|
||||
(args (_) @parameter.inside) @parameter.around
|
||||
|
||||
(comment) @comment.inside
|
||||
|
||||
(comment)+ @comment.around
|
@ -1,2 +1,8 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(command
|
||||
name: (command_name (word) @_command)
|
||||
argument: (raw_string) @injection.content
|
||||
(#match? @_command "^[gnm]?awk$")
|
||||
(#set! injection.language "awk"))
|
Loading…
Reference in New Issue