summaryrefslogtreecommitdiff
path: root/unicode_gen.c
diff options
context:
space:
mode:
authorCharlie Gordon <github@chqrlie.org>2024-05-05 17:47:40 +0200
committerGitHub <noreply@github.com>2024-05-05 17:47:40 +0200
commit7a2c6f42d49e7a4003384cf54b187f16e64e47a1 (patch)
tree8cc7181520e92dd0ced15e7c3ad0c86dbab3fa94 /unicode_gen.c
parent1402478d8d280a1a62dfb76327dd569d6307a025 (diff)
downloadquickjs-7a2c6f42d49e7a4003384cf54b187f16e64e47a1.tar.gz
quickjs-7a2c6f42d49e7a4003384cf54b187f16e64e47a1.zip
Improve libunicode and libregexp headers (#288)
- move all `lre_xxx` functions to libunicode - use flags table `lre_ctype_bits` instead of bitmaps - simplify `lre_is_space`, `lre_js_is_ident_first` and `lre_js_is_ident_next` - simplify `simple_next_token`, handle UTF-8 correctly - simplify `is_let`, remove dead code
Diffstat (limited to 'unicode_gen.c')
-rw-r--r--unicode_gen.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/unicode_gen.c b/unicode_gen.c
index 14811ef..4f38052 100644
--- a/unicode_gen.c
+++ b/unicode_gen.c
@@ -273,7 +273,7 @@ int find_name(const char **tab, int tab_len, const char *name)
return -1;
}
-static int get_prop(uint32_t c, int prop_idx)
+static BOOL get_prop(uint32_t c, int prop_idx)
{
return (unicode_db[c].prop_bitmap_tab[prop_idx >> 5] >> (prop_idx & 0x1f)) & 1;
}
@@ -1981,7 +1981,7 @@ void check_flags(void)
BOOL flag_ref, flag;
for(c = 0; c <= CHARCODE_MAX; c++) {
flag_ref = get_prop(c, PROP_Cased);
- flag = lre_is_cased(c);
+ flag = !!lre_is_cased(c);
if (flag != flag_ref) {
printf("ERROR: c=%05x cased=%d ref=%d\n",
c, flag, flag_ref);
@@ -1989,7 +1989,7 @@ void check_flags(void)
}
flag_ref = get_prop(c, PROP_Case_Ignorable);
- flag = lre_is_case_ignorable(c);
+ flag = !!lre_is_case_ignorable(c);
if (flag != flag_ref) {
printf("ERROR: c=%05x case_ignorable=%d ref=%d\n",
c, flag, flag_ref);
@@ -1997,7 +1997,7 @@ void check_flags(void)
}
flag_ref = get_prop(c, PROP_ID_Start);
- flag = lre_is_id_start(c);
+ flag = !!lre_is_id_start(c);
if (flag != flag_ref) {
printf("ERROR: c=%05x id_start=%d ref=%d\n",
c, flag, flag_ref);
@@ -2005,7 +2005,7 @@ void check_flags(void)
}
flag_ref = get_prop(c, PROP_ID_Continue);
- flag = lre_is_id_continue(c);
+ flag = !!lre_is_id_continue(c);
if (flag != flag_ref) {
printf("ERROR: c=%05x id_cont=%d ref=%d\n",
c, flag, flag_ref);
@@ -2019,7 +2019,7 @@ void check_flags(void)
count = 0;
for(c = 0x20; c <= 0xffff; c++) {
flag_ref = get_prop(c, PROP_ID_Start);
- flag = lre_is_id_start(c);
+ flag = !!lre_is_id_start(c);
assert(flag == flag_ref);
count++;
}