js/src/vm/Keywords.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/vm/Keywords.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99:
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/* A higher-order macro for enumerating keyword tokens. */
    1.11 +
    1.12 +#ifndef vm_Keywords_h
    1.13 +#define vm_Keywords_h
    1.14 +
    1.15 +#define FOR_EACH_JAVASCRIPT_KEYWORD(macro) \
    1.16 +    macro(false, false_, TOK_FALSE, JSVERSION_DEFAULT) \
    1.17 +    macro(true, true_, TOK_TRUE, JSVERSION_DEFAULT) \
    1.18 +    macro(null, null, TOK_NULL, JSVERSION_DEFAULT) \
    1.19 +    /* Keywords. */ \
    1.20 +    macro(break, break_, TOK_BREAK, JSVERSION_DEFAULT) \
    1.21 +    macro(case, case_, TOK_CASE, JSVERSION_DEFAULT) \
    1.22 +    macro(catch, catch_, TOK_CATCH, JSVERSION_DEFAULT) \
    1.23 +    macro(const, const_, TOK_CONST, JSVERSION_DEFAULT) \
    1.24 +    macro(continue, continue_, TOK_CONTINUE, JSVERSION_DEFAULT) \
    1.25 +    macro(debugger, debugger, TOK_DEBUGGER, JSVERSION_DEFAULT) \
    1.26 +    macro(default, default_, TOK_DEFAULT, JSVERSION_DEFAULT) \
    1.27 +    macro(delete, delete_, TOK_DELETE, JSVERSION_DEFAULT) \
    1.28 +    macro(do, do_, TOK_DO, JSVERSION_DEFAULT) \
    1.29 +    macro(else, else_, TOK_ELSE, JSVERSION_DEFAULT) \
    1.30 +    macro(finally, finally_, TOK_FINALLY, JSVERSION_DEFAULT) \
    1.31 +    macro(for, for_, TOK_FOR, JSVERSION_DEFAULT) \
    1.32 +    macro(function, function, TOK_FUNCTION, JSVERSION_DEFAULT) \
    1.33 +    macro(if, if_, TOK_IF, JSVERSION_DEFAULT) \
    1.34 +    macro(in, in, TOK_IN, JSVERSION_DEFAULT) \
    1.35 +    macro(instanceof, instanceof, TOK_INSTANCEOF, JSVERSION_DEFAULT) \
    1.36 +    macro(new, new_, TOK_NEW, JSVERSION_DEFAULT) \
    1.37 +    macro(return, return_, TOK_RETURN, JSVERSION_DEFAULT) \
    1.38 +    macro(switch, switch_, TOK_SWITCH, JSVERSION_DEFAULT) \
    1.39 +    macro(this, this_, TOK_THIS, JSVERSION_DEFAULT) \
    1.40 +    macro(throw, throw_, TOK_THROW, JSVERSION_DEFAULT) \
    1.41 +    macro(try, try_, TOK_TRY, JSVERSION_DEFAULT) \
    1.42 +    macro(typeof, typeof, TOK_TYPEOF, JSVERSION_DEFAULT) \
    1.43 +    macro(var, var, TOK_VAR, JSVERSION_DEFAULT) \
    1.44 +    macro(void, void_, TOK_VOID, JSVERSION_DEFAULT) \
    1.45 +    macro(while, while_, TOK_WHILE, JSVERSION_DEFAULT) \
    1.46 +    macro(with, with, TOK_WITH, JSVERSION_DEFAULT) \
    1.47 +    macro(import, import, TOK_IMPORT, JSVERSION_DEFAULT) \
    1.48 +    macro(export, export, TOK_EXPORT, JSVERSION_DEFAULT) \
    1.49 +    /* Reserved keywords. */ \
    1.50 +    macro(class, class_, TOK_RESERVED, JSVERSION_DEFAULT) \
    1.51 +    macro(enum, enum_, TOK_RESERVED, JSVERSION_DEFAULT) \
    1.52 +    macro(extends, extends, TOK_RESERVED, JSVERSION_DEFAULT) \
    1.53 +    macro(super, super, TOK_RESERVED, JSVERSION_DEFAULT) \
    1.54 +    /* Future reserved keywords, but only in strict mode. */ \
    1.55 +    macro(implements, implements, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.56 +    macro(interface, interface, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.57 +    macro(package, package, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.58 +    macro(private, private_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.59 +    macro(protected, protected_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.60 +    macro(public, public_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.61 +    macro(static, static_, TOK_STRICT_RESERVED, JSVERSION_DEFAULT) \
    1.62 +    /* \
    1.63 +     * Yield is a token inside function*.  Outside of a function*, it is a \
    1.64 +     * future reserved keyword in strict mode, but a keyword in JS1.7 even \
    1.65 +     * when strict.  Punt logic to parser. \
    1.66 +     */ \
    1.67 +    macro(yield, yield, TOK_YIELD, JSVERSION_DEFAULT) \
    1.68 +    /* \
    1.69 +     * Let is a future reserved keyword in strict mode, and a keyword in \
    1.70 +     * JS1.7. \
    1.71 +     */ \
    1.72 +    macro(let, let, TOK_LET, JSVERSION_1_7)
    1.73 +
    1.74 +#endif /* vm_Keywords_h */

mercurial