aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/qreg.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-04 18:26:00 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-09 18:22:21 +0200
commit893a0a6ad85411a57c1225af03260b34561377c7 (patch)
tree96a3cd508c6af6112bdc219b557fa6e05b3a2d86 /src/qreg.c
parent403c1cd31bad7280f9983878ce943b5196e98fb3 (diff)
downloadsciteco-893a0a6ad85411a57c1225af03260b34561377c7.tar.gz
leave some comments on what to do when converting the parser to Unicode (refs #5)
Diffstat (limited to 'src/qreg.c')
-rw-r--r--src/qreg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qreg.c b/src/qreg.c
index 2c2b6ad..10aaa86 100644
--- a/src/qreg.c
+++ b/src/qreg.c
@@ -83,6 +83,12 @@ teco_qreg_execute(teco_qreg_t *qreg, teco_qreg_table_t *qreg_table_locals, GErro
{
g_auto(teco_string_t) macro = {NULL, 0};
+ /*
+ * FIXME: Once we have an Unicode-aware parser,
+ * we should probably check the encoding of the register.
+ * On the other hand, we will have to validate the
+ * UTF-8 codepoints before execution anyway.
+ */
if (!qreg->vtable->get_string(qreg, &macro.data, &macro.len, error) ||
!teco_execute_macro(macro.data, macro.len, qreg_table_locals, error)) {
teco_error_add_frame_qreg(qreg->head.name.data, qreg->head.name.len);
@@ -1310,6 +1316,7 @@ teco_state_qregspec_start_global_input(teco_machine_qregspec_t *ctx, gchar chr,
if (!ctx->parse_only) {
if (ctx->parent.must_undo)
undo__teco_string_truncate(&ctx->name, ctx->name.len);
+ /* FIXME: g_unicode_toupper() once we have an Unicode-conforming parser */
teco_string_append_c(&ctx->name, g_ascii_toupper(chr));
}
return teco_state_qregspec_done(ctx, error);
@@ -1334,6 +1341,7 @@ teco_state_qregspec_firstchar_input(teco_machine_qregspec_t *ctx, gchar chr, GEr
if (!ctx->parse_only) {
if (ctx->parent.must_undo)
undo__teco_string_truncate(&ctx->name, ctx->name.len);
+ /* FIXME: g_unicode_toupper() once we have an Unicode-conforming parser */
teco_string_append_c(&ctx->name, g_ascii_toupper(chr));
}
return &teco_state_qregspec_secondchar;
@@ -1352,6 +1360,7 @@ teco_state_qregspec_secondchar_input(teco_machine_qregspec_t *ctx, gchar chr, GE
if (!ctx->parse_only) {
if (ctx->parent.must_undo)
undo__teco_string_truncate(&ctx->name, ctx->name.len);
+ /* FIXME: g_unicode_toupper() once we have an Unicode-conforming parser */
teco_string_append_c(&ctx->name, g_ascii_toupper(chr));
}
return teco_state_qregspec_done(ctx, error);