From bdfbb6fd4bb9be35c9c338e18dc8e9b447cfe8ca Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 25 Sep 2026 21:05:02 +0000 Subject: Use the parsed unicode stuff to decide what is valid identifier characters, and symbol characters. FossilOrigin-Name: afa25da5a44e8cb032d74269a6d4b7ec1e8842f18cefbd54d5f84a0b6d780f70 --- src/lib/unicode.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/lib/unicode.c') 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; } -- cgit v1.2.3