summaryrefslogtreecommitdiff
path: root/src/lib/unicode.c
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-09-25 21:05:02 +0000
committerpeter <peter@pmikkelsen.com>2026-09-25 21:05:02 +0000
commitbdfbb6fd4bb9be35c9c338e18dc8e9b447cfe8ca (patch)
treee623fb0b13891023e6218e0d9e4d58d51d34c7bb /src/lib/unicode.c
parenta5b212017eaa73d30a1cd7d22635990a5b8a52ad (diff)
Use the parsed unicode stuff to decide what is valid identifier characters, and symbol characters.unicode-props
FossilOrigin-Name: afa25da5a44e8cb032d74269a6d4b7ec1e8842f18cefbd54d5f84a0b6d780f70
Diffstat (limited to 'src/lib/unicode.c')
-rw-r--r--src/lib/unicode.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/unicode.c b/src/lib/unicode.c
index b5c6471..48cb91e 100644
--- a/src/lib/unicode.c
+++ b/src/lib/unicode.c
@@ -18,18 +18,28 @@
*/
#include "aplwc_internal.h"
-#include "unicode.h"
+#include "unicode_properties.c"
static int
is(uint32_t c, enum unicode_property p)
{
- int n;
+ int n, a, b, i;
struct unicode_range *r;
- UNUSED_PARAMETER(c);
-
unicode_get(p, &n, &r);
-
+ a = 0;
+ b = n-1;
+ while(a <= b){
+ i = a + (b-a) / 2;
+ if(c >= r[i].from && c <= r[i].to)
+ return 1;
+ else if(c < r[i].from)
+ b = i-1;
+ else{
+ assert(c > r[i].to);
+ a = i+1;
+ }
+ }
return 0;
}