2022-09-26 19:25:26 +03:00
|
|
|
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
|
|
|
|
[
|
|
|
|
|
(identifier)
|
|
|
|
|
(field_ref)
|
|
|
|
|
] @variable
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(field_ref
|
|
|
|
|
(_) @variable)
|
2022-09-26 19:25:26 +03:00
|
|
|
|
2023-06-24 21:35:51 +03:00
|
|
|
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
|
|
|
|
((identifier) @constant.builtin
|
2024-02-23 17:42:01 +09:00
|
|
|
(#any-of? @constant.builtin
|
|
|
|
|
"ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO"
|
|
|
|
|
"RLENGTH" "RSTART" "RT" "SYMTAB"))
|
2023-06-24 21:35:51 +03:00
|
|
|
|
|
|
|
|
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
|
|
|
|
|
((identifier) @variable.builtin
|
2024-02-23 17:42:01 +09:00
|
|
|
(#any-of? @variable.builtin
|
|
|
|
|
"BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC"
|
|
|
|
|
"ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN"))
|
2023-06-24 21:35:51 +03:00
|
|
|
|
2022-09-26 19:25:26 +03:00
|
|
|
(number) @number
|
|
|
|
|
|
|
|
|
|
(string) @string
|
2024-01-06 15:05:50 +09:00
|
|
|
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
(regex) @string.regexp
|
2024-01-06 15:05:50 +09:00
|
|
|
|
2022-09-26 19:25:26 +03:00
|
|
|
(escape_sequence) @string.escape
|
|
|
|
|
|
|
|
|
|
(comment) @comment @spell
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
((program
|
|
|
|
|
.
|
2024-04-29 14:56:57 +02:00
|
|
|
(comment) @keyword.directive @nospell)
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
(#lua-match? @keyword.directive "^#!/"))
|
2023-06-24 21:35:51 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(ns_qualified_name
|
|
|
|
|
(namespace) @module)
|
|
|
|
|
|
|
|
|
|
(ns_qualified_name
|
|
|
|
|
"::" @punctuation.delimiter)
|
2022-09-26 19:25:26 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(func_def
|
2024-03-21 20:44:35 +09:00
|
|
|
name: (_
|
|
|
|
|
(identifier) @function) @function)
|
2022-09-26 19:25:26 +03:00
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(func_call
|
2024-03-21 20:44:35 +09:00
|
|
|
name: (_
|
|
|
|
|
(identifier) @function) @function)
|
2024-01-06 15:05:50 +09:00
|
|
|
|
|
|
|
|
(func_def
|
|
|
|
|
(param_list
|
|
|
|
|
(identifier) @variable.parameter))
|
2022-09-26 19:25:26 +03:00
|
|
|
|
|
|
|
|
[
|
2025-01-11 14:31:24 +01:00
|
|
|
"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"
|
2022-09-26 19:25:26 +03:00
|
|
|
"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"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.repeat
|
2022-09-26 19:25:26 +03:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"if"
|
|
|
|
|
"else"
|
|
|
|
|
"switch"
|
|
|
|
|
"case"
|
|
|
|
|
"default"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.conditional
|
2022-09-26 19:25:26 +03:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"@include"
|
|
|
|
|
"@load"
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
] @keyword.import
|
2022-09-26 19:25:26 +03:00
|
|
|
|
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
|
|
|
"@namespace" @keyword.directive
|
2022-09-26 19:25:26 +03:00
|
|
|
|
|
|
|
|
[
|
2024-01-06 15:05:50 +09:00
|
|
|
"BEGIN"
|
|
|
|
|
"END"
|
|
|
|
|
"BEGINFILE"
|
|
|
|
|
"ENDFILE"
|
2022-09-26 19:25:26 +03:00
|
|
|
] @label
|
|
|
|
|
|
2024-01-06 15:05:50 +09:00
|
|
|
(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
|
2022-09-26 19:25:26 +03:00
|
|
|
|
|
|
|
|
[
|
|
|
|
|
"("
|
|
|
|
|
")"
|
|
|
|
|
"["
|
|
|
|
|
"]"
|
|
|
|
|
"{"
|
|
|
|
|
"}"
|
|
|
|
|
] @punctuation.bracket
|