mirror of
https://github.com/darlinghq/darling-JavaScriptCore.git
synced 2024-11-26 21:50:53 +00:00
834 lines
37 KiB
C++
834 lines
37 KiB
C++
// This file was generated by KeywordLookupGenerator.py. Do not edit.
|
|
|
|
#if CPU(NEEDS_ALIGNED_ACCESS)
|
|
|
|
#define COMPARE_2CHARS(address, char1, char2) \
|
|
(((address)[0] == char1) && ((address)[1] == char2))
|
|
#define COMPARE_4CHARS(address, char1, char2, char3, char4) \
|
|
(COMPARE_2CHARS(address, char1, char2) && COMPARE_2CHARS((address) + 2, char3, char4))
|
|
#define COMPARE_2UCHARS(address, char1, char2) \
|
|
(((address)[0] == char1) && ((address)[1] == char2))
|
|
#define COMPARE_4UCHARS(address, char1, char2, char3, char4) \
|
|
(COMPARE_2UCHARS(address, char1, char2) && COMPARE_2UCHARS((address) + 2, char3, char4))
|
|
|
|
#else // CPU(NEEDS_ALIGNED_ACCESS)
|
|
|
|
#if CPU(BIG_ENDIAN)
|
|
|
|
#define CHARPAIR_TOUINT16(a, b) \
|
|
((((uint16_t)(a)) << 8) + (uint16_t)(b))
|
|
#define CHARQUAD_TOUINT32(a, b, c, d) \
|
|
((((uint32_t)(CHARPAIR_TOUINT16(a, b))) << 16) + CHARPAIR_TOUINT16(c, d))
|
|
#define UCHARPAIR_TOUINT32(a, b) \
|
|
((((uint32_t)(a)) << 16) + (uint32_t)(b))
|
|
#define UCHARQUAD_TOUINT64(a, b, c, d) \
|
|
((((uint64_t)(UCHARQUAD_TOUINT64(a, b))) << 32) + UCHARPAIR_TOUINT32(c, d))
|
|
|
|
#else // CPU(BIG_ENDIAN)
|
|
|
|
#define CHARPAIR_TOUINT16(a, b) \
|
|
((((uint16_t)(b)) << 8) + (uint16_t)(a))
|
|
#define CHARQUAD_TOUINT32(a, b, c, d) \
|
|
((((uint32_t)(CHARPAIR_TOUINT16(c, d))) << 16) + CHARPAIR_TOUINT16(a, b))
|
|
#define UCHARPAIR_TOUINT32(a, b) \
|
|
((((uint32_t)(b)) << 16) + (uint32_t)(a))
|
|
#define UCHARQUAD_TOUINT64(a, b, c, d) \
|
|
((((uint64_t)(UCHARPAIR_TOUINT32(c, d))) << 32) + UCHARPAIR_TOUINT32(a, b))
|
|
|
|
#endif // CPU(BIG_ENDIAN)
|
|
|
|
|
|
#define COMPARE_2CHARS(address, char1, char2) \
|
|
((reinterpret_cast<const uint16_t*>(address))[0] == CHARPAIR_TOUINT16(char1, char2))
|
|
#define COMPARE_2UCHARS(address, char1, char2) \
|
|
((reinterpret_cast<const uint32_t*>(address))[0] == UCHARPAIR_TOUINT32(char1, char2))
|
|
|
|
#if CPU(X86_64)
|
|
|
|
#define COMPARE_4CHARS(address, char1, char2, char3, char4) \
|
|
((reinterpret_cast<const uint32_t*>(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4))
|
|
#define COMPARE_4UCHARS(address, char1, char2, char3, char4) \
|
|
((reinterpret_cast<const uint64_t*>(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4))
|
|
|
|
#else // CPU(X86_64)
|
|
|
|
#define COMPARE_4CHARS(address, char1, char2, char3, char4) \
|
|
(COMPARE_2CHARS(address, char1, char2) && COMPARE_2CHARS((address) + 2, char3, char4))
|
|
#define COMPARE_4UCHARS(address, char1, char2, char3, char4) \
|
|
(COMPARE_2UCHARS(address, char1, char2) && COMPARE_2UCHARS((address) + 2, char3, char4))
|
|
|
|
#endif // CPU(X86_64)
|
|
|
|
#endif // CPU(NEEDS_ALIGNED_ACCESS)
|
|
|
|
#define COMPARE_3CHARS(address, char1, char2, char3) \
|
|
(COMPARE_2CHARS(address, char1, char2) && ((address)[2] == (char3)))
|
|
#define COMPARE_3UCHARS(address, char1, char2, char3) \
|
|
(COMPARE_2UCHARS(address, char1, char2) && ((address)[2] == (char3)))
|
|
#define COMPARE_5CHARS(address, char1, char2, char3, char4, char5) \
|
|
(COMPARE_4CHARS(address, char1, char2, char3, char4) && ((address)[4] == (char5)))
|
|
#define COMPARE_5UCHARS(address, char1, char2, char3, char4, char5) \
|
|
(COMPARE_4UCHARS(address, char1, char2, char3, char4) && ((address)[4] == (char5)))
|
|
#define COMPARE_6CHARS(address, char1, char2, char3, char4, char5, char6) \
|
|
(COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_2CHARS(address + 4, char5, char6))
|
|
#define COMPARE_6UCHARS(address, char1, char2, char3, char4, char5, char6) \
|
|
(COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_2UCHARS(address + 4, char5, char6))
|
|
#define COMPARE_7CHARS(address, char1, char2, char3, char4, char5, char6, char7) \
|
|
(COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_4CHARS(address + 3, char4, char5, char6, char7))
|
|
#define COMPARE_7UCHARS(address, char1, char2, char3, char4, char5, char6, char7) \
|
|
(COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_4UCHARS(address + 3, char4, char5, char6, char7))
|
|
#define COMPARE_8CHARS(address, char1, char2, char3, char4, char5, char6, char7, char8) \
|
|
(COMPARE_4CHARS(address, char1, char2, char3, char4) && COMPARE_4CHARS(address + 4, char5, char6, char7, char8))
|
|
#define COMPARE_8UCHARS(address, char1, char2, char3, char4, char5, char6, char7, char8) \
|
|
(COMPARE_4UCHARS(address, char1, char2, char3, char4) && COMPARE_4UCHARS(address + 4, char5, char6, char7, char8))
|
|
|
|
namespace JSC {
|
|
|
|
static ALWAYS_INLINE bool cannotBeIdentPartOrEscapeStart(LChar);
|
|
static ALWAYS_INLINE bool cannotBeIdentPartOrEscapeStart(UChar);
|
|
static constexpr int maxTokenLength = 11;
|
|
|
|
template <>
|
|
template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer<UChar>::parseKeyword(JSTokenData* data)
|
|
{
|
|
ASSERT(m_codeEnd - m_code >= maxTokenLength);
|
|
|
|
const UChar* code = m_code;
|
|
if (code[0] == 'f') {
|
|
if (COMPARE_7UCHARS(code + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->functionKeyword;
|
|
return FUNCTION;
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 1, 'o', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->forKeyword;
|
|
return FOR;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code + 1, 'a', 'l', 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->falseKeyword;
|
|
return FALSETOKEN;
|
|
}
|
|
} else if (COMPARE_6UCHARS(code + 1, 'i', 'n', 'a', 'l', 'l', 'y')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->finallyKeyword;
|
|
return FINALLY;
|
|
}
|
|
}
|
|
} else if (code[0] == 't') {
|
|
if (code[1] == 'h') {
|
|
if (COMPARE_2UCHARS(code + 2, 'i', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->thisKeyword;
|
|
return THISTOKEN;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code + 1, 'h', 'r', 'o', 'w')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->throwKeyword;
|
|
return THROW;
|
|
}
|
|
}
|
|
} else if (code[1] == 'r') {
|
|
if (COMPARE_2UCHARS(code + 2, 'u', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->trueKeyword;
|
|
return TRUETOKEN;
|
|
}
|
|
} else if (code[2] == 'y') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->tryKeyword;
|
|
return TRY;
|
|
}
|
|
}
|
|
} else if (COMPARE_5UCHARS(code + 1, 'y', 'p', 'e', 'o', 'f')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->typeofKeyword;
|
|
return TYPEOF;
|
|
}
|
|
}
|
|
} else if (code[0] == 'i') {
|
|
if (code[1] == 'f') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->ifKeyword;
|
|
return IF;
|
|
}
|
|
} else if (code[1] == 'n') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->inKeyword;
|
|
return INTOKEN;
|
|
}
|
|
if (COMPARE_7UCHARS(code + 2, 't', 'e', 'r', 'f', 'a', 'c', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[9]))) {
|
|
internalShift<9>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->interfaceKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_8UCHARS(code + 2, 's', 't', 'a', 'n', 'c', 'e', 'o', 'f')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[10]))) {
|
|
internalShift<10>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->instanceofKeyword;
|
|
return INSTANCEOF;
|
|
}
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 1, 'm', 'p')) {
|
|
if (COMPARE_4UCHARS(code + 2, 'p', 'o', 'r', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->importKeyword;
|
|
return IMPORT;
|
|
}
|
|
} else if (COMPARE_7UCHARS(code + 3, 'l', 'e', 'm', 'e', 'n', 't', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[10]))) {
|
|
internalShift<10>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->implementsKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
}
|
|
} else if (code[0] == 'v') {
|
|
if (COMPARE_2UCHARS(code + 1, 'a', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->varKeyword;
|
|
return VAR;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code, 'v', 'o', 'i', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->voidKeyword;
|
|
return VOIDTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_6UCHARS(code, 'r', 'e', 't', 'u', 'r', 'n')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->returnKeyword;
|
|
return RETURN;
|
|
}
|
|
} else if (code[0] == 'n') {
|
|
if (COMPARE_4UCHARS(code, 'n', 'u', 'l', 'l')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->nullKeyword;
|
|
return NULLTOKEN;
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 1, 'e', 'w')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->newKeyword;
|
|
return NEW;
|
|
}
|
|
}
|
|
} else if (code[0] == 'e') {
|
|
if (COMPARE_4UCHARS(code, 'e', 'l', 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->elseKeyword;
|
|
return ELSE;
|
|
}
|
|
} else if (code[1] == 'x') {
|
|
if (COMPARE_4UCHARS(code + 2, 'p', 'o', 'r', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->exportKeyword;
|
|
return EXPORT_;
|
|
}
|
|
} else if (COMPARE_5UCHARS(code + 2, 't', 'e', 'n', 'd', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->extendsKeyword;
|
|
return EXTENDS;
|
|
}
|
|
}
|
|
} else if (COMPARE_4UCHARS(code, 'e', 'n', 'u', 'm')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->enumKeyword;
|
|
return RESERVED;
|
|
}
|
|
}
|
|
} else if (code[0] == 'c') {
|
|
if (code[1] == 'a') {
|
|
if (COMPARE_4UCHARS(code + 1, 'a', 't', 'c', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->catchKeyword;
|
|
return CATCH;
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 2, 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->caseKeyword;
|
|
return CASE;
|
|
}
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 1, 'o', 'n')) {
|
|
if (COMPARE_5UCHARS(code + 3, 't', 'i', 'n', 'u', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->continueKeyword;
|
|
return CONTINUE;
|
|
}
|
|
} else if (COMPARE_2UCHARS(code + 3, 's', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->constKeyword;
|
|
return CONSTTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_4UCHARS(code + 1, 'l', 'a', 's', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->classKeyword;
|
|
return CLASSTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_5UCHARS(code, 'b', 'r', 'e', 'a', 'k')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->breakKeyword;
|
|
return BREAK;
|
|
}
|
|
} else if (code[0] == 'w') {
|
|
if (COMPARE_4UCHARS(code + 1, 'h', 'i', 'l', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->whileKeyword;
|
|
return WHILE;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code, 'w', 'i', 't', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->withKeyword;
|
|
return WITH;
|
|
}
|
|
}
|
|
} else if (code[0] == 'd') {
|
|
if (code[1] == 'e') {
|
|
if (COMPARE_5UCHARS(code + 2, 'f', 'a', 'u', 'l', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->defaultKeyword;
|
|
return DEFAULT;
|
|
}
|
|
} else if (COMPARE_6UCHARS(code + 2, 'b', 'u', 'g', 'g', 'e', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->debuggerKeyword;
|
|
return DEBUGGER;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code + 2, 'l', 'e', 't', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->deleteKeyword;
|
|
return DELETETOKEN;
|
|
}
|
|
}
|
|
} else if (code[1] == 'o') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->doKeyword;
|
|
return DO;
|
|
}
|
|
}
|
|
} else if (COMPARE_5UCHARS(code, 'a', 'w', 'a', 'i', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->awaitKeyword;
|
|
return AWAIT;
|
|
}
|
|
} else if (COMPARE_5UCHARS(code, 'y', 'i', 'e', 'l', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->yieldKeyword;
|
|
return YIELD;
|
|
}
|
|
} else if (code[0] == 'p') {
|
|
if (code[1] == 'r') {
|
|
if (COMPARE_5UCHARS(code + 2, 'i', 'v', 'a', 't', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->privateKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_7UCHARS(code + 2, 'o', 't', 'e', 'c', 't', 'e', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[9]))) {
|
|
internalShift<9>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->protectedKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
} else if (COMPARE_5UCHARS(code + 1, 'u', 'b', 'l', 'i', 'c')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->publicKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_6UCHARS(code + 1, 'a', 'c', 'k', 'a', 'g', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->packageKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
} else if (code[0] == 's') {
|
|
if (COMPARE_5UCHARS(code + 1, 'w', 'i', 't', 'c', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->switchKeyword;
|
|
return SWITCH;
|
|
}
|
|
} else if (COMPARE_5UCHARS(code + 1, 't', 'a', 't', 'i', 'c')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->staticKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_4UCHARS(code + 1, 'u', 'p', 'e', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->superKeyword;
|
|
return SUPER;
|
|
}
|
|
}
|
|
} else if (COMPARE_3UCHARS(code, 'l', 'e', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->letKeyword;
|
|
return LET;
|
|
}
|
|
}
|
|
return IDENT;
|
|
}
|
|
|
|
template <>
|
|
template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer<LChar>::parseKeyword(JSTokenData* data)
|
|
{
|
|
ASSERT(m_codeEnd - m_code >= maxTokenLength);
|
|
|
|
const LChar* code = m_code;
|
|
if (code[0] == 'f') {
|
|
if (COMPARE_7CHARS(code + 1, 'u', 'n', 'c', 't', 'i', 'o', 'n')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->functionKeyword;
|
|
return FUNCTION;
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 1, 'o', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->forKeyword;
|
|
return FOR;
|
|
}
|
|
} else if (COMPARE_4CHARS(code + 1, 'a', 'l', 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->falseKeyword;
|
|
return FALSETOKEN;
|
|
}
|
|
} else if (COMPARE_6CHARS(code + 1, 'i', 'n', 'a', 'l', 'l', 'y')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->finallyKeyword;
|
|
return FINALLY;
|
|
}
|
|
}
|
|
} else if (code[0] == 't') {
|
|
if (code[1] == 'h') {
|
|
if (COMPARE_2CHARS(code + 2, 'i', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->thisKeyword;
|
|
return THISTOKEN;
|
|
}
|
|
} else if (COMPARE_4CHARS(code + 1, 'h', 'r', 'o', 'w')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->throwKeyword;
|
|
return THROW;
|
|
}
|
|
}
|
|
} else if (code[1] == 'r') {
|
|
if (COMPARE_2CHARS(code + 2, 'u', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->trueKeyword;
|
|
return TRUETOKEN;
|
|
}
|
|
} else if (code[2] == 'y') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->tryKeyword;
|
|
return TRY;
|
|
}
|
|
}
|
|
} else if (COMPARE_5CHARS(code + 1, 'y', 'p', 'e', 'o', 'f')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->typeofKeyword;
|
|
return TYPEOF;
|
|
}
|
|
}
|
|
} else if (code[0] == 'i') {
|
|
if (code[1] == 'f') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->ifKeyword;
|
|
return IF;
|
|
}
|
|
} else if (code[1] == 'n') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->inKeyword;
|
|
return INTOKEN;
|
|
}
|
|
if (COMPARE_7CHARS(code + 2, 't', 'e', 'r', 'f', 'a', 'c', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[9]))) {
|
|
internalShift<9>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->interfaceKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_8CHARS(code + 2, 's', 't', 'a', 'n', 'c', 'e', 'o', 'f')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[10]))) {
|
|
internalShift<10>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->instanceofKeyword;
|
|
return INSTANCEOF;
|
|
}
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 1, 'm', 'p')) {
|
|
if (COMPARE_4CHARS(code + 2, 'p', 'o', 'r', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->importKeyword;
|
|
return IMPORT;
|
|
}
|
|
} else if (COMPARE_7CHARS(code + 3, 'l', 'e', 'm', 'e', 'n', 't', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[10]))) {
|
|
internalShift<10>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->implementsKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
}
|
|
} else if (code[0] == 'v') {
|
|
if (COMPARE_2CHARS(code + 1, 'a', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->varKeyword;
|
|
return VAR;
|
|
}
|
|
} else if (COMPARE_4CHARS(code, 'v', 'o', 'i', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->voidKeyword;
|
|
return VOIDTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_6CHARS(code, 'r', 'e', 't', 'u', 'r', 'n')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->returnKeyword;
|
|
return RETURN;
|
|
}
|
|
} else if (code[0] == 'n') {
|
|
if (COMPARE_4CHARS(code, 'n', 'u', 'l', 'l')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->nullKeyword;
|
|
return NULLTOKEN;
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 1, 'e', 'w')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->newKeyword;
|
|
return NEW;
|
|
}
|
|
}
|
|
} else if (code[0] == 'e') {
|
|
if (COMPARE_4CHARS(code, 'e', 'l', 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->elseKeyword;
|
|
return ELSE;
|
|
}
|
|
} else if (code[1] == 'x') {
|
|
if (COMPARE_4CHARS(code + 2, 'p', 'o', 'r', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->exportKeyword;
|
|
return EXPORT_;
|
|
}
|
|
} else if (COMPARE_5CHARS(code + 2, 't', 'e', 'n', 'd', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->extendsKeyword;
|
|
return EXTENDS;
|
|
}
|
|
}
|
|
} else if (COMPARE_4CHARS(code, 'e', 'n', 'u', 'm')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->enumKeyword;
|
|
return RESERVED;
|
|
}
|
|
}
|
|
} else if (code[0] == 'c') {
|
|
if (code[1] == 'a') {
|
|
if (COMPARE_4CHARS(code + 1, 'a', 't', 'c', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->catchKeyword;
|
|
return CATCH;
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 2, 's', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->caseKeyword;
|
|
return CASE;
|
|
}
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 1, 'o', 'n')) {
|
|
if (COMPARE_5CHARS(code + 3, 't', 'i', 'n', 'u', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->continueKeyword;
|
|
return CONTINUE;
|
|
}
|
|
} else if (COMPARE_2CHARS(code + 3, 's', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->constKeyword;
|
|
return CONSTTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_4CHARS(code + 1, 'l', 'a', 's', 's')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->classKeyword;
|
|
return CLASSTOKEN;
|
|
}
|
|
}
|
|
} else if (COMPARE_5CHARS(code, 'b', 'r', 'e', 'a', 'k')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->breakKeyword;
|
|
return BREAK;
|
|
}
|
|
} else if (code[0] == 'w') {
|
|
if (COMPARE_4CHARS(code + 1, 'h', 'i', 'l', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->whileKeyword;
|
|
return WHILE;
|
|
}
|
|
} else if (COMPARE_4CHARS(code, 'w', 'i', 't', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[4]))) {
|
|
internalShift<4>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->withKeyword;
|
|
return WITH;
|
|
}
|
|
}
|
|
} else if (code[0] == 'd') {
|
|
if (code[1] == 'e') {
|
|
if (COMPARE_5CHARS(code + 2, 'f', 'a', 'u', 'l', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->defaultKeyword;
|
|
return DEFAULT;
|
|
}
|
|
} else if (COMPARE_6CHARS(code + 2, 'b', 'u', 'g', 'g', 'e', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[8]))) {
|
|
internalShift<8>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->debuggerKeyword;
|
|
return DEBUGGER;
|
|
}
|
|
} else if (COMPARE_4CHARS(code + 2, 'l', 'e', 't', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->deleteKeyword;
|
|
return DELETETOKEN;
|
|
}
|
|
}
|
|
} else if (code[1] == 'o') {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[2]))) {
|
|
internalShift<2>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->doKeyword;
|
|
return DO;
|
|
}
|
|
}
|
|
} else if (COMPARE_5CHARS(code, 'a', 'w', 'a', 'i', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->awaitKeyword;
|
|
return AWAIT;
|
|
}
|
|
} else if (COMPARE_5CHARS(code, 'y', 'i', 'e', 'l', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->yieldKeyword;
|
|
return YIELD;
|
|
}
|
|
} else if (code[0] == 'p') {
|
|
if (code[1] == 'r') {
|
|
if (COMPARE_5CHARS(code + 2, 'i', 'v', 'a', 't', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->privateKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_7CHARS(code + 2, 'o', 't', 'e', 'c', 't', 'e', 'd')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[9]))) {
|
|
internalShift<9>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->protectedKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
} else if (COMPARE_5CHARS(code + 1, 'u', 'b', 'l', 'i', 'c')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->publicKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_6CHARS(code + 1, 'a', 'c', 'k', 'a', 'g', 'e')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[7]))) {
|
|
internalShift<7>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->packageKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
}
|
|
} else if (code[0] == 's') {
|
|
if (COMPARE_5CHARS(code + 1, 'w', 'i', 't', 'c', 'h')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->switchKeyword;
|
|
return SWITCH;
|
|
}
|
|
} else if (COMPARE_5CHARS(code + 1, 't', 'a', 't', 'i', 'c')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[6]))) {
|
|
internalShift<6>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->staticKeyword;
|
|
return RESERVED_IF_STRICT;
|
|
}
|
|
} else if (COMPARE_4CHARS(code + 1, 'u', 'p', 'e', 'r')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[5]))) {
|
|
internalShift<5>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->superKeyword;
|
|
return SUPER;
|
|
}
|
|
}
|
|
} else if (COMPARE_3CHARS(code, 'l', 'e', 't')) {
|
|
if (LIKELY(cannotBeIdentPartOrEscapeStart(code[3]))) {
|
|
internalShift<3>();
|
|
if (shouldCreateIdentifier)
|
|
data->ident = &m_vm.propertyNames->letKeyword;
|
|
return LET;
|
|
}
|
|
}
|
|
return IDENT;
|
|
}
|
|
|
|
} // namespace JSC
|