xonecas.io
7814
Ta

tiny-c-agent / files

tiny-c-agent / vendor / queries / javascript / highlights.scm

2.7 KB
1; Variables
2;----------
3
4(identifier) @variable
5
6; Properties
7;-----------
8
9(property_identifier) @property
10
11; Function and method definitions
12;--------------------------------
13
14(function_expression
15  name: (identifier) @function)
16(function_declaration
17  name: (identifier) @function)
18(method_definition
19  name: (property_identifier) @function.method)
20
21(pair
22  key: (property_identifier) @function.method
23  value: [(function_expression) (arrow_function)])
24
25(assignment_expression
26  left: (member_expression
27    property: (property_identifier) @function.method)
28  right: [(function_expression) (arrow_function)])
29
30(variable_declarator
31  name: (identifier) @function
32  value: [(function_expression) (arrow_function)])
33
34(assignment_expression
35  left: (identifier) @function
36  right: [(function_expression) (arrow_function)])
37
38; Function and method calls
39;--------------------------
40
41(call_expression
42  function: (identifier) @function)
43
44(call_expression
45  function: (member_expression
46    property: (property_identifier) @function.method))
47
48; Special identifiers
49;--------------------
50
51((identifier) @constructor
52 (#match? @constructor "^[A-Z]"))
53
54([
55    (identifier)
56    (shorthand_property_identifier)
57    (shorthand_property_identifier_pattern)
58 ] @constant
59 (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
60
61((identifier) @variable.builtin
62 (#match? @variable.builtin "^(arguments|module|console|window|document)$")
63 (#is-not? local))
64
65((identifier) @function.builtin
66 (#eq? @function.builtin "require")
67 (#is-not? local))
68
69; Literals
70;---------
71
72(this) @variable.builtin
73(super) @variable.builtin
74
75[
76  (true)
77  (false)
78  (null)
79  (undefined)
80] @constant.builtin
81
82(comment) @comment
83
84[
85  (string)
86  (template_string)
87] @string
88
89(regex) @string.special
90(number) @number
91
92; Tokens
93;-------
94
95[
96  ";"
97  (optional_chain)
98  "."
99  ","
100] @punctuation.delimiter
101
102[
103  "-"
104  "--"
105  "-="
106  "+"
107  "++"
108  "+="
109  "*"
110  "*="
111  "**"
112  "**="
113  "/"
114  "/="
115  "%"
116  "%="
117  "<"
118  "<="
119  "<<"
120  "<<="
121  "="
122  "=="
123  "==="
124  "!"
125  "!="
126  "!=="
127  "=>"
128  ">"
129  ">="
130  ">>"
131  ">>="
132  ">>>"
133  ">>>="
134  "~"
135  "^"
136  "&"
137  "|"
138  "^="
139  "&="
140  "|="
141  "&&"
142  "||"
143  "??"
144  "&&="
145  "||="
146  "??="
147] @operator
148
149[
150  "("
151  ")"
152  "["
153  "]"
154  "{"
155  "}"
156]  @punctuation.bracket
157
158(template_substitution
159  "${" @punctuation.special
160  "}" @punctuation.special) @embedded
161
162[
163  "as"
164  "async"
165  "await"
166  "break"
167  "case"
168  "catch"
169  "class"
170  "const"
171  "continue"
172  "debugger"
173  "default"
174  "delete"
175  "do"
176  "else"
177  "export"
178  "extends"
179  "finally"
180  "for"
181  "from"
182  "function"
183  "get"
184  "if"
185  "import"
186  "in"
187  "instanceof"
188  "let"
189  "new"
190  "of"
191  "return"
192  "set"
193  "static"
194  "switch"
195  "target"
196  "throw"
197  "try"
198  "typeof"
199  "var"
200  "void"
201  "while"
202  "with"
203  "yield"
204] @keyword