1- catch finally;
2- async function;
3-
4- as; await; break; case;
5- class; const; continue; debugger;
6- default; delete; do; else; enum;
7- export; extends; for;
8- from; if; implements;
9- import; in; instanceof; interface; let;
10- new; null; of; package; private;
11- protected; public; return; static;
12- super; switch; this; throw; try;
13- typeof; undefined; var; void; while;
14- with; yield;
1+ as;
2+ await;
3+ break;
4+ case;
5+ class;
6+ const;
7+ continue;
8+ debugger;
9+ default;
10+ delete;
11+ do;
12+ else;
13+ enum;
14+ export;
15+ extends;
16+ for;
17+ if;
18+ implements;
19+ import;
20+ in;
21+ instanceof;
22+ interface;
23+ let;
24+ new;
25+ null;
26+ of;
27+ package;
28+ private;
29+ protected;
30+ public;
31+ return;
32+ static;
33+ super;
34+ switch;
35+ this;
36+ throw;
37+ try;
38+ typeof;
39+ undefined;
40+ var;
41+ void;
42+ while;
43+ with;
44+ yield;
1545
16- ----------------------------------------------------
46+ // contextual keywords
1747
18- [
19- ["keyword", "catch"],
20- ["keyword", "finally"], ["punctuation", ";"],
48+ try {} catch {} finally {}
49+ try {} catch (e) {} finally {}
50+ async function (){}
51+ async a => {}
52+ async (a,b,c) => {}
53+ import {} from "foo"
54+ import {} from 'foo'
55+ class { get foo(){} set baz(){} get [value](){} }
2156
22- ["keyword", "async"],
23- ["keyword", "function"], ["punctuation", ";"],
57+ // variables, not keywords
58+
59+ const { async, from, to } = bar;
60+ promise.catch(foo).finally(bar);
61+
62+ ----------------------------------------------------
2463
64+ [
2565 ["keyword", "as"], ["punctuation", ";"],
2666 ["keyword", "await"], ["punctuation", ";"],
2767 ["keyword", "break"], ["punctuation", ";"],
@@ -38,7 +78,6 @@ with; yield;
3878 ["keyword", "export"], ["punctuation", ";"],
3979 ["keyword", "extends"], ["punctuation", ";"],
4080 ["keyword", "for"], ["punctuation", ";"],
41- ["keyword", "from"], ["punctuation", ";"],
4281 ["keyword", "if"], ["punctuation", ";"],
4382 ["keyword", "implements"], ["punctuation", ";"],
4483 ["keyword", "import"], ["punctuation", ";"],
@@ -66,7 +105,122 @@ with; yield;
66105 ["keyword", "void"], ["punctuation", ";"],
67106 ["keyword", "while"], ["punctuation", ";"],
68107 ["keyword", "with"], ["punctuation", ";"],
69- ["keyword", "yield"], ["punctuation", ";"]
108+ ["keyword", "yield"], ["punctuation", ";"],
109+
110+ ["comment", "// contextual keywords"],
111+
112+ ["keyword", "try"],
113+ ["punctuation", "{"],
114+ ["punctuation", "}"],
115+ ["keyword", "catch"],
116+ ["punctuation", "{"],
117+ ["punctuation", "}"],
118+ ["keyword", "finally"],
119+ ["punctuation", "{"],
120+ ["punctuation", "}"],
121+
122+ ["keyword", "try"],
123+ ["punctuation", "{"],
124+ ["punctuation", "}"],
125+ ["keyword", "catch"],
126+ ["punctuation", "("],
127+ "e",
128+ ["punctuation", ")"],
129+ ["punctuation", "{"],
130+ ["punctuation", "}"],
131+ ["keyword", "finally"],
132+ ["punctuation", "{"],
133+ ["punctuation", "}"],
134+
135+ ["keyword", "async"],
136+ ["keyword", "function"],
137+ ["punctuation", "("],
138+ ["punctuation", ")"],
139+ ["punctuation", "{"],
140+ ["punctuation", "}"],
141+
142+ ["keyword", "async"],
143+ ["parameter", ["a"]],
144+ ["operator", "=>"],
145+ ["punctuation", "{"],
146+ ["punctuation", "}"],
147+
148+ ["keyword", "async"],
149+ ["punctuation", "("],
150+ ["parameter", [
151+ "a",
152+ ["punctuation", ","],
153+ "b",
154+ ["punctuation", ","],
155+ "c"
156+ ]],
157+ ["punctuation", ")"],
158+ ["operator", "=>"],
159+ ["punctuation", "{"],
160+ ["punctuation", "}"],
161+
162+ ["keyword", "import"],
163+ ["punctuation", "{"],
164+ ["punctuation", "}"],
165+ ["keyword", "from"],
166+ ["string", "\"foo\""],
167+
168+ ["keyword", "import"],
169+ ["punctuation", "{"],
170+ ["punctuation", "}"],
171+ ["keyword", "from"],
172+ ["string", "'foo'"],
173+
174+ ["keyword", "class"],
175+ ["punctuation", "{"],
176+ ["keyword", "get"],
177+ ["function", "foo"],
178+ ["punctuation", "("],
179+ ["punctuation", ")"],
180+ ["punctuation", "{"],
181+ ["punctuation", "}"],
182+ ["keyword", "set"],
183+ ["function", "baz"],
184+ ["punctuation", "("],
185+ ["punctuation", ")"],
186+ ["punctuation", "{"],
187+ ["punctuation", "}"],
188+ ["keyword", "get"],
189+ ["punctuation", "["],
190+ "value",
191+ ["punctuation", "]"],
192+ ["punctuation", "("],
193+ ["punctuation", ")"],
194+ ["punctuation", "{"],
195+ ["punctuation", "}"],
196+ ["punctuation", "}"],
197+
198+ ["comment", "// variables, not keywords"],
199+
200+ ["keyword", "const"],
201+ ["punctuation", "{"],
202+ " async",
203+ ["punctuation", ","],
204+ " from",
205+ ["punctuation", ","],
206+ " to ",
207+ ["punctuation", "}"],
208+ ["operator", "="],
209+ " bar",
210+ ["punctuation", ";"],
211+
212+ "\r\npromise",
213+ ["punctuation", "."],
214+ ["function", "catch"],
215+ ["punctuation", "("],
216+ "foo",
217+ ["punctuation", ")"],
218+ ["punctuation", "."],
219+ ["function", "finally"],
220+ ["punctuation", "("],
221+ "bar",
222+ ["punctuation", ")"],
223+ ["punctuation", ";"]
70224]
71225
72226----------------------------------------------------
0 commit comments