lex,wwi: \u/\U unicode escapes + wide-rune .wwi round-trip, both stages (#50)

Hare-faithful \u (4 hex) / \U (8 hex) escapes; \x/\u/\U share one codepoint
path (ref/hare/hare/lex/lex.ha lex_unicode); string literals UTF-8-encode
multi-byte codepoints (cstage inline utf8enc, wwstage utf8.encoderune). The
.wwi producer rune serializer now emits \u/\U so exported wide-rune defs
round-trip (was a fatal >0xFF). Reject >0x10FFFF and surrogates with Hare-
verbatim error strings. Closes the int-cast spelling divergence (#48 RUNE_MAX).
Both stages byte-identical; 446 tests pass.
This commit is contained in:
2026-06-18 22:47:53 +09:00
parent 64cf3c4094
commit 0197dfb9e6
7 changed files with 508 additions and 63 deletions

View File

@@ -236,7 +236,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_driver_flagargs \
$(BIN)/test_let_global $(BIN)/test_def_neg_global \
$(BIN)/test_def_const_fold \
$(BIN)/test_int_cast_signed $(BIN)/test_dot_chain \
$(BIN)/test_int_cast_signed $(BIN)/test_uniesc_run $(BIN)/test_dot_chain \
$(BIN)/test_amp_dot $(BIN)/test_arr_elem_field \
$(BIN)/test_arr_elem_field_write \
$(BIN)/test_arr_enum_elem \
@@ -1304,6 +1304,12 @@ $(BIN)/test_int_cast_signed: test/wcc/640_int_cast_signed.c $(BIN)/ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_uniesc_run: test/wcc/110_uniesc_run.c $(BIN)/ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_dot_chain: test/wcc/650_dot_chain.c $(BIN)/ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \