aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/parser.c b/src/parser.c
index 45e1e3c..231ad3e 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -792,15 +792,17 @@ teco_state_stringbuilding_ctle_num_input(teco_machine_stringbuilding_t *ctx, gun
/* parse-only mode */
return &teco_state_stringbuilding_start;
- teco_int_t value;
- if (!qreg->vtable->get_integer(qreg, &value, error))
+ teco_number_t value;
+ gboolean is_float;
+ if (!qreg->vtable->get_number(qreg, &value, &is_float, error))
return NULL;
/*
* NOTE: Numbers can always be safely formatted as null-terminated strings.
*/
gchar buffer[TECO_EXPRESSIONS_FORMAT_LEN];
- const gchar *num = teco_expressions_format(buffer, value, ctx->qreg_table_locals->radix);
+ const gchar *num = is_float ? teco_expressions_format_float(buffer, value.f, 6)
+ : teco_expressions_format_int(buffer, value.i, ctx->qreg_table_locals->radix);
teco_machine_stringbuilding_append(ctx, num, strlen(num));
return &teco_state_stringbuilding_start;
@@ -830,7 +832,7 @@ teco_state_stringbuilding_ctle_u_input(teco_machine_stringbuilding_t *ctx, gunic
return &teco_state_stringbuilding_start;
teco_int_t value;
- if (!qreg->vtable->get_integer(qreg, &value, error))
+ if (!teco_qreg_get_integer(qreg, &value, error))
return NULL;
if (!teco_machine_stringbuilding_append_c(ctx, value)) {