Drop CONFIG_ALL_UNICODE and enable it by default

This commit is contained in:
Saúl Ibarra Corretgé 2023-11-20 10:25:54 +01:00
parent bef2a12566
commit a721bda7b5
8 changed files with 1 additions and 47 deletions

View file

@ -600,7 +600,6 @@ int lre_parse_escape(const uint8_t **pp, int allow_utf16)
return c;
}
#ifdef CONFIG_ALL_UNICODE
/* XXX: we use the same chars for name and value */
static BOOL is_unicode_char(int c)
{
@ -703,7 +702,6 @@ static int parse_unicode_property(REParseState *s, CharRange *cr,
out_of_memory:
return re_parse_out_of_memory(s);
}
#endif /* CONFIG_ALL_UNICODE */
/* return -1 if error otherwise the character or a class range
(CLASS_RANGE_BASE). In case of class range, 'cr' is
@ -763,7 +761,6 @@ static int get_class_atom(REParseState *s, CharRange *cr,
c = '\\';
}
break;
#ifdef CONFIG_ALL_UNICODE
case 'p':
case 'P':
if (s->is_utf16) {
@ -773,7 +770,6 @@ static int get_class_atom(REParseState *s, CharRange *cr,
break;
}
/* fall thru */
#endif
default:
p--;
ret = lre_parse_escape(&p, s->is_utf16 * 2);

View file

@ -66,11 +66,7 @@ static inline int lre_js_is_ident_first(int c)
if ((uint32_t)c < 128) {
return (lre_id_start_table_ascii[c >> 5] >> (c & 31)) & 1;
} else {
#ifdef CONFIG_ALL_UNICODE
return lre_is_id_start(c);
#else
return !lre_is_space(c);
#endif
}
}
@ -80,11 +76,7 @@ static inline int lre_js_is_ident_next(int c)
return (lre_id_continue_table_ascii[c >> 5] >> (c & 31)) & 1;
} else {
/* ZWNJ and ZWJ are accepted in identifiers */
#ifdef CONFIG_ALL_UNICODE
return lre_is_id_continue(c) || c == 0x200C || c == 0x200D;
#else
return !lre_is_space(c) || c == 0x200C || c == 0x200D;
#endif
}
}

View file

@ -557,8 +557,6 @@ static const uint8_t unicode_prop_ID_Continue1_index[63] = {
0x41, 0xaf, 0xe2, 0x21, 0xf0, 0x01, 0x0e,
};
#ifdef CONFIG_ALL_UNICODE
static const uint8_t unicode_cc_table[899] = {
0xb2, 0xcf, 0xd4, 0x00, 0xe8, 0x03, 0xdc, 0x00,
0xe8, 0x00, 0xd8, 0x04, 0xdc, 0x01, 0xca, 0x03,
@ -4484,5 +4482,3 @@ static const uint16_t unicode_prop_len_table[] = {
countof(unicode_prop_ID_Start_table),
countof(unicode_prop_Case_Ignorable_table),
};
#endif /* CONFIG_ALL_UNICODE */

View file

@ -426,8 +426,6 @@ int cr_invert(CharRange *cr)
return 0;
}
#ifdef CONFIG_ALL_UNICODE
BOOL lre_is_id_start(uint32_t c)
{
return lre_is_in_table(c, unicode_prop_ID_Start_table,
@ -1504,5 +1502,3 @@ int unicode_prop(CharRange *cr, const char *prop_name)
}
return ret;
}
#endif /* CONFIG_ALL_UNICODE */

View file

