1 | // This file was generated by KeywordLookupGenerator.py. Do not edit. |
2 | |
3 | #if CPU(NEEDS_ALIGNED_ACCESS) |
4 | |
5 | #define COMPARE_2CHARS(address, char1, char2) \ |
6 | (((address)[0] == char1) && ((address)[1] == char2)) |
7 | #define COMPARE_4CHARS(address, char1, char2, char3, char4) \ |
8 | (COMPARE_2CHARS(address, char1, char2) && COMPARE_2CHARS((address) + 2, char3, char4)) |
9 | #define COMPARE_2UCHARS(address, char1, char2) \ |
10 | (((address)[0] == char1) && ((address)[1] == char2)) |
11 | #define COMPARE_4UCHARS(address, char1, char2, char3, char4) \ |
12 | (COMPARE_2UCHARS(address, char1, char2) && COMPARE_2UCHARS((address) + 2, char3, char4)) |
13 | |
14 | #else // CPU(NEEDS_ALIGNED_ACCESS) |
15 | |
16 | #if CPU(BIG_ENDIAN) |
17 | |
18 | #define CHARPAIR_TOUINT16(a, b) \ |
19 | ((((uint16_t)(a)) << 8) + (uint16_t)(b)) |
20 | #define CHARQUAD_TOUINT32(a, b, c, d) \ |
21 | ((((uint32_t)(CHARPAIR_TOUINT16(a, b))) << 16) + CHARPAIR_TOUINT16(c, d)) |
22 | #define UCHARPAIR_TOUINT32(a, b) \ |
23 | ((((uint32_t)(a)) << 16) + (uint32_t)(b)) |
24 | #define UCHARQUAD_TOUINT64(a, b, c, d) \ |
25 | ((((uint64_t)(UCHARQUAD_TOUINT64(a, b))) << 32) + UCHARPAIR_TOUINT32(c, d)) |
26 | |
27 | #else // CPU(BIG_ENDIAN) |
28 | |
29 | #define CHARPAIR_TOUINT16(a, b) \ |
30 | ((((uint16_t)(b)) << 8) + (uint16_t)(a)) |
31 | #define CHARQUAD_TOUINT32(a, b, c, d) \ |
32 | ((((uint32_t)(CHARPAIR_TOUINT16(c, d))) << 16) + CHARPAIR_TOUINT16(a, b)) |
33 | #define UCHARPAIR_TOUINT32(a, b) \ |
34 | ((((uint32_t)(b)) << 16) + (uint32_t)(a)) |
35 | #define UCHARQUAD_TOUINT64(a, b, c, d) \ |
36 | ((((uint64_t)(UCHARPAIR_TOUINT32(c, d))) << 32) + UCHARPAIR_TOUINT32(a, b)) |
37 | |
38 | #endif // CPU(BIG_ENDIAN) |
39 | |
40 | |
41 | #define COMPARE_2CHARS(address, char1, char2) \ |
42 | ((reinterpret_cast<const uint16_t*>(address))[0] == CHARPAIR_TOUINT16(char1, char2)) |
43 | #define COMPARE_2UCHARS(address, char1, char2) \ |
44 | ((reinterpret_cast<const uint32_t*>(address))[0] == UCHARPAIR_TOUINT32(char1, char2)) |
45 | |
46 | #if CPU(X86_64) |
47 | |
48 | #define COMPARE_4CHARS(address, char1, char2, char3, char4) \ |
49 | ((reinterpret_cast<const uint32_t*>(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4)) |
50 | #define COMPARE_4UCHARS(address, char1, char2, char3, char4) \ |
51 | ((reinterpret_cast<const uint64_t*>(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4)) |
52 | |
53 | #else // CPU(X86_64) |
54 | |
55 | #define COMPARE_4CHARS(address, char1, char2, char3, char4) \ |
56 | (COMPARE_2CHARS(address, char1, char2) && COMPARE_2CHARS((address) + 2, char3, char4)) |
57 | #define COMPARE_4UCHARS(address, char1, char2, char3, char4) \ |
58 | (COMPARE_2UCHARS(address, char1, char2) && COMPARE_2UCHARS((address) + 2, char3, char4)) |
59 | |
60 | #endif // CPU(X86_64) |
61 | |
62 | #endif // CPU(NEEDS_ALIGNED_ACCESS) |
63 | |
64 | #define COMPARE_3CHARS(address, char1, char2, char3) \ |
65 | (COMPARE_2CHARS(address, char1, char2) && ((address)[2] == (char3))) |
66 | #define COMPARE_3UCHARS(address, char1, char2, char3) \ |
67 | (COMPARE_2UCHARS(address, char1, char2) && ((address)[2] == (char3))) |
68 | #define COMPARE_5CHARS(address, char1, char2, char3, char4, char5) \ |
69 | (COMPARE_4CHARS(address, char1, char2, char3, char4) && ((address)[4] == (char5))) |
70 | #define COMPARE_5UCHARS(address, char1, char2, char3, char4, char5) \ |
71 | (COMPARE_4UCHARS(address, char1, char2, char3, char4) && ((address)[4] == (char5))) |
72 | #define COMPARE_6CHARS(address, char1, char2, char3, char4, char5, char6) \ |
73 | (COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_2CHARS(address + 4, char5, char6)) |
74 | #define COMPARE_6UCHARS(address, char1, char2, char3, char4, char5, char6) \ |
75 | (COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_2UCHARS(address + 4, char5, char6)) |
76 | #define COMPARE_7CHARS(address, char1, char2, char3, char4, char5, char6, char7) \ |
77 | (COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_4CHARS(address + 3, char4, char5, char6, char7)) |
78 | #define COMPARE_7UCHARS(address, char1, char2, char3, char4, char5, char6, char7) \ |
79 | (COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_4UCHARS(address + 3, char4, char5, char6, char7)) |
80 | #define COMPARE_8CHARS(address, char1, char2, char3, char4, char5, char6, char7, char8) \ |
81 | (COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_4CHARS(address + 4, char5, char6, char7, char8)) |
82 | #define COMPARE_8UCHARS(address, char1, char2, char3, char4, char5, char6, char7, char8) \ |
83 | (COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_4UCHARS(address + 4, char5, char6, char7, char8)) |
84 | |
85 | namespace JSC { |
86 | |
87 | static ALWAYS_INLINE bool isIdentPartIncludingEscape(const LChar* code, const LChar* codeEnd); |
88 | static ALWAYS_INLINE bool isIdentPartIncludingEscape(const UChar* code, const UChar* codeEnd); |
89 | static const int maxTokenLength = 11; |
90 | |
91 | template <> |
92 | template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer<UChar>::parseKeyword(JSTokenData* data) |
93 | { |
94 | ASSERT(m_codeEnd - m_code >= maxTokenLength); |
95 | |
96 | const UChar* code = m_code; |
97 | if (code[0] == 'f') { |
98 | if (COMPARE_7UCHARS(code + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) { |
99 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
100 | internalShift<8>(); |
101 | if (shouldCreateIdentifier) |
102 | data->ident = &m_vm->propertyNames->functionKeyword; |
103 | return FUNCTION; |
104 | } |
105 | } else if (COMPARE_2UCHARS(code + 1, 'o', 'r')) { |
106 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
107 | internalShift<3>(); |
108 | if (shouldCreateIdentifier) |
109 | data->ident = &m_vm->propertyNames->forKeyword; |
110 | return FOR; |
111 | } |
112 | } else if (COMPARE_4UCHARS(code + 1, 'a', 'l', 's', 'e')) { |
113 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
114 | internalShift<5>(); |
115 | if (shouldCreateIdentifier) |
116 | data->ident = &m_vm->propertyNames->falseKeyword; |
117 | return FALSETOKEN; |
118 | } |
119 | } else if (COMPARE_6UCHARS(code + 1, 'i', 'n', 'a', 'l', 'l', 'y')) { |
120 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
121 | internalShift<7>(); |
122 | if (shouldCreateIdentifier) |
123 | data->ident = &m_vm->propertyNames->finallyKeyword; |
124 | return FINALLY; |
125 | } |
126 | } |
127 | } else if (code[0] == 't') { |
128 | if (code[1] == 'h') { |
129 | if (COMPARE_2UCHARS(code + 2, 'i', 's')) { |
130 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
131 | internalShift<4>(); |
132 | if (shouldCreateIdentifier) |
133 | data->ident = &m_vm->propertyNames->thisKeyword; |
134 | return THISTOKEN; |
135 | } |
136 | } else if (COMPARE_4UCHARS(code + 1, 'h', 'r', 'o', 'w')) { |
137 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
138 | internalShift<5>(); |
139 | if (shouldCreateIdentifier) |
140 | data->ident = &m_vm->propertyNames->throwKeyword; |
141 | return THROW; |
142 | } |
143 | } |
144 | } else if (code[1] == 'r') { |
145 | if (COMPARE_2UCHARS(code + 2, 'u', 'e')) { |
146 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
147 | internalShift<4>(); |
148 | if (shouldCreateIdentifier) |
149 | data->ident = &m_vm->propertyNames->trueKeyword; |
150 | return TRUETOKEN; |
151 | } |
152 | } else if (code[2] == 'y') { |
153 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
154 | internalShift<3>(); |
155 | if (shouldCreateIdentifier) |
156 | data->ident = &m_vm->propertyNames->tryKeyword; |
157 | return TRY; |
158 | } |
159 | } |
160 | } else if (COMPARE_5UCHARS(code + 1, 'y', 'p', 'e', 'o', 'f')) { |
161 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
162 | internalShift<6>(); |
163 | if (shouldCreateIdentifier) |
164 | data->ident = &m_vm->propertyNames->typeofKeyword; |
165 | return TYPEOF; |
166 | } |
167 | } |
168 | } else if (code[0] == 'i') { |
169 | if (code[1] == 'f') { |
170 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
171 | internalShift<2>(); |
172 | if (shouldCreateIdentifier) |
173 | data->ident = &m_vm->propertyNames->ifKeyword; |
174 | return IF; |
175 | } |
176 | } else if (code[1] == 'n') { |
177 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
178 | internalShift<2>(); |
179 | if (shouldCreateIdentifier) |
180 | data->ident = &m_vm->propertyNames->inKeyword; |
181 | return INTOKEN; |
182 | } |
183 | if (COMPARE_7UCHARS(code + 2, 't', 'e', 'r', 'f', 'a', 'c', 'e')) { |
184 | if (!isIdentPartIncludingEscape(code+9, m_codeEnd)) { |
185 | internalShift<9>(); |
186 | if (shouldCreateIdentifier) |
187 | data->ident = &m_vm->propertyNames->interfaceKeyword; |
188 | return RESERVED_IF_STRICT; |
189 | } |
190 | } else if (COMPARE_8UCHARS(code + 2, 's', 't', 'a', 'n', 'c', 'e', 'o', 'f')) { |
191 | if (!isIdentPartIncludingEscape(code+10, m_codeEnd)) { |
192 | internalShift<10>(); |
193 | if (shouldCreateIdentifier) |
194 | data->ident = &m_vm->propertyNames->instanceofKeyword; |
195 | return INSTANCEOF; |
196 | } |
197 | } |
198 | } else if (COMPARE_2UCHARS(code + 1, 'm', 'p')) { |
199 | if (COMPARE_4UCHARS(code + 2, 'p', 'o', 'r', 't')) { |
200 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
201 | internalShift<6>(); |
202 | if (shouldCreateIdentifier) |
203 | data->ident = &m_vm->propertyNames->importKeyword; |
204 | return IMPORT; |
205 | } |
206 | } else if (COMPARE_7UCHARS(code + 3, 'l', 'e', 'm', 'e', 'n', 't', 's')) { |
207 | if (!isIdentPartIncludingEscape(code+10, m_codeEnd)) { |
208 | internalShift<10>(); |
209 | if (shouldCreateIdentifier) |
210 | data->ident = &m_vm->propertyNames->implementsKeyword; |
211 | return RESERVED_IF_STRICT; |
212 | } |
213 | } |
214 | } |
215 | } else if (code[0] == 'v') { |
216 | if (COMPARE_2UCHARS(code + 1, 'a', 'r')) { |
217 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
218 | internalShift<3>(); |
219 | if (shouldCreateIdentifier) |
220 | data->ident = &m_vm->propertyNames->varKeyword; |
221 | return VAR; |
222 | } |
223 | } else if (COMPARE_4UCHARS(code, 'v', 'o', 'i', 'd')) { |
224 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
225 | internalShift<4>(); |
226 | if (shouldCreateIdentifier) |
227 | data->ident = &m_vm->propertyNames->voidKeyword; |
228 | return VOIDTOKEN; |
229 | } |
230 | } |
231 | } else if (COMPARE_6UCHARS(code, 'r', 'e', 't', 'u', 'r', 'n')) { |
232 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
233 | internalShift<6>(); |
234 | if (shouldCreateIdentifier) |
235 | data->ident = &m_vm->propertyNames->returnKeyword; |
236 | return RETURN; |
237 | } |
238 | } else if (code[0] == 'n') { |
239 | if (COMPARE_4UCHARS(code, 'n', 'u', 'l', 'l')) { |
240 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
241 | internalShift<4>(); |
242 | if (shouldCreateIdentifier) |
243 | data->ident = &m_vm->propertyNames->nullKeyword; |
244 | return NULLTOKEN; |
245 | } |
246 | } else if (COMPARE_2UCHARS(code + 1, 'e', 'w')) { |
247 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
248 | internalShift<3>(); |
249 | if (shouldCreateIdentifier) |
250 | data->ident = &m_vm->propertyNames->newKeyword; |
251 | return NEW; |
252 | } |
253 | } |
254 | } else if (code[0] == 'e') { |
255 | if (COMPARE_4UCHARS(code, 'e', 'l', 's', 'e')) { |
256 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
257 | internalShift<4>(); |
258 | if (shouldCreateIdentifier) |
259 | data->ident = &m_vm->propertyNames->elseKeyword; |
260 | return ELSE; |
261 | } |
262 | } else if (code[1] == 'x') { |
263 | if (COMPARE_4UCHARS(code + 2, 'p', 'o', 'r', 't')) { |
264 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
265 | internalShift<6>(); |
266 | if (shouldCreateIdentifier) |
267 | data->ident = &m_vm->propertyNames->exportKeyword; |
268 | return EXPORT; |
269 | } |
270 | } else if (COMPARE_5UCHARS(code + 2, 't', 'e', 'n', 'd', 's')) { |
271 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
272 | internalShift<7>(); |
273 | if (shouldCreateIdentifier) |
274 | data->ident = &m_vm->propertyNames->extendsKeyword; |
275 | return EXTENDS; |
276 | } |
277 | } |
278 | } else if (COMPARE_4UCHARS(code, 'e', 'n', 'u', 'm')) { |
279 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
280 | internalShift<4>(); |
281 | if (shouldCreateIdentifier) |
282 | data->ident = &m_vm->propertyNames->enumKeyword; |
283 | return RESERVED; |
284 | } |
285 | } |
286 | } else if (code[0] == 'c') { |
287 | if (code[1] == 'a') { |
288 | if (COMPARE_4UCHARS(code + 1, 'a', 't', 'c', 'h')) { |
289 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
290 | internalShift<5>(); |
291 | if (shouldCreateIdentifier) |
292 | data->ident = &m_vm->propertyNames->catchKeyword; |
293 | return CATCH; |
294 | } |
295 | } else if (COMPARE_2UCHARS(code + 2, 's', 'e')) { |
296 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
297 | internalShift<4>(); |
298 | if (shouldCreateIdentifier) |
299 | data->ident = &m_vm->propertyNames->caseKeyword; |
300 | return CASE; |
301 | } |
302 | } |
303 | } else if (COMPARE_2UCHARS(code + 1, 'o', 'n')) { |
304 | if (COMPARE_5UCHARS(code + 3, 't', 'i', 'n', 'u', 'e')) { |
305 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
306 | internalShift<8>(); |
307 | if (shouldCreateIdentifier) |
308 | data->ident = &m_vm->propertyNames->continueKeyword; |
309 | return CONTINUE; |
310 | } |
311 | } else if (COMPARE_2UCHARS(code + 3, 's', 't')) { |
312 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
313 | internalShift<5>(); |
314 | if (shouldCreateIdentifier) |
315 | data->ident = &m_vm->propertyNames->constKeyword; |
316 | return CONSTTOKEN; |
317 | } |
318 | } |
319 | } else if (COMPARE_4UCHARS(code + 1, 'l', 'a', 's', 's')) { |
320 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
321 | internalShift<5>(); |
322 | if (shouldCreateIdentifier) |
323 | data->ident = &m_vm->propertyNames->classKeyword; |
324 | return CLASSTOKEN; |
325 | } |
326 | } |
327 | } else if (COMPARE_5UCHARS(code, 'b', 'r', 'e', 'a', 'k')) { |
328 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
329 | internalShift<5>(); |
330 | if (shouldCreateIdentifier) |
331 | data->ident = &m_vm->propertyNames->breakKeyword; |
332 | return BREAK; |
333 | } |
334 | } else if (code[0] == 'w') { |
335 | if (COMPARE_4UCHARS(code + 1, 'h', 'i', 'l', 'e')) { |
336 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
337 | internalShift<5>(); |
338 | if (shouldCreateIdentifier) |
339 | data->ident = &m_vm->propertyNames->whileKeyword; |
340 | return WHILE; |
341 | } |
342 | } else if (COMPARE_4UCHARS(code, 'w', 'i', 't', 'h')) { |
343 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
344 | internalShift<4>(); |
345 | if (shouldCreateIdentifier) |
346 | data->ident = &m_vm->propertyNames->withKeyword; |
347 | return WITH; |
348 | } |
349 | } |
350 | } else if (code[0] == 'd') { |
351 | if (code[1] == 'e') { |
352 | if (COMPARE_5UCHARS(code + 2, 'f', 'a', 'u', 'l', 't')) { |
353 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
354 | internalShift<7>(); |
355 | if (shouldCreateIdentifier) |
356 | data->ident = &m_vm->propertyNames->defaultKeyword; |
357 | return DEFAULT; |
358 | } |
359 | } else if (COMPARE_6UCHARS(code + 2, 'b', 'u', 'g', 'g', 'e', 'r')) { |
360 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
361 | internalShift<8>(); |
362 | if (shouldCreateIdentifier) |
363 | data->ident = &m_vm->propertyNames->debuggerKeyword; |
364 | return DEBUGGER; |
365 | } |
366 | } else if (COMPARE_4UCHARS(code + 2, 'l', 'e', 't', 'e')) { |
367 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
368 | internalShift<6>(); |
369 | if (shouldCreateIdentifier) |
370 | data->ident = &m_vm->propertyNames->deleteKeyword; |
371 | return DELETETOKEN; |
372 | } |
373 | } |
374 | } else if (code[1] == 'o') { |
375 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
376 | internalShift<2>(); |
377 | if (shouldCreateIdentifier) |
378 | data->ident = &m_vm->propertyNames->doKeyword; |
379 | return DO; |
380 | } |
381 | } |
382 | } else if (COMPARE_5UCHARS(code, 'a', 'w', 'a', 'i', 't')) { |
383 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
384 | internalShift<5>(); |
385 | if (shouldCreateIdentifier) |
386 | data->ident = &m_vm->propertyNames->awaitKeyword; |
387 | return AWAIT; |
388 | } |
389 | } else if (COMPARE_5UCHARS(code, 'y', 'i', 'e', 'l', 'd')) { |
390 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
391 | internalShift<5>(); |
392 | if (shouldCreateIdentifier) |
393 | data->ident = &m_vm->propertyNames->yieldKeyword; |
394 | return YIELD; |
395 | } |
396 | } else if (code[0] == 'p') { |
397 | if (code[1] == 'r') { |
398 | if (COMPARE_5UCHARS(code + 2, 'i', 'v', 'a', 't', 'e')) { |
399 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
400 | internalShift<7>(); |
401 | if (shouldCreateIdentifier) |
402 | data->ident = &m_vm->propertyNames->privateKeyword; |
403 | return RESERVED_IF_STRICT; |
404 | } |
405 | } else if (COMPARE_7UCHARS(code + 2, 'o', 't', 'e', 'c', 't', 'e', 'd')) { |
406 | if (!isIdentPartIncludingEscape(code+9, m_codeEnd)) { |
407 | internalShift<9>(); |
408 | if (shouldCreateIdentifier) |
409 | data->ident = &m_vm->propertyNames->protectedKeyword; |
410 | return RESERVED_IF_STRICT; |
411 | } |
412 | } |
413 | } else if (COMPARE_5UCHARS(code + 1, 'u', 'b', 'l', 'i', 'c')) { |
414 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
415 | internalShift<6>(); |
416 | if (shouldCreateIdentifier) |
417 | data->ident = &m_vm->propertyNames->publicKeyword; |
418 | return RESERVED_IF_STRICT; |
419 | } |
420 | } else if (COMPARE_6UCHARS(code + 1, 'a', 'c', 'k', 'a', 'g', 'e')) { |
421 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
422 | internalShift<7>(); |
423 | if (shouldCreateIdentifier) |
424 | data->ident = &m_vm->propertyNames->packageKeyword; |
425 | return RESERVED_IF_STRICT; |
426 | } |
427 | } |
428 | } else if (code[0] == 's') { |
429 | if (COMPARE_5UCHARS(code + 1, 'w', 'i', 't', 'c', 'h')) { |
430 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
431 | internalShift<6>(); |
432 | if (shouldCreateIdentifier) |
433 | data->ident = &m_vm->propertyNames->switchKeyword; |
434 | return SWITCH; |
435 | } |
436 | } else if (COMPARE_5UCHARS(code + 1, 't', 'a', 't', 'i', 'c')) { |
437 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
438 | internalShift<6>(); |
439 | if (shouldCreateIdentifier) |
440 | data->ident = &m_vm->propertyNames->staticKeyword; |
441 | return RESERVED_IF_STRICT; |
442 | } |
443 | } else if (COMPARE_4UCHARS(code + 1, 'u', 'p', 'e', 'r')) { |
444 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
445 | internalShift<5>(); |
446 | if (shouldCreateIdentifier) |
447 | data->ident = &m_vm->propertyNames->superKeyword; |
448 | return SUPER; |
449 | } |
450 | } |
451 | } else if (COMPARE_3UCHARS(code, 'l', 'e', 't')) { |
452 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
453 | internalShift<3>(); |
454 | if (shouldCreateIdentifier) |
455 | data->ident = &m_vm->propertyNames->letKeyword; |
456 | return LET; |
457 | } |
458 | } |
459 | return IDENT; |
460 | } |
461 | |
462 | template <> |
463 | template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer<LChar>::parseKeyword(JSTokenData* data) |
464 | { |
465 | ASSERT(m_codeEnd - m_code >= maxTokenLength); |
466 | |
467 | const LChar* code = m_code; |
468 | if (code[0] == 'f') { |
469 | if (COMPARE_7CHARS(code + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) { |
470 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
471 | internalShift<8>(); |
472 | if (shouldCreateIdentifier) |
473 | data->ident = &m_vm->propertyNames->functionKeyword; |
474 | return FUNCTION; |
475 | } |
476 | } else if (COMPARE_2CHARS(code + 1, 'o', 'r')) { |
477 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
478 | internalShift<3>(); |
479 | if (shouldCreateIdentifier) |
480 | data->ident = &m_vm->propertyNames->forKeyword; |
481 | return FOR; |
482 | } |
483 | } else if (COMPARE_4CHARS(code + 1, 'a', 'l', 's', 'e')) { |
484 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
485 | internalShift<5>(); |
486 | if (shouldCreateIdentifier) |
487 | data->ident = &m_vm->propertyNames->falseKeyword; |
488 | return FALSETOKEN; |
489 | } |
490 | } else if (COMPARE_6CHARS(code + 1, 'i', 'n', 'a', 'l', 'l', 'y')) { |
491 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
492 | internalShift<7>(); |
493 | if (shouldCreateIdentifier) |
494 | data->ident = &m_vm->propertyNames->finallyKeyword; |
495 | return FINALLY; |
496 | } |
497 | } |
498 | } else if (code[0] == 't') { |
499 | if (code[1] == 'h') { |
500 | if (COMPARE_2CHARS(code + 2, 'i', 's')) { |
501 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
502 | internalShift<4>(); |
503 | if (shouldCreateIdentifier) |
504 | data->ident = &m_vm->propertyNames->thisKeyword; |
505 | return THISTOKEN; |
506 | } |
507 | } else if (COMPARE_4CHARS(code + 1, 'h', 'r', 'o', 'w')) { |
508 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
509 | internalShift<5>(); |
510 | if (shouldCreateIdentifier) |
511 | data->ident = &m_vm->propertyNames->throwKeyword; |
512 | return THROW; |
513 | } |
514 | } |
515 | } else if (code[1] == 'r') { |
516 | if (COMPARE_2CHARS(code + 2, 'u', 'e')) { |
517 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
518 | internalShift<4>(); |
519 | if (shouldCreateIdentifier) |
520 | data->ident = &m_vm->propertyNames->trueKeyword; |
521 | return TRUETOKEN; |
522 | } |
523 | } else if (code[2] == 'y') { |
524 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
525 | internalShift<3>(); |
526 | if (shouldCreateIdentifier) |
527 | data->ident = &m_vm->propertyNames->tryKeyword; |
528 | return TRY; |
529 | } |
530 | } |
531 | } else if (COMPARE_5CHARS(code + 1, 'y', 'p', 'e', 'o', 'f')) { |
532 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
533 | internalShift<6>(); |
534 | if (shouldCreateIdentifier) |
535 | data->ident = &m_vm->propertyNames->typeofKeyword; |
536 | return TYPEOF; |
537 | } |
538 | } |
539 | } else if (code[0] == 'i') { |
540 | if (code[1] == 'f') { |
541 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
542 | internalShift<2>(); |
543 | if (shouldCreateIdentifier) |
544 | data->ident = &m_vm->propertyNames->ifKeyword; |
545 | return IF; |
546 | } |
547 | } else if (code[1] == 'n') { |
548 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
549 | internalShift<2>(); |
550 | if (shouldCreateIdentifier) |
551 | data->ident = &m_vm->propertyNames->inKeyword; |
552 | return INTOKEN; |
553 | } |
554 | if (COMPARE_7CHARS(code + 2, 't', 'e', 'r', 'f', 'a', 'c', 'e')) { |
555 | if (!isIdentPartIncludingEscape(code+9, m_codeEnd)) { |
556 | internalShift<9>(); |
557 | if (shouldCreateIdentifier) |
558 | data->ident = &m_vm->propertyNames->interfaceKeyword; |
559 | return RESERVED_IF_STRICT; |
560 | } |
561 | } else if (COMPARE_8CHARS(code + 2, 's', 't', 'a', 'n', 'c', 'e', 'o', 'f')) { |
562 | if (!isIdentPartIncludingEscape(code+10, m_codeEnd)) { |
563 | internalShift<10>(); |
564 | if (shouldCreateIdentifier) |
565 | data->ident = &m_vm->propertyNames->instanceofKeyword; |
566 | return INSTANCEOF; |
567 | } |
568 | } |
569 | } else if (COMPARE_2CHARS(code + 1, 'm', 'p')) { |
570 | if (COMPARE_4CHARS(code + 2, 'p', 'o', 'r', 't')) { |
571 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
572 | internalShift<6>(); |
573 | if (shouldCreateIdentifier) |
574 | data->ident = &m_vm->propertyNames->importKeyword; |
575 | return IMPORT; |
576 | } |
577 | } else if (COMPARE_7CHARS(code + 3, 'l', 'e', 'm', 'e', 'n', 't', 's')) { |
578 | if (!isIdentPartIncludingEscape(code+10, m_codeEnd)) { |
579 | internalShift<10>(); |
580 | if (shouldCreateIdentifier) |
581 | data->ident = &m_vm->propertyNames->implementsKeyword; |
582 | return RESERVED_IF_STRICT; |
583 | } |
584 | } |
585 | } |
586 | } else if (code[0] == 'v') { |
587 | if (COMPARE_2CHARS(code + 1, 'a', 'r')) { |
588 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
589 | internalShift<3>(); |
590 | if (shouldCreateIdentifier) |
591 | data->ident = &m_vm->propertyNames->varKeyword; |
592 | return VAR; |
593 | } |
594 | } else if (COMPARE_4CHARS(code, 'v', 'o', 'i', 'd')) { |
595 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
596 | internalShift<4>(); |
597 | if (shouldCreateIdentifier) |
598 | data->ident = &m_vm->propertyNames->voidKeyword; |
599 | return VOIDTOKEN; |
600 | } |
601 | } |
602 | } else if (COMPARE_6CHARS(code, 'r', 'e', 't', 'u', 'r', 'n')) { |
603 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
604 | internalShift<6>(); |
605 | if (shouldCreateIdentifier) |
606 | data->ident = &m_vm->propertyNames->returnKeyword; |
607 | return RETURN; |
608 | } |
609 | } else if (code[0] == 'n') { |
610 | if (COMPARE_4CHARS(code, 'n', 'u', 'l', 'l')) { |
611 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
612 | internalShift<4>(); |
613 | if (shouldCreateIdentifier) |
614 | data->ident = &m_vm->propertyNames->nullKeyword; |
615 | return NULLTOKEN; |
616 | } |
617 | } else if (COMPARE_2CHARS(code + 1, 'e', 'w')) { |
618 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
619 | internalShift<3>(); |
620 | if (shouldCreateIdentifier) |
621 | data->ident = &m_vm->propertyNames->newKeyword; |
622 | return NEW; |
623 | } |
624 | } |
625 | } else if (code[0] == 'e') { |
626 | if (COMPARE_4CHARS(code, 'e', 'l', 's', 'e')) { |
627 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
628 | internalShift<4>(); |
629 | if (shouldCreateIdentifier) |
630 | data->ident = &m_vm->propertyNames->elseKeyword; |
631 | return ELSE; |
632 | } |
633 | } else if (code[1] == 'x') { |
634 | if (COMPARE_4CHARS(code + 2, 'p', 'o', 'r', 't')) { |
635 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
636 | internalShift<6>(); |
637 | if (shouldCreateIdentifier) |
638 | data->ident = &m_vm->propertyNames->exportKeyword; |
639 | return EXPORT; |
640 | } |
641 | } else if (COMPARE_5CHARS(code + 2, 't', 'e', 'n', 'd', 's')) { |
642 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
643 | internalShift<7>(); |
644 | if (shouldCreateIdentifier) |
645 | data->ident = &m_vm->propertyNames->extendsKeyword; |
646 | return EXTENDS; |
647 | } |
648 | } |
649 | } else if (COMPARE_4CHARS(code, 'e', 'n', 'u', 'm')) { |
650 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
651 | internalShift<4>(); |
652 | if (shouldCreateIdentifier) |
653 | data->ident = &m_vm->propertyNames->enumKeyword; |
654 | return RESERVED; |
655 | } |
656 | } |
657 | } else if (code[0] == 'c') { |
658 | if (code[1] == 'a') { |
659 | if (COMPARE_4CHARS(code + 1, 'a', 't', 'c', 'h')) { |
660 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
661 | internalShift<5>(); |
662 | if (shouldCreateIdentifier) |
663 | data->ident = &m_vm->propertyNames->catchKeyword; |
664 | return CATCH; |
665 | } |
666 | } else if (COMPARE_2CHARS(code + 2, 's', 'e')) { |
667 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
668 | internalShift<4>(); |
669 | if (shouldCreateIdentifier) |
670 | data->ident = &m_vm->propertyNames->caseKeyword; |
671 | return CASE; |
672 | } |
673 | } |
674 | } else if (COMPARE_2CHARS(code + 1, 'o', 'n')) { |
675 | if (COMPARE_5CHARS(code + 3, 't', 'i', 'n', 'u', 'e')) { |
676 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
677 | internalShift<8>(); |
678 | if (shouldCreateIdentifier) |
679 | data->ident = &m_vm->propertyNames->continueKeyword; |
680 | return CONTINUE; |
681 | } |
682 | } else if (COMPARE_2CHARS(code + 3, 's', 't')) { |
683 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
684 | internalShift<5>(); |
685 | if (shouldCreateIdentifier) |
686 | data->ident = &m_vm->propertyNames->constKeyword; |
687 | return CONSTTOKEN; |
688 | } |
689 | } |
690 | } else if (COMPARE_4CHARS(code + 1, 'l', 'a', 's', 's')) { |
691 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
692 | internalShift<5>(); |
693 | if (shouldCreateIdentifier) |
694 | data->ident = &m_vm->propertyNames->classKeyword; |
695 | return CLASSTOKEN; |
696 | } |
697 | } |
698 | } else if (COMPARE_5CHARS(code, 'b', 'r', 'e', 'a', 'k')) { |
699 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
700 | internalShift<5>(); |
701 | if (shouldCreateIdentifier) |
702 | data->ident = &m_vm->propertyNames->breakKeyword; |
703 | return BREAK; |
704 | } |
705 | } else if (code[0] == 'w') { |
706 | if (COMPARE_4CHARS(code + 1, 'h', 'i', 'l', 'e')) { |
707 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
708 | internalShift<5>(); |
709 | if (shouldCreateIdentifier) |
710 | data->ident = &m_vm->propertyNames->whileKeyword; |
711 | return WHILE; |
712 | } |
713 | } else if (COMPARE_4CHARS(code, 'w', 'i', 't', 'h')) { |
714 | if (!isIdentPartIncludingEscape(code+4, m_codeEnd)) { |
715 | internalShift<4>(); |
716 | if (shouldCreateIdentifier) |
717 | data->ident = &m_vm->propertyNames->withKeyword; |
718 | return WITH; |
719 | } |
720 | } |
721 | } else if (code[0] == 'd') { |
722 | if (code[1] == 'e') { |
723 | if (COMPARE_5CHARS(code + 2, 'f', 'a', 'u', 'l', 't')) { |
724 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
725 | internalShift<7>(); |
726 | if (shouldCreateIdentifier) |
727 | data->ident = &m_vm->propertyNames->defaultKeyword; |
728 | return DEFAULT; |
729 | } |
730 | } else if (COMPARE_6CHARS(code + 2, 'b', 'u', 'g', 'g', 'e', 'r')) { |
731 | if (!isIdentPartIncludingEscape(code+8, m_codeEnd)) { |
732 | internalShift<8>(); |
733 | if (shouldCreateIdentifier) |
734 | data->ident = &m_vm->propertyNames->debuggerKeyword; |
735 | return DEBUGGER; |
736 | } |
737 | } else if (COMPARE_4CHARS(code + 2, 'l', 'e', 't', 'e')) { |
738 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
739 | internalShift<6>(); |
740 | if (shouldCreateIdentifier) |
741 | data->ident = &m_vm->propertyNames->deleteKeyword; |
742 | return DELETETOKEN; |
743 | } |
744 | } |
745 | } else if (code[1] == 'o') { |
746 | if (!isIdentPartIncludingEscape(code+2, m_codeEnd)) { |
747 | internalShift<2>(); |
748 | if (shouldCreateIdentifier) |
749 | data->ident = &m_vm->propertyNames->doKeyword; |
750 | return DO; |
751 | } |
752 | } |
753 | } else if (COMPARE_5CHARS(code, 'a', 'w', 'a', 'i', 't')) { |
754 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
755 | internalShift<5>(); |
756 | if (shouldCreateIdentifier) |
757 | data->ident = &m_vm->propertyNames->awaitKeyword; |
758 | return AWAIT; |
759 | } |
760 | } else if (COMPARE_5CHARS(code, 'y', 'i', 'e', 'l', 'd')) { |
761 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
762 | internalShift<5>(); |
763 | if (shouldCreateIdentifier) |
764 | data->ident = &m_vm->propertyNames->yieldKeyword; |
765 | return YIELD; |
766 | } |
767 | } else if (code[0] == 'p') { |
768 | if (code[1] == 'r') { |
769 | if (COMPARE_5CHARS(code + 2, 'i', 'v', 'a', 't', 'e')) { |
770 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
771 | internalShift<7>(); |
772 | if (shouldCreateIdentifier) |
773 | data->ident = &m_vm->propertyNames->privateKeyword; |
774 | return RESERVED_IF_STRICT; |
775 | } |
776 | } else if (COMPARE_7CHARS(code + 2, 'o', 't', 'e', 'c', 't', 'e', 'd')) { |
777 | if (!isIdentPartIncludingEscape(code+9, m_codeEnd)) { |
778 | internalShift<9>(); |
779 | if (shouldCreateIdentifier) |
780 | data->ident = &m_vm->propertyNames->protectedKeyword; |
781 | return RESERVED_IF_STRICT; |
782 | } |
783 | } |
784 | } else if (COMPARE_5CHARS(code + 1, 'u', 'b', 'l', 'i', 'c')) { |
785 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
786 | internalShift<6>(); |
787 | if (shouldCreateIdentifier) |
788 | data->ident = &m_vm->propertyNames->publicKeyword; |
789 | return RESERVED_IF_STRICT; |
790 | } |
791 | } else if (COMPARE_6CHARS(code + 1, 'a', 'c', 'k', 'a', 'g', 'e')) { |
792 | if (!isIdentPartIncludingEscape(code+7, m_codeEnd)) { |
793 | internalShift<7>(); |
794 | if (shouldCreateIdentifier) |
795 | data->ident = &m_vm->propertyNames->packageKeyword; |
796 | return RESERVED_IF_STRICT; |
797 | } |
798 | } |
799 | } else if (code[0] == 's') { |
800 | if (COMPARE_5CHARS(code + 1, 'w', 'i', 't', 'c', 'h')) { |
801 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
802 | internalShift<6>(); |
803 | if (shouldCreateIdentifier) |
804 | data->ident = &m_vm->propertyNames->switchKeyword; |
805 | return SWITCH; |
806 | } |
807 | } else if (COMPARE_5CHARS(code + 1, 't', 'a', 't', 'i', 'c')) { |
808 | if (!isIdentPartIncludingEscape(code+6, m_codeEnd)) { |
809 | internalShift<6>(); |
810 | if (shouldCreateIdentifier) |
811 | data->ident = &m_vm->propertyNames->staticKeyword; |
812 | return RESERVED_IF_STRICT; |
813 | } |
814 | } else if (COMPARE_4CHARS(code + 1, 'u', 'p', 'e', 'r')) { |
815 | if (!isIdentPartIncludingEscape(code+5, m_codeEnd)) { |
816 | internalShift<5>(); |
817 | if (shouldCreateIdentifier) |
818 | data->ident = &m_vm->propertyNames->superKeyword; |
819 | return SUPER; |
820 | } |
821 | } |
822 | } else if (COMPARE_3CHARS(code, 'l', 'e', 't')) { |
823 | if (!isIdentPartIncludingEscape(code+3, m_codeEnd)) { |
824 | internalShift<3>(); |
825 | if (shouldCreateIdentifier) |
826 | data->ident = &m_vm->propertyNames->letKeyword; |
827 | return LET; |
828 | } |
829 | } |
830 | return IDENT; |
831 | } |
832 | |
833 | } // namespace JSC |
834 | |