diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-16 23:31:06 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-16 23:31:06 -0500 |
| commit | f07c07e551b89b66b14936ae4573e656fbd7afb6 (patch) | |
| tree | 3c9acb1228c7e74ce671661bf9c15616e0cfc7f7 /src/compile | |
| parent | c5878cced02fd1ed7e7940eaf8eb8b4cce23a9d4 (diff) | |
Fix parens parsing and hook up sqrt
Diffstat (limited to 'src/compile')
| -rw-r--r-- | src/compile/expressions.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/compile/expressions.c b/src/compile/expressions.c index f249993f..638480bd 100644 --- a/src/compile/expressions.c +++ b/src/compile/expressions.c @@ -110,14 +110,11 @@ Text_t compile(env_t *env, ast_t *ast) { case Num: { // return Text$from_str(String(hex_double(Match(ast, Num)->n))); Text_t original = Text$from_str(String(string_slice(ast->start, (size_t)(ast->end - ast->start)))); - // Text_t roundtrip = Text$from_str(String(Match(ast, Num)->n)); - // original = Text$replace(original, Text("_"), EMPTY_TEXT); - // original = Text$without_suffix(original, Text(".")); - // if (Text$equal_values(original, roundtrip)) { - // return Texts("Real$from_float64(", Text$from_str(String(hex_double(Match(ast, Num)->n))), ")"); - // } else { + original = Text$replace(original, Text("_"), EMPTY_TEXT); + original = Text$replace(original, Text("("), EMPTY_TEXT); + original = Text$replace(original, Text(")"), EMPTY_TEXT); + original = Text$replace(original, Text(" "), EMPTY_TEXT); return Texts("Real$parse(Text(\"", original, "\"), NULL)"); - // } } case Not: { ast_t *value = Match(ast, Not)->value; |
