Skip to content

Commit cebd113

Browse files
committed
allow No to start identifier, but disallow all-No identifiers
1 parent 86b680f commit cebd113

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/flisp/julia_extensions.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ value_t fl_accum_julia_symbol(fl_context_t *fl_ctx, value_t *args, uint32_t narg
305305
type_error(fl_ctx, "accum-julia-symbol", "wchar", args[0]);
306306
uint32_t wc = *(uint32_t*)cp_data((cprim_t*)ptr(args[0]));
307307
ios_t str;
308-
int allascii=1;
308+
int allascii=1, allNo=1;
309309
ios_mem(&str, 0);
310310
do {
311311
allascii &= (wc <= 0x7f);
312+
allNo = allNo && UTF8PROC_CATEGORY_NO == utf8proc_category((utf8proc_int32_t) wc);
312313
ios_getutf8(s, &wc);
313314
if (wc == '!') {
314315
uint32_t nwc;
@@ -324,6 +325,8 @@ value_t fl_accum_julia_symbol(fl_context_t *fl_ctx, value_t *args, uint32_t narg
324325
break;
325326
} while (jl_id_char(wc));
326327
ios_pututf8(&str, 0);
328+
if (allNo) /* identifiers cannot consist only of category-No */
329+
lerrorf(fl_ctx, symbol(fl_ctx, "error"), "invalid identifier %s", str.buf);
327330
return symbol(fl_ctx, allascii ? str.buf : normalize(fl_ctx, str.buf));
328331
}
329332

0 commit comments

Comments
 (0)