aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/awk/highlights.scm
blob: 34d660ad5c41d769f1fe692ab37ba9e4d9a212bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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)