|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 /* A higher-order macro for enumerating keyword tokens. */ |
|
8 |
|
9 #ifndef vm_Keywords_h |
|
10 #define vm_Keywords_h |
|
11 |
|
12 #define FOR_EACH_JAVASCRIPT_KEYWORD(macro) \ |
|
13 macro(false, false_, TOK_FALSE, JSVERSION_DEFAULT) \ |
|
14 macro(true, true_, TOK_TRUE, JSVERSION_DEFAULT) \ |
|
15 macro(null, null, TOK_NULL, JSVERSION_DEFAULT) \ |
|
16 /* Keywords. */ \ |
|
17 macro(break, break_, TOK_BREAK, JSVERSION_DEFAULT) \ |
|
18 macro(case, case_, TOK_CASE, JSVERSION_DEFAULT) \ |
|
19 macro(catch, catch_, TOK_CATCH, JSVERSION_DEFAULT) \ |
|
20 macro(const, const_, TOK_CONST, JSVERSION_DEFAULT) \ |
|
21 macro(continue, continue_, TOK_CONTINUE, JSVERSION_DEFAULT) \ |
|
22 macro(debugger, debugger, TOK_DEBUGGER, JSVERSION_DEFAULT) \ |
|
23 macro(default, default_, TOK_DEFAULT, JSVERSION_DEFAULT) \ |
|
24 macro(delete, delete_, TOK_DELETE, JSVERSION_DEFAULT) \ |
|
25 macro(do, do_, TOK_DO, JSVERSION_DEFAULT) \ |
|
26 macro(else, else_, TOK_ELSE, JSVERSION_DEFAULT) \ |
|
27 macro(finally, finally_, TOK_FINALLY, JSVERSION_DEFAULT) \ |
|
28 macro(for, for_, TOK_FOR, JSVERSION_DEFAULT) \ |
|
29 macro(function, function, TOK_FUNCTION, JSVERSION_DEFAULT) \ |
|
30 macro(if, if_, TOK_IF, JSVERSION_DEFAULT) \ |
|
31 macro(in, in, TOK_IN, JSVERSION_DEFAULT) \ |
|
32 macro(instanceof, instanceof, TOK_INSTANCEOF, JSVERSION_DEFAULT) \ |
|
33 macro(new, new_, TOK_NEW, JSVERSION_DEFAULT) \ |
|
34 macro(return, return_, TOK_RETURN, JSVERSION_DEFAULT) \ |
|
35 macro(switch, switch_, TOK_SWITCH, JSVERSION_DEFAULT) \ |
|
36 macro(this, this_, TOK_THIS, JSVERSION_DEFAULT) \ |
|
37 macro(throw, throw_, TOK_THROW, JSVERSION_DEFAULT) \ |
|
38 macro(try, try_, TOK_TRY, JSVERSION_DEFAULT) \ |
|
39 macro(typeof, typeof, TOK_TYPEOF, JSVERSION_DEFAULT) \ |
|
40 macro(var, var, TOK_VAR, JSVERSION_DEFAULT) \ |
|
41 macro(void, void_, TOK_VOID, JSVERSION_DEFAULT) \ |
|
42 macro(while, while_, TOK_WHILE, JSVERSION_DEFAULT) \ |
|
43 macro(with, with, TOK_WITH, JSVERSION_DEFAULT) \ |
|
44 macro(import, import, TOK_IMPORT, JSVERSION_DEFAULT) \ |
|
45 macro(export, export, TOK_EXPORT, JSVERSION_DEFAULT) \ |
|
46 /* Reserved keywords. */ \ |
|
47 macro(class, class_, TOK_RESERVED, JSVERSION_DEFAULT) \ |
|
48 macro(enum, enum_, TOK_RESERVED, JSVERSION_DEFAULT) \ |
|
49 macro(extends, extends, TOK_RESERVED, JSVERSION_DEFAULT) \ |
|
50 macro(super, super, TOK_RESERVED, JSVERSION_DEFAULT) \ |
|
51 /* Future reserved keywords, but only in strict mode. */ \ |
|
52 macro(implements, implements, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
53 macro(interface, interface, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
54 macro(package, package, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
55 macro(private, private_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
56 macro(protected, protected_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
57 macro(public, public_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
58 macro(static, static_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \ |
|
59 /* \ |
|
60 * Yield is a token inside function*. Outside of a function*, it is a \ |
|
61 * future reserved keyword in strict mode, but a keyword in JS1.7 even \ |
|
62 * when strict. Punt logic to parser. \ |
|
63 */ \ |
|
64 macro(yield, yield, TOK_YIELD, JSVERSION_DEFAULT) \ |
|
65 /* \ |
|
66 * Let is a future reserved keyword in strict mode, and a keyword in \ |
|
67 * JS1.7. \ |
|
68 */ \ |
|
69 macro(let, let, TOK_LET, JSVERSION_1_7) |
|
70 |
|
71 #endif /* vm_Keywords_h */ |