ref: 2ccc3d0e07f20228c86279bcb91044336cd1975b
parent: 2dae8fb34ebf83552f62140e589d163792a02898
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Apr 27 20:34:11 EDT 2025
read: use "rune" wording when throwing errors
--- a/src/read.c
+++ b/src/read.c
@@ -246,7 +246,7 @@
Rune cval;
ctx->tokval = sl_nil;
if(ios_getrune(RS, &cval) == IOS_EOF)
- parse_error(ctx, "EOI in character constant");
+ parse_error(ctx, "EOI in rune constant");
if((cval >= 'a' && cval <= 'z') || cval == 'U'){
const char *k;
read_token(ctx, cval, false);
@@ -253,10 +253,10 @@
if(ctx->buf[1] != 0){
if(cval == 'u' || cval == 'U' || cval == 'x'){
if(!sl_read_numtok(&ctx->buf[1], &ctx->tokval, 16))
- parse_error(ctx, "invalid hex character constant: %s", &ctx->buf[1]);
+ parse_error(ctx, "invalid hex rune constant: %s", &ctx->buf[1]);
ctx->tokval = mk_rune(numval(ctx->tokval));
}else if(!Tgetkv(name2rune, ctx->buf, strlen(ctx->buf), &k, (void**)&ctx->tokval)){
- parse_error(ctx, "unknown character %s", ctx->buf);
+ parse_error(ctx, "unknown rune #\\%s", ctx->buf);
}
}
}
@@ -534,7 +534,7 @@
}
eseq[j] = '\0';
r = strtol(eseq, nil, 8);
- // \DDD and \xXX read bytes, not characters
+ // \DDD and \xXX read bytes, not runes
buf[i++] = r;
}else if((c == 'x' && (ndig = 2)) || (c == 'u' && (ndig = 4)) || (c == 'U' && (ndig = 8))){
while(1){