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