From 6894dc69374efcc23619e93b040a4224588054cd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Jan 2026 23:03:00 -0500 Subject: Refactor some AST logic to keep Ints/Reals as "Integer" and "Number" AST nodes and use improved parsing logic from Int/Real --- src/formatter/formatter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/formatter') diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c index 3a6001b6..0441f9c0 100644 --- a/src/formatter/formatter.c +++ b/src/formatter/formatter.c @@ -13,6 +13,7 @@ #include "../stdlib/datatypes.h" #include "../stdlib/integers.h" #include "../stdlib/optionals.h" +#include "../stdlib/reals.h" #include "../stdlib/stdlib.h" #include "../stdlib/text.h" #include "args.h" @@ -329,11 +330,11 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) { return Match(ast, Bool)->b ? Text("yes") : Text("no"); /*inline*/ case Integer: { OptionalText_t source = ast_source(ast); - return source.length > 0 ? source : Text$from_str(Match(ast, Integer)->str); + return source.length > 0 ? source : Int$value_as_text(Match(ast, Integer)->i); } /*inline*/ case Number: { OptionalText_t source = ast_source(ast); - return source.length > 0 ? source : Text$from_str(String(Match(ast, Number)->n)); + return source.length > 0 ? source : Real$value_as_text(Match(ast, Number)->n); } /*inline*/ case Var: return Text$from_str(Match(ast, Var)->name); -- cgit v1.2.3