summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/ReservedWords.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/frontend/ReservedWords.h
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/frontend/ReservedWords.h')
-rw-r--r--js/src/frontend/ReservedWords.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/js/src/frontend/ReservedWords.h b/js/src/frontend/ReservedWords.h
new file mode 100644
index 0000000000..d0e234d7f7
--- /dev/null
+++ b/js/src/frontend/ReservedWords.h
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: set ts=8 sts=2 et sw=2 tw=80:
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* A higher-order macro for enumerating reserved word tokens. */
+
+#ifndef vm_ReservedWords_h
+#define vm_ReservedWords_h
+
+#define FOR_EACH_JAVASCRIPT_RESERVED_WORD(MACRO) \
+ MACRO(false, false_, TokenKind::False) \
+ MACRO(true, true_, TokenKind::True) \
+ MACRO(null, null, TokenKind::Null) \
+ \
+ /* Keywords. */ \
+ MACRO(break, break_, TokenKind::Break) \
+ MACRO(case, case_, TokenKind::Case) \
+ MACRO(catch, catch_, TokenKind::Catch) \
+ MACRO(const, const_, TokenKind::Const) \
+ MACRO(continue, continue_, TokenKind::Continue) \
+ MACRO(debugger, debugger, TokenKind::Debugger) \
+ MACRO(default, default_, TokenKind::Default) \
+ MACRO(delete, delete_, TokenKind::Delete) \
+ MACRO(do, do_, TokenKind::Do) \
+ MACRO(else, else_, TokenKind::Else) \
+ MACRO(finally, finally_, TokenKind::Finally) \
+ MACRO(for, for_, TokenKind::For) \
+ MACRO(function, function, TokenKind::Function) \
+ MACRO(if, if_, TokenKind::If) \
+ MACRO(in, in, TokenKind::In) \
+ MACRO(instanceof, instanceof, TokenKind::InstanceOf) \
+ MACRO(new, new_, TokenKind::New) \
+ MACRO(return, return_, TokenKind::Return) \
+ MACRO(switch, switch_, TokenKind::Switch) \
+ MACRO(this, this_, TokenKind::This) \
+ MACRO(throw, throw_, TokenKind::Throw) \
+ MACRO(try, try_, TokenKind::Try) \
+ MACRO(typeof, typeof_, TokenKind::TypeOf) \
+ MACRO(var, var, TokenKind::Var) \
+ MACRO(void, void_, TokenKind::Void) \
+ MACRO(while, while_, TokenKind::While) \
+ MACRO(with, with, TokenKind::With) \
+ MACRO(import, import, TokenKind::Import) \
+ MACRO(export, export_, TokenKind::Export) \
+ MACRO(class, class_, TokenKind::Class) \
+ MACRO(extends, extends, TokenKind::Extends) \
+ MACRO(super, super, TokenKind::Super) \
+ \
+ /* Future reserved words. */ \
+ MACRO(enum, enum_, TokenKind::Enum) \
+ \
+ /* Future reserved words, but only in strict mode. */ \
+ MACRO(implements, implements, TokenKind::Implements) \
+ MACRO(interface, interface, TokenKind::Interface) \
+ MACRO(package, package, TokenKind::Package) \
+ MACRO(private, private_, TokenKind::Private) \
+ MACRO(protected, protected_, TokenKind::Protected) \
+ MACRO(public, public_, TokenKind::Public) \
+ \
+ /* Contextual keywords. */ \
+ MACRO(as, as, TokenKind::As) \
+ MACRO(async, async, TokenKind::Async) \
+ MACRO(await, await, TokenKind::Await) \
+ MACRO(from, from, TokenKind::From) \
+ MACRO(get, get, TokenKind::Get) \
+ MACRO(let, let, TokenKind::Let) \
+ MACRO(meta, meta, TokenKind::Meta) \
+ MACRO(of, of, TokenKind::Of) \
+ MACRO(set, set, TokenKind::Set) \
+ MACRO(static, static_, TokenKind::Static) \
+ MACRO(target, target, TokenKind::Target) \
+ /* \
+ * Yield is a token inside function*. Outside of a function*, it is a \
+ * future reserved word in strict mode, but a keyword in JS1.7 even \
+ * when strict. Punt logic to parser. \
+ */ \
+ MACRO(yield, yield, TokenKind::Yield)
+
+#endif /* vm_ReservedWords_h */