mirror of
https://github.com/radareorg/quickjs.git
synced 2026-11-07 06:25:57 -10:00
Port Bellard's register-based regexp engine
Replace quickjs-ng's stack-based libregexp with Fabrice Bellard's
register-based backtracking engine, which
is faster and guarantees linear bytecode size growth. This also brings the
regexp implementation to full parity with upstream: v flag, regexp modifiers,
duplicate named capture groups, properties of strings, and Script=Unknown.
Includes the following upstream commits from bellard/quickjs:
7ab2341 faster and simpler implementation of regexp backtracking
a774007 removed buffer overflows introduced in regexp optimizations
371c06e ensure regexp bytecode size grows linearly with the input
47aac8b regexp: a set of registers instead of an auxiliary stack
5907aa6 added missing lre_poll_timeout()
f113949 removed alloca() in lre_exec(); \s/\S opcodes; optimized \b/\B
7bd1ae2 \x{N} is a syntax error
24379bf added regexp duplicate named groups; fixed reset of captures
f95b8ba added regexp modifiers
d7cdfdc regexp: added v flag support; CR_OP_SUB + properties of strings
fc524f7 added missing 'Unknown' unicode Script
This commit is contained in:
1 parent
4d6fe60f8f
commit
5f2fb55994
22 files changed
+4232
-2718
No files matched your search
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_builtin_array_fromasync_size = 875;
|
||||
|
||||
const uint8_t qjsc_builtin_array_fromasync[875] = {
|
||||
0x1a, 0x29, 0xd1, 0x7b, 0x48, 0x0e, 0x01, 0x28,
|
||||
0x1b, 0x29, 0xd1, 0x7b, 0x48, 0x0e, 0x01, 0x28,
|
||||
0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0xb7, 0x61,
|
||||
0x73, 0x79, 0x6e, 0x63, 0x49, 0x74, 0x65, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x01, 0x2a, 0x4f, 0x62,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_builtin_iterator_zip_keyed_size = 2582;
|
||||
|
||||
const uint8_t qjsc_builtin_iterator_zip_keyed[2582] = {
|
||||
0x1a, 0xeb, 0x00, 0x6f, 0x50, 0x2b, 0x01, 0x1c,
|
||||
0x1b, 0xeb, 0x00, 0x6f, 0x50, 0x2b, 0x01, 0x1c,
|
||||
0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x48, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x01, 0x08,
|
||||
0x63, 0x61, 0x6c, 0x6c, 0x01, 0x24, 0x68, 0x61,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_builtin_iterator_zip_size = 2621;
|
||||
|
||||
const uint8_t qjsc_builtin_iterator_zip[2621] = {
|
||||
0x1a, 0xca, 0x2d, 0xe4, 0xa6, 0x2a, 0x01, 0x1c,
|
||||
0x1b, 0xca, 0x2d, 0xe4, 0xa6, 0x2a, 0x01, 0x1c,
|
||||
0x49, 0x74, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x48, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x01, 0x08,
|
||||
0x63, 0x61, 0x6c, 0x6c, 0x01, 0x1e, 0x53, 0x79,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_function_source_size = 332;
|
||||
|
||||
const uint8_t qjsc_function_source[332] = {
|
||||
0x1a, 0x42, 0x81, 0xa1, 0x89, 0x05, 0x01, 0x30,
|
||||
0x1b, 0x42, 0x81, 0xa1, 0x89, 0x05, 0x01, 0x30,
|
||||
0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x66, 0x75,
|
||||
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6a, 0x73,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_hello_size = 108;
|
||||
|
||||
const uint8_t qjsc_hello[108] = {
|
||||
0x1a, 0x9f, 0x9e, 0xb6, 0xf5, 0x04, 0x01, 0x22,
|
||||
0x1b, 0x9f, 0x9e, 0xb6, 0xf5, 0x04, 0x01, 0x22,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
|
||||
0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x6a,
|
||||
0x73, 0x01, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_fib_module_size = 296;
|
||||
|
||||
const uint8_t qjsc_fib_module[296] = {
|
||||
0x1a, 0x0b, 0xdb, 0x78, 0x32, 0x03, 0x01, 0x2c,
|
||||
0x1b, 0x0b, 0xdb, 0x78, 0x32, 0x03, 0x01, 0x2c,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
|
||||
0x2f, 0x66, 0x69, 0x62, 0x5f, 0x6d, 0x6f, 0x64,
|
||||
0x75, 0x6c, 0x65, 0x2e, 0x6a, 0x73, 0x01, 0x06,
|
||||
@@ -47,7 +47,7 @@ const uint8_t qjsc_fib_module[296] = {
|
||||
const uint32_t qjsc_hello_module_size = 192;
|
||||
|
||||
const uint8_t qjsc_hello_module[192] = {
|
||||
0x1a, 0xee, 0x6a, 0xd3, 0x27, 0x07, 0x01, 0x30,
|
||||
0x1b, 0xee, 0x6a, 0xd3, 0x27, 0x07, 0x01, 0x30,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
|
||||
0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x5f, 0x6d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x6a, 0x73,
|
||||
|
||||
+1704
-1720
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_standalone_size = 2512;
|
||||
|
||||
const uint8_t qjsc_standalone[2512] = {
|
||||
0x1a, 0x64, 0x80, 0xb9, 0x26, 0x4c, 0x01, 0x1a,
|
||||
0x1b, 0x64, 0x80, 0xb9, 0x26, 0x4c, 0x01, 0x1a,
|
||||
0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x6c, 0x6f,
|
||||
0x6e, 0x65, 0x2e, 0x6a, 0x73, 0x01, 0x0e, 0x71,
|
||||
0x6a, 0x73, 0x3a, 0x73, 0x74, 0x64, 0x01, 0x0c,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
const uint32_t qjsc_test_fib_size = 300;
|
||||
|
||||
const uint8_t qjsc_test_fib[300] = {
|
||||
0x1a, 0x68, 0x46, 0x85, 0x68, 0x0e, 0x01, 0x28,
|
||||
0x1b, 0x68, 0x46, 0x85, 0x68, 0x0e, 0x01, 0x28,
|
||||
0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73,
|
||||
0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x69,
|
||||
0x62, 0x2e, 0x6a, 0x73, 0x01, 0x0c, 0x71, 0x6a,
|
||||
|
||||
+26
-11
@@ -25,34 +25,49 @@
|
||||
#ifdef DEF
|
||||
|
||||
DEF(invalid, 1) /* never used */
|
||||
DEF(char8, 2) /* 7 bits in fact */
|
||||
DEF(char16, 3)
|
||||
DEF(char, 3)
|
||||
DEF(char_i, 3)
|
||||
DEF(char32, 5)
|
||||
DEF(char32_i, 5)
|
||||
DEF(dot, 1)
|
||||
DEF(any, 1) /* same as dot but match any character including line terminator */
|
||||
DEF(space, 1)
|
||||
DEF(not_space, 1) /* must come after */
|
||||
DEF(line_start, 1)
|
||||
DEF(line_start_m, 1)
|
||||
DEF(line_end, 1)
|
||||
DEF(line_end_m, 1)
|
||||
DEF(goto, 5)
|
||||
DEF(split_goto_first, 5)
|
||||
DEF(split_next_first, 5)
|
||||
DEF(match, 1)
|
||||
DEF(lookahead_match, 1)
|
||||
DEF(negative_lookahead_match, 1) /* must come after */
|
||||
DEF(save_start, 2) /* save start position */
|
||||
DEF(save_end, 2) /* save end position, must come after saved_start */
|
||||
DEF(save_reset, 3) /* reset save positions */
|
||||
DEF(loop, 5) /* decrement the top the stack and goto if != 0 */
|
||||
DEF(push_i32, 5) /* push integer on the stack */
|
||||
DEF(drop, 1)
|
||||
DEF(loop, 6) /* decrement the top the stack and goto if != 0 */
|
||||
DEF(loop_split_goto_first, 10) /* loop and then split */
|
||||
DEF(loop_split_next_first, 10)
|
||||
DEF(loop_check_adv_split_goto_first, 10) /* loop and then check advance and split */
|
||||
DEF(loop_check_adv_split_next_first, 10)
|
||||
DEF(set_i32, 6) /* store the immediate value to a register */
|
||||
DEF(word_boundary, 1)
|
||||
DEF(word_boundary_i, 1)
|
||||
DEF(not_word_boundary, 1)
|
||||
DEF(back_reference, 2)
|
||||
DEF(backward_back_reference, 2) /* must come after back_reference */
|
||||
DEF(not_word_boundary_i, 1)
|
||||
DEF(back_reference, 2) /* variable length */
|
||||
DEF(back_reference_i, 2) /* must come after */
|
||||
DEF(backward_back_reference, 2) /* must come after */
|
||||
DEF(backward_back_reference_i, 2) /* must come after */
|
||||
DEF(range, 3) /* variable length */
|
||||
DEF(range_i, 3) /* variable length */
|
||||
DEF(range32, 3) /* variable length */
|
||||
DEF(range32_i, 3) /* variable length */
|
||||
DEF(lookahead, 5)
|
||||
DEF(negative_lookahead, 5)
|
||||
DEF(push_char_pos, 1) /* push the character position on the stack */
|
||||
DEF(check_advance, 1) /* pop one stack element and check that it is different from the character position */
|
||||
DEF(negative_lookahead, 5) /* must come after */
|
||||
DEF(set_char_pos, 2) /* store the character position to a register */
|
||||
DEF(check_advance, 2) /* check that the register is different from the character position */
|
||||
DEF(prev, 1) /* go to the previous char */
|
||||
DEF(simple_greedy_quant, 17)
|
||||
|
||||
#endif /* DEF */
|
||||
+1604
-740
File diff suppressed because it is too large.
Load diff
+6
-1
@@ -47,9 +47,14 @@ extern "C" {
|
||||
#define LRE_RET_TIMEOUT (-2)
|
||||
#define LRE_RET_BYTECODE_ERROR (-3)
|
||||
|
||||
/* trailer length after the group name including the trailing '\0' */
|
||||
#define LRE_GROUP_NAME_TRAILER_LEN 2
|
||||
|
||||
uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size,
|
||||
const char *buf, size_t buf_len, int re_flags,
|
||||
void *opaque);
|
||||
int lre_get_alloc_count(const uint8_t *bc_buf);
|
||||
int lre_check_bytecode(const uint8_t *bc_buf, int bc_buf_len);
|
||||
int lre_get_capture_count(const uint8_t *bc_buf);
|
||||
int lre_get_flags(const uint8_t *bc_buf);
|
||||
const char *lre_get_groupnames(const uint8_t *bc_buf);
|
||||
@@ -58,7 +63,7 @@ int lre_exec(uint8_t **capture,
|
||||
int cbuf_type, void *opaque);
|
||||
|
||||
int lre_parse_escape(const uint8_t **pp, int allow_utf16);
|
||||
bool lre_is_space(int c);
|
||||
/* lre_is_space() is provided as an inline in libunicode.h */
|
||||
|
||||
/* must be provided by the user */
|
||||
bool lre_check_stack_overflow(void *opaque, size_t alloca_size);
|
||||
|
||||
@@ -4515,6 +4515,10 @@ typedef enum {
|
||||
UNICODE_PROP_Changes_When_Titlecased1,
|
||||
UNICODE_PROP_Changes_When_Casefolded1,
|
||||
UNICODE_PROP_Changes_When_NFKC_Casefolded1,
|
||||
UNICODE_PROP_Basic_Emoji1,
|
||||
UNICODE_PROP_Basic_Emoji2,
|
||||
UNICODE_PROP_RGI_Emoji_Flag_Sequence,
|
||||
UNICODE_PROP_Emoji_Keycap_Sequence,
|
||||
UNICODE_PROP_ASCII_Hex_Digit,
|
||||
UNICODE_PROP_Bidi_Control,
|
||||
UNICODE_PROP_Dash,
|
||||
@@ -4637,6 +4641,89 @@ static const char unicode_prop_name_table[] =
|
||||
"XID_Start,XIDS" "\0"
|
||||
;
|
||||
|
||||
/* RGI emoji sequence support */
|
||||
static const uint8_t unicode_prop_Basic_Emoji1_table[144] = {
|
||||
0x60, 0x23, 0x19, 0x81, 0x40, 0xcc, 0x1a, 0x01,
|
||||
0x80, 0x42, 0x08, 0x81, 0x94, 0x81, 0xb1, 0x8b,
|
||||
0xaa, 0x80, 0x92, 0x80, 0x8c, 0x07, 0x81, 0x90,
|
||||
0x0c, 0x0f, 0x04, 0x80, 0x94, 0x06, 0x08, 0x03,
|
||||
0x01, 0x06, 0x03, 0x81, 0x9b, 0x80, 0xa2, 0x00,
|
||||
0x03, 0x10, 0x80, 0xbc, 0x82, 0x97, 0x80, 0x8d,
|
||||
0x80, 0x43, 0x5a, 0x81, 0xb2, 0x03, 0x80, 0x61,
|
||||
0xc4, 0xad, 0x80, 0x40, 0xc9, 0x80, 0x40, 0xbd,
|
||||
0x01, 0x89, 0xe5, 0x80, 0x97, 0x80, 0x93, 0x01,
|
||||
0x20, 0x82, 0x94, 0x81, 0x40, 0xad, 0xa0, 0x8b,
|
||||
0x88, 0x80, 0xc5, 0x80, 0x95, 0x8b, 0xaa, 0x1c,
|
||||
0x8b, 0x90, 0x10, 0x82, 0xc6, 0x00, 0x80, 0x40,
|
||||
0xba, 0x81, 0xbe, 0x8c, 0x18, 0x97, 0x91, 0x80,
|
||||
0x99, 0x81, 0x8c, 0x80, 0xd5, 0xd4, 0xaf, 0xc5,
|
||||
0x28, 0x12, 0x0b, 0x13, 0x8a, 0x0e, 0x88, 0x40,
|
||||
0xe2, 0x8b, 0x18, 0x41, 0x1a, 0xae, 0x80, 0x89,
|
||||
0x80, 0x40, 0xb8, 0xef, 0x8c, 0x82, 0x8a, 0x82,
|
||||
0xb8, 0x00, 0x83, 0x8f, 0x81, 0x8b, 0x83, 0x89,
|
||||
};
|
||||
|
||||
static const uint8_t unicode_prop_Basic_Emoji2_table[183] = {
|
||||
0x40, 0xa8, 0x03, 0x80, 0x5f, 0x8c, 0x80, 0x8b,
|
||||
0x80, 0x40, 0xd7, 0x80, 0x95, 0x80, 0xd9, 0x85,
|
||||
0x8e, 0x81, 0x41, 0x7c, 0x80, 0x40, 0xa5, 0x80,
|
||||
0x9c, 0x10, 0x0c, 0x82, 0x40, 0xc6, 0x80, 0x40,
|
||||
0xe6, 0x81, 0x89, 0x80, 0x88, 0x80, 0xb9, 0x0a,
|
||||
0x84, 0x88, 0x01, 0x05, 0x03, 0x01, 0x00, 0x09,
|
||||
0x02, 0x02, 0x0f, 0x14, 0x00, 0x80, 0x9b, 0x09,
|
||||
0x00, 0x08, 0x80, 0x91, 0x01, 0x80, 0x92, 0x00,
|
||||
0x18, 0x00, 0x0a, 0x05, 0x07, 0x81, 0x95, 0x05,
|
||||
0x00, 0x00, 0x80, 0x94, 0x05, 0x09, 0x01, 0x17,
|
||||
0x04, 0x09, 0x08, 0x01, 0x00, 0x00, 0x05, 0x02,
|
||||
0x80, 0x90, 0x81, 0x8e, 0x01, 0x80, 0x9a, 0x81,
|
||||
0xbb, 0x80, 0x41, 0x91, 0x81, 0x41, 0xce, 0x82,
|
||||
0x45, 0x27, 0x80, 0x8b, 0x80, 0x42, 0x58, 0x00,
|
||||
0x80, 0x61, 0xbe, 0xd5, 0x81, 0x8b, 0x81, 0x40,
|
||||
0x81, 0x80, 0xb3, 0x80, 0x40, 0xe8, 0x01, 0x88,
|
||||
0x88, 0x80, 0xc5, 0x80, 0x97, 0x08, 0x11, 0x81,
|
||||
0xaa, 0x1c, 0x8b, 0x92, 0x00, 0x00, 0x80, 0xc6,
|
||||
0x00, 0x80, 0x40, 0xba, 0x80, 0xca, 0x81, 0xa3,
|
||||
0x09, 0x86, 0x8c, 0x01, 0x19, 0x80, 0x93, 0x01,
|
||||
0x07, 0x81, 0x88, 0x04, 0x82, 0x8b, 0x17, 0x11,
|
||||
0x00, 0x03, 0x05, 0x02, 0x05, 0x80, 0x40, 0xcf,
|
||||
0x00, 0x82, 0x8f, 0x2a, 0x05, 0x01, 0x80,
|
||||
};
|
||||
|
||||
static const uint8_t unicode_prop_RGI_Emoji_Modifier_Sequence_table[72] = {
|
||||
0x60, 0x26, 0x1c, 0x80, 0x40, 0xda, 0x80, 0x8f,
|
||||
0x83, 0x61, 0xcc, 0x76, 0x80, 0xbb, 0x11, 0x01,
|
||||
0x82, 0xf4, 0x09, 0x8a, 0x94, 0x18, 0x8d, 0x10,
|
||||
0x1a, 0x02, 0x30, 0x00, 0x97, 0x80, 0x40, 0xc8,
|
||||
0x0b, 0x80, 0x94, 0x03, 0x81, 0x40, 0xad, 0x12,
|
||||
0x84, 0xd2, 0x80, 0x8f, 0x82, 0x88, 0x80, 0x8a,
|
||||
0x80, 0x42, 0x3e, 0x01, 0x07, 0x3d, 0x80, 0x88,
|
||||
0x89, 0x0a, 0xb7, 0x80, 0xbc, 0x08, 0x08, 0x80,
|
||||
0x90, 0x10, 0x8c, 0x40, 0xe4, 0x82, 0xa9, 0x88,
|
||||
};
|
||||
|
||||
static const uint8_t unicode_prop_RGI_Emoji_Flag_Sequence_table[128] = {
|
||||
0x0c, 0x00, 0x09, 0x00, 0x04, 0x01, 0x02, 0x06,
|
||||
0x03, 0x03, 0x01, 0x02, 0x01, 0x03, 0x07, 0x0d,
|
||||
0x18, 0x00, 0x09, 0x00, 0x00, 0x89, 0x08, 0x00,
|
||||
0x00, 0x81, 0x88, 0x83, 0x8c, 0x10, 0x00, 0x01,
|
||||
0x07, 0x08, 0x29, 0x10, 0x28, 0x00, 0x80, 0x8a,
|
||||
0x00, 0x0a, 0x00, 0x0e, 0x15, 0x18, 0x83, 0x89,
|
||||
0x06, 0x00, 0x81, 0x8d, 0x00, 0x12, 0x08, 0x00,
|
||||
0x03, 0x00, 0x24, 0x00, 0x05, 0x21, 0x00, 0x00,
|
||||
0x29, 0x90, 0x00, 0x02, 0x00, 0x08, 0x09, 0x00,
|
||||
0x08, 0x18, 0x8b, 0x80, 0x8c, 0x02, 0x19, 0x1a,
|
||||
0x11, 0x00, 0x00, 0x80, 0x9c, 0x80, 0x88, 0x02,
|
||||
0x00, 0x00, 0x02, 0x20, 0x88, 0x0a, 0x00, 0x03,
|
||||
0x01, 0x02, 0x05, 0x08, 0x00, 0x01, 0x09, 0x20,
|
||||
0x21, 0x18, 0x22, 0x00, 0x00, 0x00, 0x00, 0x18,
|
||||
0x28, 0x89, 0x80, 0x8b, 0x80, 0x90, 0x80, 0x92,
|
||||
0x80, 0x8d, 0x05, 0x80, 0x8a, 0x80, 0x88, 0x80,
|
||||
};
|
||||
|
||||
static const uint8_t unicode_prop_Emoji_Keycap_Sequence_table[4] = {
|
||||
0xa2, 0x05, 0x04, 0x89,
|
||||
};
|
||||
|
||||
static const uint8_t * const unicode_prop_table[] = {
|
||||
unicode_prop_Hyphen_table,
|
||||
unicode_prop_Other_Math_table,
|
||||
@@ -4654,6 +4741,10 @@ static const uint8_t * const unicode_prop_table[] = {
|
||||
unicode_prop_Changes_When_Titlecased1_table,
|
||||
unicode_prop_Changes_When_Casefolded1_table,
|
||||
unicode_prop_Changes_When_NFKC_Casefolded1_table,
|
||||
unicode_prop_Basic_Emoji1_table,
|
||||
unicode_prop_Basic_Emoji2_table,
|
||||
unicode_prop_RGI_Emoji_Flag_Sequence_table,
|
||||
unicode_prop_Emoji_Keycap_Sequence_table,
|
||||
unicode_prop_ASCII_Hex_Digit_table,
|
||||
unicode_prop_Bidi_Control_table,
|
||||
unicode_prop_Dash_table,
|
||||
@@ -4709,6 +4800,10 @@ static const uint16_t unicode_prop_len_table[] = {
|
||||
countof(unicode_prop_Changes_When_Titlecased1_table),
|
||||
countof(unicode_prop_Changes_When_Casefolded1_table),
|
||||
countof(unicode_prop_Changes_When_NFKC_Casefolded1_table),
|
||||
countof(unicode_prop_Basic_Emoji1_table),
|
||||
countof(unicode_prop_Basic_Emoji2_table),
|
||||
countof(unicode_prop_RGI_Emoji_Flag_Sequence_table),
|
||||
countof(unicode_prop_Emoji_Keycap_Sequence_table),
|
||||
countof(unicode_prop_ASCII_Hex_Digit_table),
|
||||
countof(unicode_prop_Bidi_Control_table),
|
||||
countof(unicode_prop_Dash_table),
|
||||
@@ -4747,3 +4842,332 @@ static const uint16_t unicode_prop_len_table[] = {
|
||||
countof(unicode_prop_Case_Ignorable_table),
|
||||
};
|
||||
|
||||
/* RGI emoji sequence-property tables */
|
||||
typedef enum {
|
||||
UNICODE_SEQUENCE_PROP_Basic_Emoji,
|
||||
UNICODE_SEQUENCE_PROP_Emoji_Keycap_Sequence,
|
||||
UNICODE_SEQUENCE_PROP_RGI_Emoji_Modifier_Sequence,
|
||||
UNICODE_SEQUENCE_PROP_RGI_Emoji_Flag_Sequence,
|
||||
UNICODE_SEQUENCE_PROP_RGI_Emoji_Tag_Sequence,
|
||||
UNICODE_SEQUENCE_PROP_RGI_Emoji_ZWJ_Sequence,
|
||||
UNICODE_SEQUENCE_PROP_RGI_Emoji,
|
||||
UNICODE_SEQUENCE_PROP_COUNT,
|
||||
} UnicodeSequencePropertyEnum;
|
||||
|
||||
static const char unicode_sequence_prop_name_table[] =
|
||||
"Basic_Emoji" "\0"
|
||||
"Emoji_Keycap_Sequence" "\0"
|
||||
"RGI_Emoji_Modifier_Sequence" "\0"
|
||||
"RGI_Emoji_Flag_Sequence" "\0"
|
||||
"RGI_Emoji_Tag_Sequence" "\0"
|
||||
"RGI_Emoji_ZWJ_Sequence" "\0"
|
||||
"RGI_Emoji" "\0"
|
||||
;
|
||||
|
||||
static const uint8_t unicode_rgi_emoji_tag_sequence[18] = {
|
||||
0x67, 0x62, 0x65, 0x6e, 0x67, 0x00, 0x67, 0x62,
|
||||
0x73, 0x63, 0x74, 0x00, 0x67, 0x62, 0x77, 0x6c,
|
||||
0x73, 0x00,
|
||||
};
|
||||
|
||||
static const uint8_t unicode_rgi_emoji_zwj_sequence[2392] = {
|
||||
0x02, 0xb8, 0x19, 0x40, 0x86, 0x02, 0xd1, 0x39,
|
||||
0xb0, 0x19, 0x02, 0x26, 0x39, 0x42, 0x86, 0x02,
|
||||
0xb4, 0x36, 0x42, 0x86, 0x03, 0x68, 0x54, 0x64,
|
||||
0x87, 0x68, 0x54, 0x02, 0xdc, 0x39, 0x42, 0x86,
|
||||
0x02, 0xd1, 0x39, 0x73, 0x13, 0x02, 0x39, 0x39,
|
||||
0x40, 0x86, 0x02, 0x69, 0x34, 0xbd, 0x19, 0x03,
|
||||
0xb6, 0x36, 0x40, 0x86, 0xa1, 0x87, 0x03, 0x68,
|
||||
0x74, 0x1d, 0x19, 0x68, 0x74, 0x03, 0x68, 0x34,
|
||||
0xbd, 0x19, 0xa1, 0x87, 0x02, 0xf1, 0x7a, 0xf2,
|
||||
0x7a, 0x02, 0xca, 0x33, 0x42, 0x86, 0x02, 0x69,
|
||||
0x34, 0xb0, 0x19, 0x04, 0x68, 0x14, 0x68, 0x14,
|
||||
0x67, 0x14, 0x66, 0x14, 0x02, 0xf9, 0x26, 0x42,
|
||||
0x86, 0x03, 0x69, 0x74, 0x1d, 0x19, 0x69, 0x74,
|
||||
0x03, 0xd1, 0x19, 0xbc, 0x19, 0xa1, 0x87, 0x02,
|
||||
0x3c, 0x19, 0x40, 0x86, 0x02, 0x68, 0x34, 0xeb,
|
||||
0x13, 0x02, 0xc3, 0x33, 0xa1, 0x87, 0x02, 0x70,
|
||||
0x34, 0x40, 0x86, 0x02, 0xd4, 0x39, 0x42, 0x86,
|
||||
0x02, 0xcf, 0x39, 0x42, 0x86, 0x03, 0xd1, 0x79,
|
||||
0xef, 0x1a, 0xd1, 0x79, 0x03, 0x68, 0x74, 0xef,
|
||||
0x1a, 0x68, 0x74, 0x03, 0x69, 0x74, 0xef, 0x1a,
|
||||
0x69, 0x74, 0x02, 0x47, 0x36, 0x40, 0x86, 0x03,
|
||||
0x68, 0x74, 0x30, 0x14, 0x68, 0x74, 0x02, 0x39,
|
||||
0x39, 0x42, 0x86, 0x04, 0xd1, 0x79, 0x64, 0x87,
|
||||
0x8b, 0x14, 0xd1, 0x79, 0x03, 0x69, 0x74, 0x30,
|
||||
0x14, 0x69, 0x74, 0x02, 0xd1, 0x39, 0x95, 0x86,
|
||||
0x02, 0x68, 0x34, 0x93, 0x13, 0x02, 0x69, 0x34,
|
||||
0xed, 0x13, 0x02, 0xda, 0x39, 0x40, 0x86, 0x03,
|
||||
0x69, 0x34, 0xaf, 0x19, 0xa1, 0x87, 0x02, 0xd1,
|
||||
0x39, 0x93, 0x13, 0x03, 0xce, 0x39, 0x42, 0x86,
|
||||
0xa1, 0x87, 0x03, 0xd1, 0x79, 0x64, 0x87, 0xd1,
|
||||
0x79, 0x03, 0xc3, 0x33, 0x42, 0x86, 0xa1, 0x87,
|
||||
0x03, 0x69, 0x74, 0x1d, 0x19, 0x68, 0x74, 0x02,
|
||||
0x69, 0x34, 0x92, 0x16, 0x02, 0xd1, 0x39, 0x96,
|
||||
0x86, 0x04, 0x69, 0x14, 0x64, 0x87, 0x8b, 0x14,
|
||||
0x68, 0x14, 0x02, 0x47, 0x36, 0x42, 0x86, 0x02,
|
||||
0x68, 0x34, 0x7c, 0x13, 0x02, 0x86, 0x34, 0x42,
|
||||
0x86, 0x02, 0xd1, 0x39, 0x7c, 0x13, 0x02, 0x69,
|
||||
0x14, 0xa4, 0x13, 0x02, 0xda, 0x39, 0x42, 0x86,
|
||||
0x02, 0x37, 0x39, 0x40, 0x86, 0x02, 0xd1, 0x39,
|
||||
0x08, 0x87, 0x04, 0x68, 0x54, 0x64, 0x87, 0x8b,
|
||||
0x14, 0x68, 0x54, 0x02, 0x4d, 0x36, 0x40, 0x86,
|
||||
0x02, 0x68, 0x34, 0x2c, 0x15, 0x02, 0x69, 0x34,
|
||||
0xaf, 0x19, 0x02, 0x6e, 0x34, 0x40, 0x86, 0x02,
|
||||
0xcd, 0x39, 0x42, 0x86, 0x02, 0xd1, 0x39, 0x2c,
|
||||
0x15, 0x02, 0x6f, 0x14, 0x40, 0x86, 0x03, 0xd1,
|
||||
0x39, 0xbc, 0x19, 0xa1, 0x87, 0x02, 0x68, 0x34,
|
||||
0xa8, 0x13, 0x02, 0x69, 0x34, 0x73, 0x13, 0x04,
|
||||
0x69, 0x54, 0x64, 0x87, 0x8b, 0x14, 0x68, 0x54,
|
||||
0x02, 0x71, 0x34, 0x42, 0x86, 0x02, 0x45, 0x36,
|
||||
0x40, 0x86, 0x02, 0xd1, 0x39, 0xa8, 0x13, 0x03,
|
||||
0x69, 0x54, 0x64, 0x87, 0x68, 0x54, 0x03, 0x69,
|
||||
0x54, 0x64, 0x87, 0x69, 0x54, 0x03, 0xce, 0x39,
|
||||
0x40, 0x86, 0xa1, 0x87, 0x02, 0xd8, 0x39, 0x40,
|
||||
0x86, 0x03, 0xc3, 0x33, 0x40, 0x86, 0xa1, 0x87,
|
||||
0x02, 0x4d, 0x36, 0x42, 0x86, 0x02, 0xd1, 0x19,
|
||||
0x92, 0x16, 0x02, 0xd1, 0x39, 0xeb, 0x13, 0x02,
|
||||
0x68, 0x34, 0xbc, 0x14, 0x02, 0xd1, 0x39, 0xbc,
|
||||
0x14, 0x02, 0x3d, 0x39, 0x40, 0x86, 0x02, 0xb8,
|
||||
0x39, 0x42, 0x86, 0x02, 0xa3, 0x36, 0x40, 0x86,
|
||||
0x02, 0x75, 0x35, 0x40, 0x86, 0x02, 0xd8, 0x39,
|
||||
0x42, 0x86, 0x02, 0x69, 0x34, 0x93, 0x13, 0x02,
|
||||
0x35, 0x39, 0x40, 0x86, 0x02, 0x4b, 0x36, 0x40,
|
||||
0x86, 0x02, 0x3d, 0x39, 0x42, 0x86, 0x02, 0x38,
|
||||
0x39, 0x42, 0x86, 0x02, 0xa3, 0x36, 0x42, 0x86,
|
||||
0x03, 0x69, 0x14, 0x67, 0x14, 0x67, 0x14, 0x02,
|
||||
0xb6, 0x36, 0x40, 0x86, 0x02, 0x69, 0x34, 0x7c,
|
||||
0x13, 0x02, 0x75, 0x35, 0x42, 0x86, 0x02, 0xcc,
|
||||
0x93, 0x40, 0x86, 0x02, 0x6f, 0x34, 0x42, 0x86,
|
||||
0x02, 0xcc, 0x33, 0x40, 0x86, 0x03, 0xd1, 0x39,
|
||||
0xbd, 0x19, 0xa1, 0x87, 0x02, 0x87, 0x34, 0x40,
|
||||
0x86, 0x02, 0x82, 0x34, 0x40, 0x86, 0x02, 0x69,
|
||||
0x14, 0x3e, 0x13, 0x02, 0xd6, 0x39, 0x40, 0x86,
|
||||
0x02, 0x68, 0x14, 0xbd, 0x19, 0x02, 0x4b, 0x36,
|
||||
0x42, 0x86, 0x02, 0x46, 0x36, 0x42, 0x86, 0x02,
|
||||
0x69, 0x34, 0x2c, 0x15, 0x03, 0xb6, 0x36, 0x42,
|
||||
0x86, 0xa1, 0x87, 0x02, 0xc4, 0x33, 0x40, 0x86,
|
||||
0x02, 0x26, 0x19, 0x40, 0x86, 0x02, 0x69, 0x14,
|
||||
0xb0, 0x19, 0x02, 0xde, 0x19, 0x42, 0x86, 0x02,
|
||||
0x69, 0x34, 0xa8, 0x13, 0x02, 0xcc, 0x33, 0x42,
|
||||
0x86, 0x02, 0x82, 0x34, 0x42, 0x86, 0x02, 0xd1,
|
||||
0x19, 0x93, 0x13, 0x02, 0x81, 0x14, 0x42, 0x86,
|
||||
0x03, 0xd1, 0x79, 0x30, 0x14, 0xd1, 0x79, 0x02,
|
||||
0x68, 0x34, 0xbb, 0x14, 0x02, 0x69, 0x34, 0x95,
|
||||
0x86, 0x02, 0xd1, 0x39, 0xbb, 0x14, 0x02, 0x69,
|
||||
0x34, 0xeb, 0x13, 0x02, 0xd1, 0x39, 0x84, 0x13,
|
||||
0x02, 0x69, 0x34, 0xbc, 0x14, 0x04, 0x69, 0x54,
|
||||
0x64, 0x87, 0x8b, 0x14, 0x69, 0x54, 0x02, 0x26,
|
||||
0x39, 0x40, 0x86, 0x02, 0xb4, 0x36, 0x40, 0x86,
|
||||
0x02, 0x47, 0x16, 0x42, 0x86, 0x02, 0xdc, 0x39,
|
||||
0x40, 0x86, 0x02, 0xca, 0x33, 0x40, 0x86, 0x02,
|
||||
0xf9, 0x26, 0x40, 0x86, 0x02, 0x69, 0x34, 0x08,
|
||||
0x87, 0x03, 0x69, 0x14, 0x69, 0x14, 0x66, 0x14,
|
||||
0x03, 0xd1, 0x59, 0x1d, 0x19, 0xd1, 0x59, 0x02,
|
||||
0xd4, 0x39, 0x40, 0x86, 0x02, 0xcf, 0x39, 0x40,
|
||||
0x86, 0x02, 0x68, 0x34, 0xa4, 0x13, 0x02, 0xd1,
|
||||
0x39, 0xa4, 0x13, 0x02, 0xd1, 0x19, 0xa8, 0x13,
|
||||
0x02, 0xd7, 0x39, 0x42, 0x86, 0x03, 0x69, 0x34,
|
||||
0xbc, 0x19, 0xa1, 0x87, 0x02, 0x68, 0x14, 0xb0,
|
||||
0x19, 0x02, 0x3c, 0x39, 0x42, 0x86, 0x02, 0x68,
|
||||
0x14, 0x73, 0x13, 0x04, 0x69, 0x14, 0x69, 0x14,
|
||||
0x66, 0x14, 0x66, 0x14, 0x03, 0x68, 0x34, 0xaf,
|
||||
0x19, 0xa1, 0x87, 0x02, 0x68, 0x34, 0x80, 0x16,
|
||||
0x02, 0x73, 0x34, 0x42, 0x86, 0x02, 0xd1, 0x39,
|
||||
0x80, 0x16, 0x02, 0x68, 0x34, 0xb0, 0x19, 0x02,
|
||||
0x86, 0x34, 0x40, 0x86, 0x02, 0x38, 0x19, 0x42,
|
||||
0x86, 0x02, 0x69, 0x34, 0xbb, 0x14, 0x02, 0xb5,
|
||||
0x36, 0x42, 0x86, 0x02, 0xcd, 0x39, 0x40, 0x86,
|
||||
0x02, 0x68, 0x34, 0x27, 0x15, 0x02, 0x68, 0x34,
|
||||
0x95, 0x86, 0x03, 0x68, 0x14, 0x68, 0x14, 0x66,
|
||||
0x14, 0x02, 0x71, 0x34, 0x40, 0x86, 0x02, 0xd1,
|
||||
0x39, 0x27, 0x15, 0x02, 0x2e, 0x16, 0xa8, 0x14,
|
||||
0x02, 0xc3, 0x33, 0x42, 0x86, 0x02, 0x69, 0x14,
|
||||
0x66, 0x14, 0x02, 0x68, 0x34, 0x96, 0x86, 0x02,
|
||||
0xd1, 0x39, 0x70, 0x1a, 0x03, 0x69, 0x14, 0x64,
|
||||
0x87, 0x68, 0x14, 0x02, 0x69, 0x34, 0xa4, 0x13,
|
||||
0x02, 0xb8, 0x39, 0x40, 0x86, 0x02, 0x68, 0x34,
|
||||
0x3e, 0x13, 0x03, 0xd1, 0x19, 0xaf, 0x19, 0xa1,
|
||||
0x87, 0x02, 0xd1, 0x39, 0x3e, 0x13, 0x02, 0x68,
|
||||
0x34, 0xbd, 0x19, 0x02, 0xd1, 0x19, 0xbb, 0x14,
|
||||
0x02, 0xd1, 0x19, 0x95, 0x86, 0x02, 0xdb, 0x39,
|
||||
0x42, 0x86, 0x02, 0x38, 0x39, 0x40, 0x86, 0x02,
|
||||
0x69, 0x34, 0x80, 0x16, 0x02, 0x69, 0x14, 0xeb,
|
||||
0x13, 0x04, 0x68, 0x14, 0x69, 0x14, 0x67, 0x14,
|
||||
0x67, 0x14, 0x02, 0x6f, 0x34, 0x40, 0x86, 0x02,
|
||||
0x77, 0x34, 0x42, 0x86, 0x02, 0x46, 0x36, 0x40,
|
||||
0x86, 0x02, 0x68, 0x34, 0x92, 0x16, 0x02, 0x4e,
|
||||
0x36, 0x42, 0x86, 0x03, 0x69, 0x14, 0xbd, 0x19,
|
||||
0xa1, 0x87, 0x02, 0xde, 0x19, 0x40, 0x86, 0x02,
|
||||
0x69, 0x34, 0x27, 0x15, 0x03, 0xc3, 0x13, 0x40,
|
||||
0x86, 0xa1, 0x87, 0x02, 0x81, 0x14, 0x40, 0x86,
|
||||
0x03, 0xd1, 0x39, 0xaf, 0x19, 0xa1, 0x87, 0x02,
|
||||
0x68, 0x34, 0xbc, 0x19, 0x02, 0xd1, 0x19, 0x80,
|
||||
0x16, 0x02, 0xd9, 0x39, 0x42, 0x86, 0x02, 0xd1,
|
||||
0x39, 0xbc, 0x19, 0x02, 0xdc, 0x19, 0x42, 0x86,
|
||||
0x02, 0x68, 0x34, 0x73, 0x13, 0x02, 0x69, 0x34,
|
||||
0x3e, 0x13, 0x02, 0x47, 0x16, 0x40, 0x86, 0x02,
|
||||
0xd1, 0x39, 0xbd, 0x19, 0x02, 0x3e, 0x39, 0x42,
|
||||
0x86, 0x02, 0x69, 0x14, 0x95, 0x86, 0x02, 0x68,
|
||||
0x14, 0x96, 0x86, 0x03, 0x69, 0x34, 0xbd, 0x19,
|
||||
0xa1, 0x87, 0x02, 0xd7, 0x39, 0x40, 0x86, 0x02,
|
||||
0x45, 0x16, 0x42, 0x86, 0x02, 0x68, 0x34, 0xed,
|
||||
0x13, 0x03, 0x68, 0x34, 0xbc, 0x19, 0xa1, 0x87,
|
||||
0x02, 0xd1, 0x39, 0xed, 0x13, 0x02, 0x3c, 0x39,
|
||||
0x40, 0x86, 0x02, 0xd1, 0x19, 0x70, 0x1a, 0x02,
|
||||
0xd1, 0x39, 0x92, 0x16, 0x02, 0x73, 0x34, 0x40,
|
||||
0x86, 0x02, 0x38, 0x19, 0x40, 0x86, 0x02, 0xb5,
|
||||
0x36, 0x40, 0x86, 0x02, 0x68, 0x34, 0xaf, 0x19,
|
||||
0x02, 0xd1, 0x39, 0xaf, 0x19, 0x02, 0x69, 0x34,
|
||||
0xbc, 0x19, 0x02, 0xb6, 0x16, 0x42, 0x86, 0x02,
|
||||
0x26, 0x14, 0x25, 0x15, 0x02, 0xc3, 0x33, 0x40,
|
||||
0x86, 0x02, 0xdd, 0x39, 0x42, 0x86, 0x02, 0xcb,
|
||||
0x93, 0x42, 0x86, 0x02, 0xcb, 0x33, 0x42, 0x86,
|
||||
0x02, 0x81, 0x34, 0x42, 0x86, 0x02, 0xce, 0x39,
|
||||
0xa1, 0x87, 0x02, 0xdb, 0x39, 0x40, 0x86, 0x02,
|
||||
0x68, 0x34, 0x08, 0x87, 0x02, 0xd1, 0x19, 0xb0,
|
||||
0x19, 0x02, 0x77, 0x34, 0x40, 0x86, 0x02, 0x4e,
|
||||
0x36, 0x40, 0x86, 0x02, 0xce, 0x39, 0x42, 0x86,
|
||||
0x02, 0x4e, 0x16, 0x42, 0x86, 0x02, 0xd9, 0x39,
|
||||
0x40, 0x86, 0x02, 0xdc, 0x19, 0x40, 0x86, 0x02,
|
||||
0x3e, 0x39, 0x40, 0x86, 0x02, 0xb9, 0x39, 0x42,
|
||||
0x86, 0x02, 0xda, 0x19, 0x42, 0x86, 0x02, 0x42,
|
||||
0x16, 0x94, 0x81, 0x02, 0x45, 0x16, 0x40, 0x86,
|
||||
0x02, 0x69, 0x14, 0xbd, 0x19, 0x02, 0x70, 0x34,
|
||||
0x42, 0x86, 0x02, 0xce, 0x19, 0xa1, 0x87, 0x02,
|
||||
0xc3, 0x13, 0x42, 0x86, 0x02, 0x68, 0x14, 0x08,
|
||||
0x87, 0x02, 0xd1, 0x19, 0x7c, 0x13, 0x02, 0x68,
|
||||
0x14, 0x92, 0x16, 0x02, 0xb6, 0x16, 0x40, 0x86,
|
||||
0x02, 0x37, 0x39, 0x42, 0x86, 0x03, 0xce, 0x19,
|
||||
0x42, 0x86, 0xa1, 0x87, 0x03, 0x68, 0x14, 0x67,
|
||||
0x14, 0x67, 0x14, 0x02, 0xdd, 0x39, 0x40, 0x86,
|
||||
0x02, 0xcf, 0x19, 0x42, 0x86, 0x02, 0xd1, 0x19,
|
||||
0x2c, 0x15, 0x02, 0x4b, 0x13, 0xe9, 0x17, 0x02,
|
||||
0x68, 0x14, 0x67, 0x14, 0x02, 0xcb, 0x93, 0x40,
|
||||
0x86, 0x02, 0x6e, 0x34, 0x42, 0x86, 0x02, 0xcb,
|
||||
0x33, 0x40, 0x86, 0x02, 0x81, 0x34, 0x40, 0x86,
|
||||
0x02, 0xb6, 0x36, 0xa1, 0x87, 0x02, 0x45, 0x36,
|
||||
0x42, 0x86, 0x02, 0xb4, 0x16, 0x42, 0x86, 0x02,
|
||||
0x69, 0x14, 0x73, 0x13, 0x04, 0x69, 0x14, 0x69,
|
||||
0x14, 0x67, 0x14, 0x66, 0x14, 0x02, 0x35, 0x39,
|
||||
0x42, 0x86, 0x02, 0x68, 0x14, 0x93, 0x13, 0x02,
|
||||
0xb6, 0x36, 0x42, 0x86, 0x03, 0x68, 0x14, 0x69,
|
||||
0x14, 0x66, 0x14, 0x02, 0xce, 0x39, 0x40, 0x86,
|
||||
0x02, 0x4e, 0x16, 0x40, 0x86, 0x02, 0x87, 0x34,
|
||||
0x42, 0x86, 0x02, 0x86, 0x14, 0x42, 0x86, 0x02,
|
||||
0xd6, 0x39, 0x42, 0x86, 0x02, 0xc4, 0x33, 0x42,
|
||||
0x86, 0x02, 0x69, 0x34, 0x96, 0x86, 0x02, 0xb9,
|
||||
0x39, 0x40, 0x86, 0x02, 0x68, 0x14, 0xa8, 0x13,
|
||||
0x02, 0xd1, 0x19, 0x84, 0x13, 0x02, 0xda, 0x19,
|
||||
0x40, 0x86, 0x02, 0xd8, 0x19, 0x42, 0x86, 0x02,
|
||||
0xc3, 0x13, 0x40, 0x86, 0x02, 0xb9, 0x19, 0x42,
|
||||
0x86, 0x02, 0x3d, 0x19, 0x42, 0x86, 0x02, 0xcf,
|
||||
0x19, 0x40, 0x86, 0x04, 0x68, 0x14, 0x68, 0x14,
|
||||
0x67, 0x14, 0x67, 0x14, 0x03, 0xd1, 0x19, 0xd1,
|
||||
0x19, 0xd2, 0x19, 0x02, 0x68, 0x14, 0xbb, 0x14,
|
||||
0x02, 0x3b, 0x14, 0x44, 0x87, 0x02, 0xd1, 0x19,
|
||||
0x27, 0x15, 0x02, 0xb4, 0x16, 0x40, 0x86, 0x02,
|
||||
0xcd, 0x19, 0x42, 0x86, 0x02, 0xd3, 0x86, 0xa5,
|
||||
0x14, 0x02, 0x70, 0x14, 0x42, 0x86, 0x03, 0xb6,
|
||||
0x16, 0x42, 0x86, 0xa1, 0x87, 0x04, 0x69, 0x14,
|
||||
0x64, 0x87, 0x8b, 0x14, 0x69, 0x14, 0x02, 0x36,
|
||||
0x16, 0x2b, 0x93, 0x02, 0x68, 0x14, 0x80, 0x16,
|
||||
0x02, 0x86, 0x14, 0x40, 0x86, 0x02, 0x08, 0x14,
|
||||
0x1b, 0x0b, 0x02, 0xd1, 0x19, 0xbc, 0x19, 0x02,
|
||||
0xca, 0x13, 0x42, 0x86, 0x02, 0x41, 0x94, 0xe8,
|
||||
0x95, 0x02, 0xd8, 0x19, 0x40, 0x86, 0x02, 0xb9,
|
||||
0x19, 0x40, 0x86, 0x02, 0xd1, 0x19, 0xed, 0x13,
|
||||
0x02, 0xf9, 0x86, 0x42, 0x86, 0x03, 0xd1, 0x19,
|
||||
0xbd, 0x19, 0xa1, 0x87, 0x02, 0x3d, 0x19, 0x40,
|
||||
0x86, 0x02, 0xd6, 0x19, 0x42, 0x86, 0x03, 0x69,
|
||||
0x14, 0x66, 0x14, 0x66, 0x14, 0x02, 0xd1, 0x19,
|
||||
0xaf, 0x19, 0x03, 0x69, 0x14, 0x69, 0x14, 0x67,
|
||||
0x14, 0x02, 0xcd, 0x19, 0x40, 0x86, 0x02, 0x70,
|
||||
0x14, 0x40, 0x86, 0x03, 0x68, 0x14, 0xbc, 0x19,
|
||||
0xa1, 0x87, 0x02, 0x6e, 0x14, 0x42, 0x86, 0x02,
|
||||
0x69, 0x14, 0x92, 0x16, 0x03, 0x68, 0x14, 0x68,
|
||||
0x14, 0x67, 0x14, 0x02, 0x69, 0x14, 0x67, 0x14,
|
||||
0x02, 0x75, 0x95, 0x42, 0x86, 0x03, 0x69, 0x14,
|
||||
0x64, 0x87, 0x69, 0x14, 0x02, 0xd1, 0x19, 0xbc,
|
||||
0x14, 0x02, 0xdf, 0x19, 0x42, 0x86, 0x02, 0xca,
|
||||
0x13, 0x40, 0x86, 0x02, 0x82, 0x14, 0x42, 0x86,
|
||||
0x02, 0x69, 0x14, 0x93, 0x13, 0x02, 0x68, 0x14,
|
||||
0x7c, 0x13, 0x02, 0xf9, 0x86, 0x40, 0x86, 0x02,
|
||||
0xd6, 0x19, 0x40, 0x86, 0x02, 0x68, 0x14, 0x2c,
|
||||
0x15, 0x02, 0x69, 0x14, 0xa8, 0x13, 0x02, 0xd4,
|
||||
0x19, 0x42, 0x86, 0x04, 0x68, 0x14, 0x69, 0x14,
|
||||
0x66, 0x14, 0x66, 0x14, 0x02, 0x77, 0x14, 0x42,
|
||||
0x86, 0x02, 0x39, 0x19, 0x42, 0x86, 0x02, 0xd1,
|
||||
0x19, 0xa4, 0x13, 0x02, 0x6e, 0x14, 0x40, 0x86,
|
||||
0x03, 0xd1, 0x19, 0xd2, 0x19, 0xd2, 0x19, 0x02,
|
||||
0x69, 0x14, 0xbb, 0x14, 0x02, 0xd1, 0x19, 0x96,
|
||||
0x86, 0x02, 0x75, 0x95, 0x40, 0x86, 0x04, 0x68,
|
||||
0x14, 0x64, 0x87, 0x8b, 0x14, 0x68, 0x14, 0x02,
|
||||
0xd1, 0x19, 0x3e, 0x13, 0x02, 0xdf, 0x19, 0x40,
|
||||
0x86, 0x02, 0x82, 0x14, 0x40, 0x86, 0x02, 0x44,
|
||||
0x13, 0xeb, 0x17, 0x02, 0xdd, 0x19, 0x42, 0x86,
|
||||
0x03, 0x68, 0x14, 0xaf, 0x19, 0xa1, 0x87, 0x02,
|
||||
0x69, 0x14, 0x80, 0x16, 0x02, 0xa3, 0x16, 0x42,
|
||||
0x86, 0x02, 0x69, 0x14, 0x96, 0x86, 0x02, 0x46,
|
||||
0x16, 0x42, 0x86, 0x02, 0xb6, 0x16, 0xa1, 0x87,
|
||||
0x02, 0x68, 0x14, 0x27, 0x15, 0x02, 0x26, 0x14,
|
||||
0x1b, 0x0b, 0x02, 0xd4, 0x19, 0x40, 0x86, 0x02,
|
||||
0x77, 0x14, 0x40, 0x86, 0x02, 0x39, 0x19, 0x40,
|
||||
0x86, 0x02, 0x37, 0x19, 0x42, 0x86, 0x03, 0x69,
|
||||
0x14, 0x67, 0x14, 0x66, 0x14, 0x03, 0xc3, 0x13,
|
||||
0x42, 0x86, 0xa1, 0x87, 0x02, 0x68, 0x14, 0xbc,
|
||||
0x19, 0x02, 0xd1, 0x19, 0xeb, 0x13, 0x04, 0x69,
|
||||
0x14, 0x69, 0x14, 0x67, 0x14, 0x67, 0x14, 0x02,
|
||||
0xd1, 0x19, 0x08, 0x87, 0x02, 0x68, 0x14, 0xed,
|
||||
0x13, 0x03, 0x69, 0x14, 0xbc, 0x19, 0xa1, 0x87,
|
||||
0x02, 0xdd, 0x19, 0x40, 0x86, 0x02, 0xc3, 0x13,
|
||||
0xa1, 0x87, 0x03, 0x68, 0x14, 0x66, 0x14, 0x66,
|
||||
0x14, 0x03, 0x68, 0x14, 0x69, 0x14, 0x67, 0x14,
|
||||
0x02, 0xa3, 0x16, 0x40, 0x86, 0x02, 0xdb, 0x19,
|
||||
0x42, 0x86, 0x02, 0x68, 0x14, 0xaf, 0x19, 0x02,
|
||||
0x46, 0x16, 0x40, 0x86, 0x02, 0x35, 0x16, 0xab,
|
||||
0x14, 0x02, 0x68, 0x14, 0x95, 0x86, 0x02, 0x42,
|
||||
0x16, 0x95, 0x81, 0x02, 0xc4, 0x13, 0x42, 0x86,
|
||||
0x02, 0x15, 0x14, 0xba, 0x19, 0x03, 0xd1, 0x19,
|
||||
0x1d, 0x19, 0xd1, 0x19, 0x02, 0x69, 0x14, 0x08,
|
||||
0x87, 0x02, 0x69, 0x14, 0x7c, 0x13, 0x02, 0x37,
|
||||
0x19, 0x40, 0x86, 0x02, 0x73, 0x14, 0x42, 0x86,
|
||||
0x02, 0x69, 0x14, 0x2c, 0x15, 0x02, 0xb5, 0x16,
|
||||
0x42, 0x86, 0x02, 0x35, 0x19, 0x42, 0x86, 0x04,
|
||||
0x68, 0x14, 0x69, 0x14, 0x67, 0x14, 0x66, 0x14,
|
||||
0x02, 0x64, 0x87, 0x25, 0x15, 0x02, 0x64, 0x87,
|
||||
0x79, 0x1a, 0x02, 0x68, 0x14, 0xbc, 0x14, 0x03,
|
||||
0xce, 0x19, 0x40, 0x86, 0xa1, 0x87, 0x02, 0x87,
|
||||
0x14, 0x42, 0x86, 0x02, 0x4d, 0x16, 0x42, 0x86,
|
||||
0x04, 0x68, 0x14, 0x68, 0x14, 0x66, 0x14, 0x66,
|
||||
0x14, 0x02, 0xdb, 0x19, 0x40, 0x86, 0x02, 0xd9,
|
||||
0x19, 0x42, 0x86, 0x02, 0xc4, 0x13, 0x40, 0x86,
|
||||
0x02, 0xd1, 0x19, 0xbd, 0x19, 0x02, 0x68, 0x14,
|
||||
0xa4, 0x13, 0x02, 0x3e, 0x19, 0x42, 0x86, 0x02,
|
||||
0xf3, 0x93, 0xa7, 0x86, 0x03, 0x69, 0x14, 0xaf,
|
||||
0x19, 0xa1, 0x87, 0x02, 0xf3, 0x93, 0x08, 0x13,
|
||||
0x02, 0xd1, 0x19, 0xd2, 0x19, 0x02, 0x73, 0x14,
|
||||
0x40, 0x86, 0x02, 0xb5, 0x16, 0x40, 0x86, 0x02,
|
||||
0x35, 0x19, 0x40, 0x86, 0x02, 0x69, 0x14, 0x27,
|
||||
0x15, 0x02, 0xce, 0x19, 0x42, 0x86, 0x02, 0x71,
|
||||
0x14, 0x42, 0x86, 0x02, 0xd1, 0x19, 0x73, 0x13,
|
||||
0x02, 0x68, 0x14, 0x3e, 0x13, 0x02, 0xf4, 0x13,
|
||||
0x20, 0x86, 0x02, 0x87, 0x14, 0x40, 0x86, 0x03,
|
||||
0xb6, 0x16, 0x40, 0x86, 0xa1, 0x87, 0x02, 0x4d,
|
||||
0x16, 0x40, 0x86, 0x02, 0x69, 0x14, 0xbc, 0x19,
|
||||
0x02, 0x4b, 0x16, 0x42, 0x86, 0x02, 0xd9, 0x19,
|
||||
0x40, 0x86, 0x02, 0x3e, 0x19, 0x40, 0x86, 0x02,
|
||||
0x69, 0x14, 0xed, 0x13, 0x02, 0xd7, 0x19, 0x42,
|
||||
0x86, 0x02, 0xb8, 0x19, 0x42, 0x86, 0x03, 0x68,
|
||||
0x14, 0x67, 0x14, 0x66, 0x14, 0x02, 0x3c, 0x19,
|
||||
0x42, 0x86, 0x02, 0x68, 0x14, 0x66, 0x14, 0x03,
|
||||
0x68, 0x14, 0x64, 0x87, 0x68, 0x14, 0x02, 0x69,
|
||||
0x14, 0xaf, 0x19, 0x02, 0xce, 0x19, 0x40, 0x86,
|
||||
0x02, 0x71, 0x14, 0x40, 0x86, 0x02, 0x68, 0x14,
|
||||
0xeb, 0x13, 0x03, 0x68, 0x14, 0xbd, 0x19, 0xa1,
|
||||
0x87, 0x02, 0x6f, 0x14, 0x42, 0x86, 0x04, 0xd1,
|
||||
0x19, 0xd1, 0x19, 0xd2, 0x19, 0xd2, 0x19, 0x02,
|
||||
0x69, 0x14, 0xbc, 0x14, 0x02, 0xcc, 0x93, 0x42,
|
||||
0x86, 0x02, 0x4b, 0x16, 0x40, 0x86, 0x02, 0x26,
|
||||
0x19, 0x42, 0x86, 0x02, 0xd7, 0x19, 0x40, 0x86,
|
||||
};
|
||||
+331
-8
@@ -492,6 +492,9 @@ int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
|
||||
case CR_OP_XOR:
|
||||
is_in = (a_idx & 1) ^ (b_idx & 1);
|
||||
break;
|
||||
case CR_OP_SUB:
|
||||
is_in = (a_idx & 1) & ((b_idx & 1) ^ 1);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@@ -504,14 +507,14 @@ int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cr_union1(CharRange *cr, const uint32_t *b_pt, int b_len)
|
||||
int cr_op1(CharRange *cr, const uint32_t *b_pt, int b_len, int op)
|
||||
{
|
||||
CharRange a = *cr;
|
||||
int ret;
|
||||
cr->len = 0;
|
||||
cr->size = 0;
|
||||
cr->points = NULL;
|
||||
ret = cr_op(cr, a.points, a.len, b_pt, b_len, CR_OP_UNION);
|
||||
ret = cr_op(cr, a.points, a.len, b_pt, b_len, op);
|
||||
cr_free(&a);
|
||||
return ret;
|
||||
}
|
||||
@@ -552,6 +555,101 @@ bool lre_is_white_space(uint32_t c)
|
||||
sizeof(unicode_prop_White_Space_index) / 3);
|
||||
}
|
||||
|
||||
/*---- lre codepoint categorizing functions ----*/
|
||||
|
||||
#define S UNICODE_C_SPACE
|
||||
#define D UNICODE_C_DIGIT
|
||||
#define X UNICODE_C_XDIGIT
|
||||
#define U UNICODE_C_UPPER
|
||||
#define L UNICODE_C_LOWER
|
||||
#define _ UNICODE_C_UNDER
|
||||
#define d UNICODE_C_DOLLAR
|
||||
|
||||
uint8_t const lre_ctype_bits[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, S, S, S, S, S, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
S, 0, 0, 0, d, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
X|D, X|D, X|D, X|D, X|D, X|D, X|D, X|D,
|
||||
X|D, X|D, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, X|U, X|U, X|U, X|U, X|U, X|U, U,
|
||||
U, U, U, U, U, U, U, U,
|
||||
U, U, U, U, U, U, U, U,
|
||||
U, U, U, 0, 0, 0, 0, _,
|
||||
|
||||
0, X|L, X|L, X|L, X|L, X|L, X|L, L,
|
||||
L, L, L, L, L, L, L, L,
|
||||
L, L, L, L, L, L, L, L,
|
||||
L, L, L, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
S, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
#undef S
|
||||
#undef D
|
||||
#undef X
|
||||
#undef U
|
||||
#undef L
|
||||
#undef _
|
||||
#undef d
|
||||
|
||||
/* code point ranges for Zs,Zl or Zp property */
|
||||
static const uint16_t char_range_space[] = {
|
||||
10,
|
||||
0x0009, 0x000D + 1,
|
||||
0x0020, 0x0020 + 1,
|
||||
0x00A0, 0x00A0 + 1,
|
||||
0x1680, 0x1680 + 1,
|
||||
0x2000, 0x200A + 1,
|
||||
/* 2028;LINE SEPARATOR;Zl;0;WS;;;;;N;;;;; */
|
||||
/* 2029;PARAGRAPH SEPARATOR;Zp;0;B;;;;;N;;;;; */
|
||||
0x2028, 0x2029 + 1,
|
||||
0x202F, 0x202F + 1,
|
||||
0x205F, 0x205F + 1,
|
||||
0x3000, 0x3000 + 1,
|
||||
/* FEFF;ZERO WIDTH NO-BREAK SPACE;Cf;0;BN;;;;;N;BYTE ORDER MARK;;;; */
|
||||
0xFEFF, 0xFEFF + 1,
|
||||
};
|
||||
|
||||
int lre_is_space_non_ascii(uint32_t c)
|
||||
{
|
||||
size_t i, n;
|
||||
|
||||
n = countof(char_range_space);
|
||||
for(i = 5; i < n; i += 2) {
|
||||
uint32_t low = char_range_space[i];
|
||||
uint32_t high = char_range_space[i + 1];
|
||||
if (c < low)
|
||||
return false;
|
||||
if (c < high)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#define UNICODE_DECOMP_LEN_MAX 18
|
||||
|
||||
typedef enum {
|
||||
@@ -1062,11 +1160,17 @@ int unicode_script(CharRange *cr,
|
||||
CharRange cr2_s = { 0 }, *cr2 = &cr2_s;
|
||||
bool is_common;
|
||||
|
||||
script_idx = unicode_find_name(unicode_script_name_table, script_name);
|
||||
if (script_idx < 0)
|
||||
return -2;
|
||||
/* Note: we remove the "Unknown" Script */
|
||||
script_idx += UNICODE_SCRIPT_Unknown + 1;
|
||||
if (!strcmp(script_name, "Unknown") || !strcmp(script_name, "Zzzz")) {
|
||||
/* "Unknown" (ISO 15924 code "Zzzz") is excluded from the name table;
|
||||
it matches every character outside any script. */
|
||||
script_idx = UNICODE_SCRIPT_Unknown;
|
||||
} else {
|
||||
script_idx = unicode_find_name(unicode_script_name_table, script_name);
|
||||
if (script_idx < 0)
|
||||
return -2;
|
||||
/* Note: the name table excludes the "Unknown" Script */
|
||||
script_idx += UNICODE_SCRIPT_Unknown + 1;
|
||||
}
|
||||
|
||||
is_common = (script_idx == UNICODE_SCRIPT_Common ||
|
||||
script_idx == UNICODE_SCRIPT_Inherited);
|
||||
@@ -1101,13 +1205,22 @@ int unicode_script(CharRange *cr,
|
||||
else
|
||||
v = *p++;
|
||||
c1 = c + n + 1;
|
||||
if (v == script_idx) {
|
||||
/* only script-bearing ranges (type != 0); for Unknown, match every
|
||||
such range and invert afterwards */
|
||||
if (type != 0 &&
|
||||
(v == script_idx || script_idx == UNICODE_SCRIPT_Unknown)) {
|
||||
if (cr_add_interval(cr1, c, c1))
|
||||
goto fail;
|
||||
}
|
||||
c = c1;
|
||||
}
|
||||
|
||||
if (script_idx == UNICODE_SCRIPT_Unknown) {
|
||||
/* Unknown is all the characters outside scripts */
|
||||
if (cr_invert(cr1))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (is_ext) {
|
||||
/* add the script extensions */
|
||||
p = unicode_script_ext_table;
|
||||
@@ -1586,6 +1699,216 @@ int unicode_general_category(CharRange *cr, const char *gc_name)
|
||||
|
||||
/* 'cr' must be initialized and empty. Return 0 if OK, -1 if error, -2
|
||||
if not found */
|
||||
/* Unicode "properties of strings" (e.g. \p{RGI_Emoji}) used by the v flag;
|
||||
expands a string property into a list of code-point sequences via the
|
||||
callback. Returns -2 if the property name is unknown. */
|
||||
#define SEQ_MAX_LEN 16
|
||||
|
||||
static int unicode_sequence_prop1(int seq_prop_idx, UnicodeSequencePropCB *cb, void *opaque,
|
||||
CharRange *cr)
|
||||
{
|
||||
int i, c, j;
|
||||
uint32_t seq[SEQ_MAX_LEN];
|
||||
|
||||
switch(seq_prop_idx) {
|
||||
case UNICODE_SEQUENCE_PROP_Basic_Emoji:
|
||||
if (unicode_prop1(cr, UNICODE_PROP_Basic_Emoji1) < 0)
|
||||
return -1;
|
||||
for(i = 0; i < cr->len; i += 2) {
|
||||
for(c = cr->points[i]; c < cr->points[i + 1]; c++) {
|
||||
seq[0] = c;
|
||||
cb(opaque, seq, 1);
|
||||
}
|
||||
}
|
||||
|
||||
cr->len = 0;
|
||||
|
||||
if (unicode_prop1(cr, UNICODE_PROP_Basic_Emoji2) < 0)
|
||||
return -1;
|
||||
for(i = 0; i < cr->len; i += 2) {
|
||||
for(c = cr->points[i]; c < cr->points[i + 1]; c++) {
|
||||
seq[0] = c;
|
||||
seq[1] = 0xfe0f;
|
||||
cb(opaque, seq, 2);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_RGI_Emoji_Modifier_Sequence:
|
||||
if (unicode_prop1(cr, UNICODE_PROP_Emoji_Modifier_Base) < 0)
|
||||
return -1;
|
||||
for(i = 0; i < cr->len; i += 2) {
|
||||
for(c = cr->points[i]; c < cr->points[i + 1]; c++) {
|
||||
for(j = 0; j < 5; j++) {
|
||||
seq[0] = c;
|
||||
seq[1] = 0x1f3fb + j;
|
||||
cb(opaque, seq, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_RGI_Emoji_Flag_Sequence:
|
||||
if (unicode_prop1(cr, UNICODE_PROP_RGI_Emoji_Flag_Sequence) < 0)
|
||||
return -1;
|
||||
for(i = 0; i < cr->len; i += 2) {
|
||||
for(c = cr->points[i]; c < cr->points[i + 1]; c++) {
|
||||
int c0, c1;
|
||||
c0 = c / 26;
|
||||
c1 = c % 26;
|
||||
seq[0] = 0x1F1E6 + c0;
|
||||
seq[1] = 0x1F1E6 + c1;
|
||||
cb(opaque, seq, 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_RGI_Emoji_ZWJ_Sequence:
|
||||
{
|
||||
int len, code, pres, k, mod, mod_count, mod_pos[2], hc_pos, n_mod, n_hc, mod1;
|
||||
int mod_idx, hc_idx, i0, i1;
|
||||
const uint8_t *tab = unicode_rgi_emoji_zwj_sequence;
|
||||
|
||||
for(i = 0; i < countof(unicode_rgi_emoji_zwj_sequence);) {
|
||||
len = tab[i++];
|
||||
k = 0;
|
||||
mod = 0;
|
||||
mod_count = 0;
|
||||
hc_pos = -1;
|
||||
for(j = 0; j < len; j++) {
|
||||
code = tab[i++];
|
||||
code |= tab[i++] << 8;
|
||||
pres = code >> 15;
|
||||
mod1 = (code >> 13) & 3;
|
||||
code &= 0x1fff;
|
||||
if (code < 0x1000) {
|
||||
c = code + 0x2000;
|
||||
} else {
|
||||
c = 0x1f000 + (code - 0x1000);
|
||||
}
|
||||
if (c == 0x1f9b0)
|
||||
hc_pos = k;
|
||||
seq[k++] = c;
|
||||
if (mod1 != 0) {
|
||||
assert(mod_count < 2);
|
||||
mod = mod1;
|
||||
mod_pos[mod_count++] = k;
|
||||
seq[k++] = 0; /* will be filled later */
|
||||
}
|
||||
if (pres) {
|
||||
seq[k++] = 0xfe0f;
|
||||
}
|
||||
if (j < len - 1) {
|
||||
seq[k++] = 0x200d;
|
||||
}
|
||||
}
|
||||
|
||||
/* genrate all the variants */
|
||||
switch(mod) {
|
||||
case 1:
|
||||
n_mod = 5;
|
||||
break;
|
||||
case 2:
|
||||
n_mod = 25;
|
||||
break;
|
||||
case 3:
|
||||
n_mod = 20;
|
||||
break;
|
||||
default:
|
||||
n_mod = 1;
|
||||
break;
|
||||
}
|
||||
if (hc_pos >= 0)
|
||||
n_hc = 4;
|
||||
else
|
||||
n_hc = 1;
|
||||
for(hc_idx = 0; hc_idx < n_hc; hc_idx++) {
|
||||
for(mod_idx = 0; mod_idx < n_mod; mod_idx++) {
|
||||
if (hc_pos >= 0)
|
||||
seq[hc_pos] = 0x1f9b0 + hc_idx;
|
||||
|
||||
switch(mod) {
|
||||
case 1:
|
||||
seq[mod_pos[0]] = 0x1f3fb + mod_idx;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
i0 = mod_idx / 5;
|
||||
i1 = mod_idx % 5;
|
||||
/* avoid identical values */
|
||||
if (mod == 3 && i0 >= i1)
|
||||
i0++;
|
||||
seq[mod_pos[0]] = 0x1f3fb + i0;
|
||||
seq[mod_pos[1]] = 0x1f3fb + i1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
for(j = 0; j < k; j++)
|
||||
printf(" %04x", seq[j]);
|
||||
printf("\n");
|
||||
#endif
|
||||
cb(opaque, seq, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_RGI_Emoji_Tag_Sequence:
|
||||
{
|
||||
for(i = 0; i < countof(unicode_rgi_emoji_tag_sequence);) {
|
||||
j = 0;
|
||||
seq[j++] = 0x1F3F4;
|
||||
for(;;) {
|
||||
c = unicode_rgi_emoji_tag_sequence[i++];
|
||||
if (c == 0x00)
|
||||
break;
|
||||
seq[j++] = 0xe0000 + c;
|
||||
}
|
||||
seq[j++] = 0xe007f;
|
||||
cb(opaque, seq, j);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_Emoji_Keycap_Sequence:
|
||||
if (unicode_prop1(cr, UNICODE_PROP_Emoji_Keycap_Sequence) < 0)
|
||||
return -1;
|
||||
for(i = 0; i < cr->len; i += 2) {
|
||||
for(c = cr->points[i]; c < cr->points[i + 1]; c++) {
|
||||
seq[0] = c;
|
||||
seq[1] = 0xfe0f;
|
||||
seq[2] = 0x20e3;
|
||||
cb(opaque, seq, 3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNICODE_SEQUENCE_PROP_RGI_Emoji:
|
||||
/* all prevous sequences */
|
||||
for(i = UNICODE_SEQUENCE_PROP_Basic_Emoji; i <= UNICODE_SEQUENCE_PROP_RGI_Emoji_ZWJ_Sequence; i++) {
|
||||
int ret;
|
||||
ret = unicode_sequence_prop1(i, cb, opaque, cr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cr->len = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* build a unicode sequence property */
|
||||
/* return -2 if not found, -1 if other error. 'cr' is used as temporary memory. */
|
||||
int unicode_sequence_prop(const char *prop_name, UnicodeSequencePropCB *cb, void *opaque,
|
||||
CharRange *cr)
|
||||
{
|
||||
int seq_prop_idx;
|
||||
seq_prop_idx = unicode_find_name(unicode_sequence_prop_name_table, prop_name);
|
||||
if (seq_prop_idx < 0)
|
||||
return -2;
|
||||
return unicode_sequence_prop1(seq_prop_idx, cb, opaque, cr);
|
||||
}
|
||||
|
||||
int unicode_prop(CharRange *cr, const char *prop_name)
|
||||
{
|
||||
int prop_idx, ret;
|
||||
|
||||
+48
-2
@@ -60,6 +60,7 @@ typedef enum {
|
||||
CR_OP_UNION,
|
||||
CR_OP_INTER,
|
||||
CR_OP_XOR,
|
||||
CR_OP_SUB,
|
||||
} CharRangeOpEnum;
|
||||
|
||||
void cr_init(CharRange *cr, void *mem_opaque, void *(*realloc_func)(void *opaque, void *ptr, size_t size));
|
||||
@@ -88,14 +89,14 @@ static inline int cr_add_interval(CharRange *cr, uint32_t c1, uint32_t c2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cr_union1(CharRange *cr, const uint32_t *b_pt, int b_len);
|
||||
int cr_op1(CharRange *cr, const uint32_t *b_pt, int b_len, int op);
|
||||
|
||||
static inline int cr_union_interval(CharRange *cr, uint32_t c1, uint32_t c2)
|
||||
{
|
||||
uint32_t b_pt[2];
|
||||
b_pt[0] = c1;
|
||||
b_pt[1] = c2 + 1;
|
||||
return cr_union1(cr, b_pt, 2);
|
||||
return cr_op1(cr, b_pt, 2, CR_OP_UNION);
|
||||
}
|
||||
|
||||
int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
|
||||
@@ -119,6 +120,51 @@ int unicode_script(CharRange *cr,
|
||||
int unicode_general_category(CharRange *cr, const char *gc_name);
|
||||
int unicode_prop(CharRange *cr, const char *prop_name);
|
||||
|
||||
typedef void UnicodeSequencePropCB(void *opaque, const uint32_t *buf, int len);
|
||||
int unicode_sequence_prop(const char *prop_name, UnicodeSequencePropCB *cb, void *opaque,
|
||||
CharRange *cr);
|
||||
|
||||
/* Code point type categories (ASCII fast path table) */
|
||||
enum {
|
||||
UNICODE_C_SPACE = (1 << 0),
|
||||
UNICODE_C_DIGIT = (1 << 1),
|
||||
UNICODE_C_UPPER = (1 << 2),
|
||||
UNICODE_C_LOWER = (1 << 3),
|
||||
UNICODE_C_UNDER = (1 << 4),
|
||||
UNICODE_C_DOLLAR = (1 << 5),
|
||||
UNICODE_C_XDIGIT = (1 << 6),
|
||||
};
|
||||
extern uint8_t const lre_ctype_bits[256];
|
||||
|
||||
static inline int lre_is_space_byte(uint8_t c) {
|
||||
return lre_ctype_bits[c] & UNICODE_C_SPACE;
|
||||
}
|
||||
|
||||
static inline int lre_is_id_start_byte(uint8_t c) {
|
||||
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
||||
UNICODE_C_UNDER | UNICODE_C_DOLLAR);
|
||||
}
|
||||
|
||||
static inline int lre_is_id_continue_byte(uint8_t c) {
|
||||
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
||||
UNICODE_C_UNDER | UNICODE_C_DOLLAR |
|
||||
UNICODE_C_DIGIT);
|
||||
}
|
||||
|
||||
static inline int lre_is_word_byte(uint8_t c) {
|
||||
return lre_ctype_bits[c] & (UNICODE_C_UPPER | UNICODE_C_LOWER |
|
||||
UNICODE_C_UNDER | UNICODE_C_DIGIT);
|
||||
}
|
||||
|
||||
int lre_is_space_non_ascii(uint32_t c);
|
||||
|
||||
static inline int lre_is_space(uint32_t c) {
|
||||
if (c < 256)
|
||||
return lre_is_space_byte(c);
|
||||
else
|
||||
return lre_is_space_non_ascii(c);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -33,11 +33,11 @@ static void oob_save_index(void)
|
||||
uint8_t bc[] = {
|
||||
0x00, 0x00, // RE_HEADER_FLAGS = 0
|
||||
0x01, // RE_HEADER_CAPTURE_COUNT = 1
|
||||
0x00, // RE_HEADER_STACK_SIZE = 0
|
||||
0x00, // RE_HEADER_REGISTER_COUNT = 0
|
||||
0x04, 0x00, 0x00, 0x00, // RE_HEADER_BYTECODE_LEN = 4 (little-endian)
|
||||
0x05, // REOP_any
|
||||
0x0C, 0x64, // REOP_save_start, index=100
|
||||
0x0B, // REOP_match
|
||||
0x06, // REOP_any
|
||||
0x13, 0x64, // REOP_save_start, index=100
|
||||
0x10, // REOP_match
|
||||
};
|
||||
|
||||
uint8_t *capture[2] = {NULL, NULL};
|
||||
|
||||
@@ -37683,7 +37683,7 @@ typedef enum BCTagEnum {
|
||||
BC_TAG_SYMBOL,
|
||||
} BCTagEnum;
|
||||
|
||||
#define BC_VERSION 26
|
||||
#define BC_VERSION 27
|
||||
|
||||
typedef struct BCWriterState {
|
||||
JSContext *ctx;
|
||||
@@ -39478,7 +39478,8 @@ static JSValue JS_ReadRegExp(BCReaderState *s)
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
if (bc->is_wide_char) {
|
||||
if (bc->is_wide_char ||
|
||||
lre_check_bytecode(str8(bc), bc->len) != 0) {
|
||||
js_free_string(ctx->rt, pattern);
|
||||
js_free_string(ctx->rt, bc);
|
||||
return JS_ThrowInternalError(ctx, "bad regexp bytecode");
|
||||
@@ -48133,7 +48134,10 @@ static JSValue js_compile_regexp(JSContext *ctx, JSValueConst pattern,
|
||||
if (re_flags & LRE_FLAG_UNICODE_SETS)
|
||||
return JS_ThrowSyntaxError(ctx, "invalid regular expression flags");
|
||||
|
||||
str = JS_ToCStringLen2(ctx, &len, pattern, !(re_flags & LRE_FLAG_UNICODE));
|
||||
/* The v flag implies full Unicode, like u, so the pattern must be
|
||||
UTF-8 (not CESU-8) for both. */
|
||||
str = JS_ToCStringLen2(ctx, &len, pattern,
|
||||
!(re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)));
|
||||
if (!str)
|
||||
return JS_EXCEPTION;
|
||||
re_bytecode_buf = lre_compile(&re_bytecode_len, error_msg,
|
||||
@@ -48585,7 +48589,7 @@ static JSValue js_regexp_escape(JSContext *ctx, JSValueConst this_val,
|
||||
static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
int rc, capture_count, shift, index, i, re_flags, prop_flags;
|
||||
int rc, capture_count, alloc_count, shift, index, i, re_flags, prop_flags;
|
||||
JSRegExp *re = js_get_regexp(ctx, this_val, true);
|
||||
JSString *str;
|
||||
JSValue t, ret, str_val, obj, val, groups;
|
||||
@@ -48594,6 +48598,7 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
uint8_t **capture, *str_buf;
|
||||
int64_t last_index;
|
||||
const char *group_name_ptr;
|
||||
JSAtom group_name;
|
||||
JSProperty props[4]; // length, index, input, groups, in that order
|
||||
|
||||
if (!re)
|
||||
@@ -48608,6 +48613,7 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
groups = JS_UNDEFINED;
|
||||
indices = JS_UNDEFINED;
|
||||
indices_groups = JS_UNDEFINED;
|
||||
group_name = JS_ATOM_NULL;
|
||||
capture = NULL;
|
||||
|
||||
val = JS_GetProperty(ctx, this_val, JS_ATOM_lastIndex);
|
||||
@@ -48621,8 +48627,14 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
}
|
||||
str = JS_VALUE_GET_STRING(str_val);
|
||||
capture_count = lre_get_capture_count(re_bytecode);
|
||||
if (capture_count > 0) {
|
||||
capture = js_malloc(ctx, sizeof(capture[0]) * capture_count * 2);
|
||||
/* The register-based executor writes capture positions AND temporary
|
||||
registers into the capture buffer; it must be sized by alloc_count
|
||||
(= capture_count*2 + register_count), not capture_count*2. Sizing it
|
||||
by capture_count*2 silently overflows the heap on any regexp that
|
||||
uses registers (i.e. most non-trivial patterns). */
|
||||
alloc_count = lre_get_alloc_count(re_bytecode);
|
||||
if (alloc_count > 0) {
|
||||
capture = js_malloc(ctx, sizeof(capture[0]) * alloc_count);
|
||||
if (!capture)
|
||||
goto fail;
|
||||
}
|
||||
@@ -48692,14 +48704,19 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
goto fail;
|
||||
prop_flags = JS_PROP_C_W_E | JS_PROP_THROW;
|
||||
for(i = 0; i < capture_count; i++) {
|
||||
const char *name = NULL;
|
||||
uint8_t **match = &capture[2 * i];
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
if (group_name_ptr && i > 0) {
|
||||
if (*group_name_ptr) name = group_name_ptr;
|
||||
group_name_ptr += strlen(group_name_ptr) + 1;
|
||||
if (*group_name_ptr) {
|
||||
/* XXX: slow, should create a shape when the regexp is
|
||||
compiled */
|
||||
group_name = JS_NewAtom(ctx, group_name_ptr);
|
||||
if (group_name == JS_ATOM_NULL)
|
||||
goto fail;
|
||||
}
|
||||
group_name_ptr += strlen(group_name_ptr) + LRE_GROUP_NAME_TRAILER_LEN;
|
||||
}
|
||||
|
||||
if (match[0] && match[1]) {
|
||||
@@ -48726,12 +48743,19 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
if (name && !JS_IsUndefined(indices_groups)) {
|
||||
val = js_dup(val);
|
||||
if (JS_DefinePropertyValueStr(ctx, indices_groups,
|
||||
name, val, prop_flags) < 0) {
|
||||
JS_FreeValue(ctx, val);
|
||||
goto fail;
|
||||
if (group_name != JS_ATOM_NULL &&
|
||||
!JS_IsUndefined(indices_groups)) {
|
||||
/* For duplicate named groups, only the alternative that
|
||||
actually matched (non-undefined) wins; a later
|
||||
undefined alternative must not clobber it. */
|
||||
if (!JS_IsUndefined(val) ||
|
||||
!JS_HasProperty(ctx, indices_groups, group_name)) {
|
||||
if (JS_DefinePropertyValue(ctx, indices_groups,
|
||||
group_name, js_dup(val),
|
||||
prop_flags) < 0) {
|
||||
JS_FreeValue(ctx, val);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (JS_DefinePropertyValueUint32(ctx, indices, i, val,
|
||||
@@ -48747,13 +48771,18 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (name) {
|
||||
if (JS_DefinePropertyValueStr(ctx, groups, name,
|
||||
js_dup(val),
|
||||
prop_flags) < 0) {
|
||||
JS_FreeValue(ctx, val);
|
||||
goto fail;
|
||||
if (group_name != JS_ATOM_NULL) {
|
||||
/* duplicate named groups: matched alternative wins (see above) */
|
||||
if (!JS_IsUndefined(val) ||
|
||||
!JS_HasProperty(ctx, groups, group_name)) {
|
||||
if (JS_DefinePropertyValue(ctx, groups, group_name,
|
||||
js_dup(val), prop_flags) < 0) {
|
||||
JS_FreeValue(ctx, val);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
JS_FreeAtom(ctx, group_name);
|
||||
group_name = JS_ATOM_NULL;
|
||||
}
|
||||
|
||||
if (JS_DefinePropertyValueUint32(ctx, obj, i, val, prop_flags) < 0)
|
||||
@@ -48776,6 +48805,7 @@ static JSValue js_regexp_exec(JSContext *ctx, JSValueConst this_val,
|
||||
ret = obj;
|
||||
obj = JS_UNDEFINED;
|
||||
fail:
|
||||
JS_FreeAtom(ctx, group_name);
|
||||
JS_FreeValue(ctx, indices_groups);
|
||||
JS_FreeValue(ctx, indices);
|
||||
JS_FreeValue(ctx, str_val);
|
||||
@@ -48794,7 +48824,7 @@ static JSValue JS_RegExpDelete(JSContext *ctx, JSValueConst this_val, JSValue ar
|
||||
uint8_t *re_bytecode;
|
||||
int ret;
|
||||
uint8_t **capture, *str_buf;
|
||||
int capture_count, shift, re_flags;
|
||||
int alloc_count, shift, re_flags;
|
||||
int next_src_pos, start, end;
|
||||
int64_t last_index;
|
||||
StringBuffer b_s, *b = &b_s;
|
||||
@@ -48818,9 +48848,11 @@ static JSValue JS_RegExpDelete(JSContext *ctx, JSValueConst this_val, JSValue ar
|
||||
if (JS_IsException(val) || JS_ToLengthFree(ctx, &last_index, val))
|
||||
goto fail;
|
||||
}
|
||||
capture_count = lre_get_capture_count(re_bytecode);
|
||||
if (capture_count > 0) {
|
||||
capture = js_malloc(ctx, sizeof(capture[0]) * capture_count * 2);
|
||||
/* size by alloc_count: the register executor uses capture[] beyond
|
||||
the capture positions for its registers (see js_regexp_exec). */
|
||||
alloc_count = lre_get_alloc_count(re_bytecode);
|
||||
if (alloc_count > 0) {
|
||||
capture = js_malloc(ctx, sizeof(capture[0]) * alloc_count);
|
||||
if (!capture)
|
||||
goto fail;
|
||||
}
|
||||
@@ -48873,7 +48905,7 @@ static JSValue JS_RegExpDelete(JSContext *ctx, JSValueConst this_val, JSValue ar
|
||||
break;
|
||||
}
|
||||
if (end == start) {
|
||||
if (!(re_flags & LRE_FLAG_UNICODE) || (unsigned)end >= str->len || !str->is_wide_char) {
|
||||
if (!(re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) || (unsigned)end >= str->len || !str->is_wide_char) {
|
||||
end++;
|
||||
} else {
|
||||
string_getc(str, &end);
|
||||
@@ -48956,14 +48988,13 @@ static JSValue js_regexp_Symbol_match(JSContext *ctx, JSValueConst this_val,
|
||||
goto exception;
|
||||
p = JS_VALUE_GET_STRING(flags);
|
||||
|
||||
// TODO(bnoordhuis) query 'u' flag the same way?
|
||||
global = (-1 != string_indexof_char(p, 'g', 0));
|
||||
if (!global) {
|
||||
A = JS_RegExpExec(ctx, rx, S);
|
||||
} else {
|
||||
fullUnicode = JS_ToBoolFree(ctx, JS_GetProperty(ctx, rx, JS_ATOM_unicode));
|
||||
if (fullUnicode < 0)
|
||||
goto exception;
|
||||
// 'v' flag implies full Unicode, like 'u'
|
||||
fullUnicode = (string_indexof_char(p, 'u', 0) >= 0 ||
|
||||
string_indexof_char(p, 'v', 0) >= 0);
|
||||
|
||||
if (JS_SetProperty(ctx, rx, JS_ATOM_lastIndex, js_int32(0)) < 0)
|
||||
goto exception;
|
||||
@@ -49146,7 +49177,8 @@ static JSValue js_regexp_Symbol_matchAll(JSContext *ctx, JSValueConst this_val,
|
||||
it->iterated_string = S;
|
||||
strp = JS_VALUE_GET_STRING(flags);
|
||||
it->global = string_indexof_char(strp, 'g', 0) >= 0;
|
||||
it->unicode = string_indexof_char(strp, 'u', 0) >= 0;
|
||||
it->unicode = string_indexof_char(strp, 'u', 0) >= 0 ||
|
||||
string_indexof_char(strp, 'v', 0) >= 0;
|
||||
it->done = false;
|
||||
JS_SetOpaqueInternal(iter, it);
|
||||
|
||||
@@ -49293,13 +49325,12 @@ static JSValue js_regexp_Symbol_replace(JSContext *ctx, JSValueConst this_val,
|
||||
goto exception;
|
||||
p = JS_VALUE_GET_STRING(flags);
|
||||
|
||||
// TODO(bnoordhuis) query 'u' flag the same way?
|
||||
fullUnicode = 0;
|
||||
is_global = (-1 != string_indexof_char(p, 'g', 0));
|
||||
if (is_global) {
|
||||
fullUnicode = JS_ToBoolFree(ctx, JS_GetProperty(ctx, rx, JS_ATOM_unicode));
|
||||
if (fullUnicode < 0)
|
||||
goto exception;
|
||||
// 'v' flag implies full Unicode, like 'u'
|
||||
fullUnicode = (string_indexof_char(p, 'u', 0) >= 0 ||
|
||||
string_indexof_char(p, 'v', 0) >= 0);
|
||||
if (JS_SetProperty(ctx, rx, JS_ATOM_lastIndex, js_int32(0)) < 0)
|
||||
goto exception;
|
||||
}
|
||||
@@ -49525,7 +49556,8 @@ static JSValue js_regexp_Symbol_split(JSContext *ctx, JSValueConst this_val,
|
||||
if (JS_IsException(flags))
|
||||
goto exception;
|
||||
strp = JS_VALUE_GET_STRING(flags);
|
||||
unicodeMatching = string_indexof_char(strp, 'u', 0) >= 0;
|
||||
unicodeMatching = string_indexof_char(strp, 'u', 0) >= 0 ||
|
||||
string_indexof_char(strp, 'v', 0) >= 0;
|
||||
if (string_indexof_char(strp, 'y', 0) < 0) {
|
||||
flags = JS_ConcatString3(ctx, "", flags, "y");
|
||||
if (JS_IsException(flags))
|
||||
|
||||
+2
-143
@@ -175,10 +175,10 @@ Reflect.construct
|
||||
Reflect.set
|
||||
Reflect.setPrototypeOf
|
||||
regexp-dotall
|
||||
regexp-duplicate-named-groups=skip
|
||||
regexp-duplicate-named-groups
|
||||
regexp-lookbehind
|
||||
regexp-match-indices
|
||||
regexp-modifiers=skip
|
||||
regexp-modifiers
|
||||
regexp-named-groups
|
||||
regexp-unicode-property-escapes
|
||||
regexp-v-flag
|
||||
@@ -272,147 +272,6 @@ test262/test/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js
|
||||
test262/test/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js
|
||||
test262/test/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js
|
||||
|
||||
# in progress regexp-v-flag support, see https://github.com/quickjs-ng/quickjs/issues/228
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Basic_Emoji-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Basic_Emoji-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Basic_Emoji-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Basic_Emoji.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Emoji_Keycap_Sequence-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Emoji_Keycap_Sequence-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Emoji_Keycap_Sequence-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/Emoji_Keycap_Sequence.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Flag_Sequence-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Flag_Sequence-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Flag_Sequence-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Flag_Sequence.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Modifier_Sequence-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Modifier_Sequence-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Modifier_Sequence-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Modifier_Sequence.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Tag_Sequence-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Tag_Sequence-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Tag_Sequence-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Tag_Sequence.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_ZWJ_Sequence-negative-CharacterClass.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_ZWJ_Sequence-negative-P.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_ZWJ_Sequence-negative-u.js
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_ZWJ_Sequence.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-escape-union-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-class-union-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-property-escape-union-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/character-union-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/property-of-strings-escape-union-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-13.1.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-14.0.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-15.0.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-15.1.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-difference-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-intersection-string-literal.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-character-class-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-character-class.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-character-property-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-character.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-property-of-strings-escape.js
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/string-literal-union-string-literal.js
|
||||
|
||||
# frequently broken, sometimes contain engine-dependent tests
|
||||
test262/test/staging/
|
||||
|
||||
@@ -17,28 +17,6 @@ test262/test/built-ins/AsyncFromSyncIteratorPrototype/throw/iterator-result-reje
|
||||
test262/test/built-ins/AsyncFromSyncIteratorPrototype/throw/iterator-result-rejected-promise-close.js:74: strict mode: TypeError: $DONE() not called
|
||||
test262/test/built-ins/AsyncFromSyncIteratorPrototype/throw/throw-result-poisoned-wrapper.js:81: TypeError: $DONE() not called
|
||||
test262/test/built-ins/AsyncFromSyncIteratorPrototype/throw/throw-result-poisoned-wrapper.js:81: strict mode: TypeError: $DONE() not called
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/Script_-_Unknown.js:16: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/Script_-_Unknown.js:16: strict mode: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Unknown.js:16: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Unknown.js:16: strict mode: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/property-escapes/special-property-value-Script_Extensions-Unknown.js:14: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/property-escapes/special-property-value-Script_Extensions-Unknown.js:14: strict mode: SyntaxError: unknown unicode script
|
||||
test262/test/built-ins/RegExp/prototype/exec/regexp-builtin-exec-v-u-flag.js:45: Test262Error: Actual argument [null] shouldn't be primitive. Unicode property escapes with v flag
|
||||
test262/test/built-ins/RegExp/prototype/exec/regexp-builtin-exec-v-u-flag.js:45: strict mode: Test262Error: Actual argument [null] shouldn't be primitive. Unicode property escapes with v flag
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-16.0.js:16: Test262Error: `\p{RGI_Emoji}` should match 🇨🇶 (U+01F1E8 U+01F1F6)
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-16.0.js:16: strict mode: Test262Error: `\p{RGI_Emoji}` should match 🇨🇶 (U+01F1E8 U+01F1F6)
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-17.0.js:16: Test262Error: `\p{RGI_Emoji}` should match 👨🏻🐰👨🏼 (U+01F468 U+01F3FB U+00200D U+01F430 U+00200D U+01F468 U+01F3FC)
|
||||
test262/test/built-ins/RegExp/unicodeSets/generated/rgi-emoji-17.0.js:16: strict mode: Test262Error: `\p{RGI_Emoji}` should match 👨🏻🐰👨🏼 (U+01F468 U+01F3FB U+00200D U+01F430 U+00200D U+01F468 U+01F3FC)
|
||||
test262/test/built-ins/String/prototype/match/regexp-prototype-match-v-u-flag.js:10: Test262Error: Actual argument [null] shouldn't be primitive. Unicode property escapes with v flag
|
||||
test262/test/built-ins/String/prototype/match/regexp-prototype-match-v-u-flag.js:10: strict mode: Test262Error: Actual argument [null] shouldn't be primitive. Unicode property escapes with v flag
|
||||
test262/test/built-ins/String/prototype/matchAll/regexp-prototype-matchAll-v-u-flag.js:73: Test262Error: Actual [] and expected [𠮷, 𠮷, 𠮷, 0, 3, 6] should have the same contents.
|
||||
test262/test/built-ins/String/prototype/matchAll/regexp-prototype-matchAll-v-u-flag.js:73: strict mode: Test262Error: Actual [] and expected [𠮷, 𠮷, 𠮷, 0, 3, 6] should have the same contents.
|
||||
test262/test/built-ins/String/prototype/replace/regexp-prototype-replace-v-u-flag.js:9: Test262Error: Unicode property escapes with v flag Expected SameValue(«"𠮷a𠮷b𠮷"», «"XaXbX"») to be true
|
||||
test262/test/built-ins/String/prototype/replace/regexp-prototype-replace-v-u-flag.js:9: strict mode: Test262Error: Unicode property escapes with v flag Expected SameValue(«"𠮷a𠮷b𠮷"», «"XaXbX"») to be true
|
||||
test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js:9: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true
|
||||
test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js:9: strict mode: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true
|
||||
test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-u-flag.js:9: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true
|
||||
test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-u-flag.js:9: strict mode: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true
|
||||
test262/test/built-ins/TypedArray/prototype/lastIndexOf/negative-index-and-resize-to-smaller.js:23: Test262Error: For index -1 Expected SameValue(«-1», «2») to be true (Testing with Float64Array and makePassthrough.)
|
||||
test262/test/built-ins/TypedArray/prototype/lastIndexOf/negative-index-and-resize-to-smaller.js:23: strict mode: Test262Error: For index -1 Expected SameValue(«-1», «2») to be true (Testing with Float64Array and makePassthrough.)
|
||||
test262/test/built-ins/TypedArray/prototype/slice/speciesctor-return-same-buffer-with-offset.js:24: Test262Error: Actual [20, 30, 40, 60] and expected [20, 20, 20, 60] should have the same contents. (Testing with Float64Array and makePassthrough.)
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import {assert} from "./assert.js"
|
||||
|
||||
let caught = 0
|
||||
for (let i = 1; i <= 32; i++) {
|
||||
const prefix = "(:?".repeat(i)
|
||||
const suffix = "|)+".repeat(i)
|
||||
const between = "(?:a|)+"
|
||||
try {
|
||||
new RegExp(prefix + between + suffix)
|
||||
} catch (e) {
|
||||
assert(e instanceof SyntaxError)
|
||||
assert(e.message, "out of memory")
|
||||
caught++
|
||||
}
|
||||
}
|
||||
assert(caught, 12) // subject to change
|
||||
+5
-5
@@ -285,11 +285,11 @@ function bjson_test_bytecode()
|
||||
function bjson_test_fuzz()
|
||||
{
|
||||
var corpus = [
|
||||
["Gv////8QAAAAAARg"],
|
||||
["Gv/////m5uaCLQ=="],
|
||||
["Gv////8AEQATBgYGBgYGBgYGBgb/////EAARAC8R/78vEf+/"],
|
||||
["Gv////8ACH8ACv////9//////////////////////////////9//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAA+fn5+fn5+fn5+fn5AAAAAAAGAKs="],
|
||||
["Gv////8ADgAAABQA=", bjson.READ_OBJ_REFERENCE],
|
||||
["G/////8QAAAAAARg"],
|
||||
["G//////m5uaCLQ=="],
|
||||
["G/////8AEQATBgYGBgYGBgYGBgb/////EAARAC8R/78vEf+/"],
|
||||
["G/////8ACH8ACv////9//////////////////////////////9//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAA+fn5+fn5+fn5+fn5AAAAAAAGAKs="],
|
||||
["G/////8ADgAAABQA=", bjson.READ_OBJ_REFERENCE],
|
||||
];
|
||||
for (var [input, flags] of corpus) {
|
||||
var buf = base64decode(input);
|
||||
|
||||
@@ -907,7 +907,7 @@ function test_regexp()
|
||||
} catch (_ex) {
|
||||
ex = _ex;
|
||||
}
|
||||
assert(ex?.message, "invalid class range");
|
||||
assert(ex?.message, "invalid character in class in regular expression");
|
||||
|
||||
eval("/[\\-]/");
|
||||
eval("/[\\-]/u");
|
||||
|
||||
Reference in new issue
Block a user