@ -28,9 +28,6 @@
#define LRE_BOOL int /* for documentation purposes */
/* define it to include all the unicode tables (40KB larger) */
#define CONFIG_ALL_UNICODE
#define LRE_CC_RES_LEN_MAX 3
typedef enum {
@ -101,8 +98,6 @@ int cr_op(CharRange *cr, const uint32_t *a_pt, int a_len,
int cr_invert(CharRange *cr);
#ifdef CONFIG_ALL_UNICODE
LRE_BOOL lre_is_id_start(uint32_t c);
LRE_BOOL lre_is_id_continue(uint32_t c);
@ -117,8 +112,6 @@ int unicode_script(CharRange *cr,
int unicode_general_category(CharRange *cr, const char *gc_name);
int unicode_prop(CharRange *cr, const char *prop_name);
#endif /* CONFIG_ALL_UNICODE */
#undef LRE_BOOL
#endif /* LIBUNICODE_H */

View file

@ -1978,7 +1978,6 @@ JSContext *JS_NewContext(JSRuntime *rt)
JS_AddIntrinsicBaseObjects(ctx);
JS_AddIntrinsicDate(ctx);
JS_AddIntrinsicEval(ctx);
JS_AddIntrinsicStringNormalize(ctx);
JS_AddIntrinsicRegExp(ctx);
JS_AddIntrinsicJSON(ctx);
JS_AddIntrinsicProxy(ctx);
@ -39197,8 +39196,6 @@ static JSValue js_string_toLowerCase(JSContext *ctx, JSValueConst this_val,
return JS_EXCEPTION;
}
#ifdef CONFIG_ALL_UNICODE
/* return (-1, NULL) if exception, otherwise (len, buf) */
static int JS_ToUTF32String(JSContext *ctx, uint32_t **pbuf, JSValueConst val1)
{
@ -39301,7 +39298,6 @@ static JSValue js_string_normalize(JSContext *ctx, JSValueConst this_val,
js_free(ctx, out_buf);
return val;
}
#endif /* CONFIG_ALL_UNICODE */
/* also used for String.prototype.valueOf */
static JSValue js_string_toString(JSContext *ctx, JSValueConst this_val,
@ -39460,6 +39456,7 @@ static const JSCFunctionListEntry js_string_proto_funcs[] = {
JS_CFUNC_DEF("valueOf", 0, js_string_toString ),
JS_CFUNC_DEF("__quote", 1, js_string___quote ),
JS_CFUNC_DEF("localeCompare", 1, js_string_localeCompare ),
JS_CFUNC_DEF("normalize", 0, js_string_normalize ),
JS_CFUNC_MAGIC_DEF("toLowerCase", 0, js_string_toLowerCase, 1 ),
JS_CFUNC_MAGIC_DEF("toUpperCase", 0, js_string_toLowerCase, 0 ),
JS_CFUNC_MAGIC_DEF("toLocaleLowerCase", 0, js_string_toLowerCase, 1 ),
@ -39486,19 +39483,6 @@ static const JSCFunctionListEntry js_string_iterator_proto_funcs[] = {
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "String Iterator", JS_PROP_CONFIGURABLE ),
};
#ifdef CONFIG_ALL_UNICODE
static const JSCFunctionListEntry js_string_proto_normalize[] = {
JS_CFUNC_DEF("normalize", 0, js_string_normalize ),
};
#endif
void JS_AddIntrinsicStringNormalize(JSContext *ctx)
{
#ifdef CONFIG_ALL_UNICODE
JS_SetPropertyFunctionList(ctx, ctx->class_proto[JS_CLASS_STRING], js_string_proto_normalize,
countof(js_string_proto_normalize));
#endif
}
/* Math */

View file

@ -356,7 +356,6 @@ JSContext *JS_NewContextRaw(JSRuntime *rt);
void JS_AddIntrinsicBaseObjects(JSContext *ctx);
void JS_AddIntrinsicDate(JSContext *ctx);
void JS_AddIntrinsicEval(JSContext *ctx);
void JS_AddIntrinsicStringNormalize(JSContext *ctx);
void JS_AddIntrinsicRegExpCompiler(JSContext *ctx);
void JS_AddIntrinsicRegExp(JSContext *ctx);
void JS_AddIntrinsicJSON(JSContext *ctx);

View file

@ -2987,14 +2987,12 @@ int main(int argc, char **argv)
dump_case_conv_table(fo);
compute_internal_props();
build_flags_tables(fo);
fprintf(fo, "#ifdef CONFIG_ALL_UNICODE\n\n");
build_cc_table(fo);
build_decompose_table(fo);
build_general_category_table(fo);
build_script_table(fo);
build_script_ext_table(fo);
build_prop_list_table(fo);
fprintf(fo, "#endif /* CONFIG_ALL_UNICODE */\n");
fclose(fo);
}
return 0;