79#define DUK__MAX_RE_DECESC_DIGITS 9
80#define DUK__MAX_RE_QUANT_DIGITS 9
83#define DUK__ISDIGIT(x) ((x) >= DUK_ASC_0 && (x) <= DUK_ASC_9)
84#define DUK__ISHEXDIGIT(x) duk__is_hex_digit((x))
85#define DUK__ISOCTDIGIT(x) ((x) >= DUK_ASC_0 && (x) <= DUK_ASC_7)
86#define DUK__ISDIGIT03(x) ((x) >= DUK_ASC_0 && (x) <= DUK_ASC_3)
87#define DUK__ISDIGIT47(x) ((x) >= DUK_ASC_4 && (x) <= DUK_ASC_7)
90#define DUK__LOOKUP(lex_ctx,index) ((lex_ctx)->window[(index)].codepoint)
91#define DUK__ADVANCECHARS(lex_ctx,count) duk__advance_bytes((lex_ctx), (count) * sizeof(duk_lexer_codepoint))
92#define DUK__ADVANCEBYTES(lex_ctx,count) duk__advance_bytes((lex_ctx), (count))
93#define DUK__INITBUFFER(lex_ctx) duk__initbuffer((lex_ctx))
94#define DUK__APPENDBUFFER(lex_ctx,x) duk__appendbuffer((lex_ctx), (duk_codepoint_t) (x))
97#define DUK__L0() DUK__LOOKUP(lex_ctx, 0)
98#define DUK__L1() DUK__LOOKUP(lex_ctx, 1)
99#define DUK__L2() DUK__LOOKUP(lex_ctx, 2)
100#define DUK__L3() DUK__LOOKUP(lex_ctx, 3)
101#define DUK__L4() DUK__LOOKUP(lex_ctx, 4)
102#define DUK__L5() DUK__LOOKUP(lex_ctx, 5)
105#define DUK__ADVTOK(advbytes,tok) ((((advbytes) * sizeof(duk_lexer_codepoint)) << 8) + (tok))
176#if defined(DUK_USE_LEXER_SLIDING_WINDOW)
181 const duk_uint8_t *p, *p_end;
182#if defined(DUK_USE_STRICT_UTF8_SOURCE)
195 for (; cp != cp_end; cp++) {
197 cp->
line = input_line;
217 if ((x == 0x000aUL) ||
218 ((x == 0x000dUL) && (p >= p_end || *p != 0x000aUL))) {
243 }
else if (x < 0xe0UL) {
246#if defined(DUK_USE_STRICT_UTF8_SOURCE)
250 }
else if (x < 0xf0UL) {
253#if defined(DUK_USE_STRICT_UTF8_SOURCE)
257 }
else if (x < 0xf8UL) {
260#if defined(DUK_USE_STRICT_UTF8_SOURCE)
274 while (contlen > 0) {
277 if ((y & 0xc0U) != 0x80U) {
288 if (x > 0x10ffffUL) {
291#if defined(DUK_USE_STRICT_UTF8_SOURCE)
292 if (x < mincp || (x >= 0xd800UL && x <= 0xdfffUL) || x == 0xfffeUL) {
298 if ((x == 0x2028UL) || (x == 0x2029UL)) {
338 (
const void *) lex_ctx->
window,
339 (
size_t) avail_bytes);
354 const duk_uint8_t *p;
355#if defined(DUK_USE_STRICT_UTF8_SOURCE)
370 p = lex_ctx->
input + input_offset;
381 if ((x == 0x000aUL) ||
407 }
else if (x < 0xe0UL) {
410#if defined(DUK_USE_STRICT_UTF8_SOURCE)
414 }
else if (x < 0xf0UL) {
417#if defined(DUK_USE_STRICT_UTF8_SOURCE)
421 }
else if (x < 0xf8UL) {
424#if defined(DUK_USE_STRICT_UTF8_SOURCE)
439 for (i = 1; i < len; i++) {
442 if ((y & 0xc0U) != 0x80U) {
452 if (x > 0x10ffffUL) {
455#if defined(DUK_USE_STRICT_UTF8_SOURCE)
456 if (x < mincp || (x >= 0xd800UL && x <= 0xdfffUL) || x == 0xfffeUL) {
466 if ((x == 0x2028UL) || (x == 0x2029UL)) {
489 (
const void *) ((duk_uint8_t *) lex_ctx->
window + count_bytes),
490 (
size_t) keep_bytes);
494 for (; cp != cp_end; cp++) {
567#if defined(DUK_USE_EXPLICIT_NULL_INIT)
568#if defined(DUK_USE_LEXER_SLIDING_WINDOW)
774 goto restart_lineupdate;
806 if (last_asterisk && x ==
'/') {
812 last_asterisk = (x ==
'*');
814 goto restart_lineupdate;
815 }
else if (regexp_mode) {
816#if defined(DUK_USE_REGEXP_SUPPORT)
888 }
else if (x ==
'\\') {
890 }
else if (x ==
'[') {
893 }
else if (state == 1) {
895 }
else if (state == 2) {
898 }
else if (x ==
'\\') {
1004 }
else if (
DUK__L1() ==
'=') {
1013 }
else if (
DUK__L1() ==
'=') {
1022 }
else if (
DUK__L1() ==
'=') {
1031 }
else if (
DUK__L1() ==
'=') {
1054 }
else if (
DUK__L1() ==
'=') {
1063 }
else if (
DUK__L1() ==
'=') {
1120 if (x == 0x000d &&
DUK__L2() == 0x000a) {
1124 }
else if (x ==
'\'') {
1126 }
else if (x ==
'"') {
1128 }
else if (x ==
'\\') {
1130 }
else if (x ==
'b') {
1132 }
else if (x ==
'f') {
1134 }
else if (x ==
'n') {
1136 }
else if (x ==
'r') {
1138 }
else if (x ==
't') {
1140 }
else if (x ==
'v') {
1142 }
else if (x ==
'x') {
1145 }
else if (x ==
'u') {
1168#if defined(DUK_USE_OCTAL_SUPPORT)
1169 }
else if (strict_mode) {
1231 goto skip_slow_path;
1235 if (x == 0x000d &&
DUK__L1() == 0x000a) {
1246 goto restart_lineupdate;
1324 str = out_token->
str1;
1400 if (x ==
'0' && (y ==
'x' || y ==
'X')) {
1406#if defined(DUK_USE_OCTAL_SUPPORT)
1407 }
else if (!strict_mode && x ==
'0' &&
DUK__ISDIGIT(y)) {
1434 }
else if (x ==
'.') {
1435 if (state >= 1 || int_only) {
1440 }
else if (x ==
'e' || x ==
'E') {
1441 if (state >= 2 || int_only) {
1446 }
else if (x ==
'-' || x ==
'+') {
1466#if defined(DUK_USE_OCTAL_SUPPORT)
1489 out_token->
num = val;
1506 out_token->
t = advtok & 0xff;
1510 out_token->
lineterm = got_lineterm;
1523#if defined(DUK_USE_REGEXP_SUPPORT)
1564 out_token->
qmin = 0;
1565 out_token->
qmax = 1;
1576 out_token->
qmin = 0;
1588 out_token->
qmin = 1;
1604#if defined(DUK_USE_ES6_REGEXP_BRACES)
1608#if defined(DUK_USE_ES6_REGEXP_BRACES)
1619 }
else if (x ==
',') {
1621 goto invalid_quantifier;
1624 goto invalid_quantifier;
1629 goto invalid_quantifier;
1631 out_token->
qmin = val1;
1639 }
else if (x ==
'}') {
1641 goto invalid_quantifier;
1644 goto invalid_quantifier;
1648 out_token->
qmin = val2;
1649 out_token->
qmax = val1;
1652 out_token->
qmin = val1;
1653 out_token->
qmax = val1;
1658 goto invalid_quantifier;
1670#if defined(DUK_USE_ES6_REGEXP_BRACES)
1676 out_token->
num =
'{';
1698 }
else if (y ==
'B') {
1700 }
else if (y ==
'f') {
1701 out_token->
num = 0x000c;
1702 }
else if (y ==
'n') {
1703 out_token->
num = 0x000a;
1704 }
else if (y ==
't') {
1705 out_token->
num = 0x0009;
1706 }
else if (y ==
'r') {
1707 out_token->
num = 0x000d;
1708 }
else if (y ==
'v') {
1709 out_token->
num = 0x000b;
1710 }
else if (y ==
'c') {
1712 if ((x >=
'a' && x <=
'z') ||
1713 (x >=
'A' && x <=
'Z')) {
1714 out_token->
num = (x % 32);
1719 }
else if (y ==
'x') {
1722 }
else if (y ==
'u') {
1725 }
else if (y ==
'd') {
1727 }
else if (y ==
'D') {
1729 }
else if (y ==
's') {
1731 }
else if (y ==
'S') {
1733 }
else if (y ==
'w') {
1735 }
else if (y ==
'W') {
1743 out_token->
num = 0x0000;
1749 for (i = 0; ; i++) {
1762 out_token->
num = val;
1787 }
else if (
DUK__L2() ==
'!') {
1790 }
else if (
DUK__L2() ==
':') {
1816#if !defined(DUK_USE_ES6_REGEXP_BRACES)
1844 out_token->
t = advtok & 0xff;
1871 const duk_uint16_t *ranges,
1873 const duk_uint16_t *ranges_end;
1877 ranges_end = ranges + num;
1878 while (ranges < ranges_end) {
1902 }
else if (x ==
']') {
1905 gen_range(userdata, start, start, 0);
1908 }
else if (x ==
'-') {
1909 if (start >= 0 && !dash &&
DUK__L0() !=
']') {
1917 }
else if (x ==
'\\') {
1935 }
else if (x ==
'f') {
1937 }
else if (x ==
'n') {
1939 }
else if (x ==
't') {
1941 }
else if (x ==
'r') {
1943 }
else if (x ==
'v') {
1945 }
else if (x ==
'c') {
1948 if ((x >=
'a' && x <=
'z') ||
1949 (x >=
'A' && x <=
'Z')) {
1957 }
else if (x ==
'x') {
1960 }
else if (x ==
'u') {
1963 }
else if (x ==
'd') {
1970 }
else if (x ==
'D') {
1977 }
else if (x ==
's') {
1984 }
else if (x ==
'S') {
1991 }
else if (x ==
'w') {
1998 }
else if (x ==
'W') {
2039 gen_range(userdata, start, start, 0);
2050 gen_range(userdata, start, ch, 0);
2054 gen_range(userdata, start, start, 0);
unsigned int duk_small_uint_t
duk_uint_t duk_ucodepoint_t
duk_int_t duk_codepoint_t
duk_int_fast32_t duk_int_t
#define DUK_MEMZERO(p, n)
duk_small_int_t duk_bool_t
duk_uint32_t duk_uint_fast32_t
#define DUK_USE_NONSTD_REGEXP_DOLLAR_ESCAPE
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_part(duk_codepoint_t cp)
#define DUK_RETOK_DISJUNCTION
#define DUK_TOK_ARSHIFT_EQ
#define DUK_ERROR_RANGE(thr, msg)
#define DUK_TOK_INCREMENT
#define DUK_ASC_DOUBLEQUOTE
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_not_white[24]
DUK_INTERNAL_DECL void duk_hbuffer_resize(duk_hthread *thr, duk_hbuffer_dynamic *buf, duk_size_t new_size)
#define DUK_HBUFFER_DYNAMIC_GET_SIZE(x)
#define DUK_S2N_FLAG_ALLOW_FRAC
#define DUK_TOK_EQUALSIGN
#define DUK_RETOK_ATOM_PERIOD
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_not_digit[4]
#define DUK_ASC_EXCLAMATION
#define DUK_LEXER_BUFFER_SIZE
#define DUK_TOK_IDENTIFIER
#define DUK_UNICODE_CP_ZWNJ
#define DUK_HEAP_NUM_STRINGS
#define DUK_LEXER_WINDOW_SIZE
#define DUK_RETOK_ATOM_WORD_CHAR
#define DUK_RETOK_ATOM_START_CHARCLASS
DUK_EXTERNAL void duk_to_undefined(duk_context *ctx, duk_idx_t index)
#define DUK_S2N_FLAG_ALLOW_EMPTY_FRAC
#define DUK_STRIDX_START_RESERVED
#define DUK_LEXER_GETPOINT(ctx, pt)
#define DUK_ERROR_SYNTAX(thr, msg)
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_whitespace(duk_codepoint_t cp)
#define DUK_TOK_ALSHIFT_EQ
#define DUK_ASSERT_DISABLE(x)
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_digit[2]
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_identifier_start(duk_codepoint_t cp)
#define DUK_S2N_FLAG_ALLOW_NAKED_FRAC
DUK_EXTERNAL duk_double_t duk_to_number(duk_context *ctx, duk_idx_t index)
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_not_wordchar[10]
#define DUK_ASC_SEMICOLON
#define DUK_S2N_FLAG_ALLOW_AUTO_OCT_INT
DUK_EXTERNAL void duk_replace(duk_context *ctx, duk_idx_t to_index)
#define DUK_RETOK_ATOM_START_CHARCLASS_INVERTED
#define DUK_LEXER_SETPOINT(ctx, pt)
#define DUK_TOK_SEMICOLON
void(* duk_re_range_callback)(void *user, duk_codepoint_t r1, duk_codepoint_t r2, duk_bool_t direct)
#define DUK_S2N_FLAG_ALLOW_AUTO_HEX_INT
#define DUK_RETOK_ATOM_DIGIT
#define DUK_TOK_DECREMENT
#define DUK_LEXER_TEMP_BUF_LIMIT
#define DUK_RETOK_ATOM_END_GROUP
#define DUK_UNICODE_CP_ZWJ
#define DUK_RETOK_ATOM_NOT_WHITE
#define DUK_ASC_SINGLEQUOTE
#define DUK_RETOK_ASSERT_WORD_BOUNDARY
DUK_EXTERNAL void duk_dup(duk_context *ctx, duk_idx_t from_index)
DUK_INTERNAL const duk_int8_t duk_hex_dectab[256]
#define DUK_BW_INIT_WITHBUF(thr, bw_ctx, buf)
#define DUK_RETOK_ATOM_NOT_WORD_CHAR
#define DUK_RETOK_ATOM_START_CAPTURE_GROUP
#define DUK_RETOK_ASSERT_START
#define DUK_STRIDX_START_STRICT_RESERVED
#define DUK_TOK_RSHIFT_EQ
#define DUK_RETOK_ASSERT_START_POS_LOOKAHEAD
#define DUK_RETOK_ATOM_NOT_DIGIT
#define DUK_HTHREAD_GET_STRING(thr, idx)
#define DUK_RETOK_QUANTIFIER
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_wordchar[8]
#define DUK_RE_QUANTIFIER_INFINITE
#define DUK_STRIDX_TO_TOK(x)
#define DUK_RETOK_ATOM_START_NONCAPTURE_GROUP
DUK_INTERNAL_DECL duk_small_int_t duk_unicode_is_line_terminator(duk_codepoint_t cp)
#define DUK_RETOK_ATOM_WHITE
DUK_INTERNAL_DECL void duk_numconv_parse(duk_context *ctx, duk_small_int_t radix, duk_small_uint_t flags)
#define DUK_STRIDX_END_RESERVED
#define DUK_RETOK_ASSERT_END
#define DUK_RETOK_ATOM_BACKREFERENCE
DUK_INTERNAL_DECL duk_hstring * duk_get_hstring(duk_context *ctx, duk_idx_t index)
#define DUK_BW_PUSH_AS_STRING(thr, bw_ctx)
#define DUK_RETOK_ASSERT_START_NEG_LOOKAHEAD
#define DUK_S2N_FLAG_ALLOW_EXP
struct duk_lexer_codepoint duk_lexer_codepoint
#define DUK_RETOK_ASSERT_NOT_WORD_BOUNDARY
#define DUK_BW_WRITE_ENSURE_CESU8(thr, bw_ctx, cp)
#define DUK_RETOK_ATOM_CHAR
DUK_INTERNAL const duk_uint16_t duk_unicode_re_ranges_white[22]
#define DUK__ISHEXDIGIT(x)
DUK_LOCAL void duk__init_lexer_window(duk_lexer_ctx *lex_ctx)
#define DUK__ADVANCEBYTES(lex_ctx, count)
#define DUK__MAX_RE_QUANT_DIGITS
#define DUK__ADVTOK(advbytes, tok)
DUK_LOCAL duk_codepoint_t duk__hexval(duk_lexer_ctx *lex_ctx, duk_codepoint_t x)
#define DUK__INITBUFFER(lex_ctx)
#define DUK__ISOCTDIGIT(x)
#define DUK__ADVANCECHARS(lex_ctx, count)
DUK_INTERNAL void duk_lexer_setpoint(duk_lexer_ctx *lex_ctx, duk_lexer_point *pt)
DUK_LOCAL void duk__initbuffer(duk_lexer_ctx *lex_ctx)
DUK_LOCAL void duk__advance_bytes(duk_lexer_ctx *lex_ctx, duk_small_uint_t count_bytes)
DUK_INTERNAL void duk_lexer_parse_js_input_element(duk_lexer_ctx *lex_ctx, duk_token *out_token, duk_bool_t strict_mode, duk_bool_t regexp_mode)
DUK_LOCAL void duk__appendbuffer(duk_lexer_ctx *lex_ctx, duk_codepoint_t x)
DUK_LOCAL void duk__internbuffer(duk_lexer_ctx *lex_ctx, duk_idx_t valstack_idx)
DUK_INTERNAL void duk_lexer_parse_re_token(duk_lexer_ctx *lex_ctx, duk_re_token *out_token)
#define DUK__ISDIGIT03(x)
#define DUK__ISDIGIT47(x)
DUK_INTERNAL void duk_lexer_initctx(duk_lexer_ctx *lex_ctx)
DUK_LOCAL duk_codepoint_t duk__decode_uniesc_from_window(duk_lexer_ctx *lex_ctx, duk_small_int_t lookup_offset)
#define DUK__LOOKUP(lex_ctx, index)
#define DUK__MAX_RE_DECESC_DIGITS
DUK_LOCAL duk_codepoint_t duk__decode_hexesc_from_window(duk_lexer_ctx *lex_ctx, duk_small_int_t lookup_offset)
DUK_LOCAL void duk__emit_u16_direct_ranges(duk_lexer_ctx *lex_ctx, duk_re_range_callback gen_range, void *userdata, const duk_uint16_t *ranges, duk_small_int_t num)
DUK_INTERNAL void duk_lexer_parse_re_ranges(duk_lexer_ctx *lex_ctx, duk_re_range_callback gen_range, void *userdata)
DUK_LOCAL duk_bool_t duk__is_hex_digit(duk_codepoint_t x)
DUK_LOCAL void duk__fill_lexer_buffer(duk_lexer_ctx *lex_ctx, duk_small_uint_t start_offset_bytes)
#define DUK__APPENDBUFFER(lex_ctx, x)
duk_codepoint_t codepoint
duk_hbuffer_dynamic * buf
duk_lexer_codepoint * window
const duk_uint8_t * input
duk_lexer_codepoint buffer[DUK_LEXER_BUFFER_SIZE]
duk_bool_t allow_auto_semi