diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-13 01:30:25 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-13 01:30:25 -0400 |
| commit | d08f795794b33a5d52e39c6b9f0c4e6e88fede3d (patch) | |
| tree | 7267e0828b73685f9af0c3e9cf58212c45af289c /ast.c | |
| parent | c1c889b024529ac754f83caec4cc15971123d07b (diff) | |
Partially working first draft of bigints
Diffstat (limited to 'ast.c')
| -rw-r--r-- | ast.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -5,6 +5,7 @@ #include <printf.h> #include "ast.h" +#include "builtins/integers.h" #include "builtins/text.h" static const char *OP_NAMES[] = { @@ -34,9 +35,9 @@ static CORD optional_tagged_type(const char *tag, type_ast_t *ast); CORD xml_escape(CORD text) { - text = Text$replace(text, "&", "&", INT64_MAX); - text = Text$replace(text, "<", "<", INT64_MAX); - text = Text$replace(text, ">", ">", INT64_MAX); + text = Text$replace(text, "&", "&", I(-1)); + text = Text$replace(text, "<", "<", I(-1)); + text = Text$replace(text, ">", ">", I(-1)); return text; } @@ -98,7 +99,7 @@ CORD ast_to_xml(ast_t *ast) T(Nil, "<Nil>%r</Nil>", type_ast_to_xml(data.type)) T(Bool, "<Bool value=\"%s\" />", data.b ? "yes" : "no") T(Var, "<Var>%s</Var>", data.name) - T(Int, "<Int bits=\"%ld\">%ld</Int>", data.bits, data.i) + T(Int, "<Int bits=\"%ld\">%s</Int>", data.bits, data.str) T(Num, "<Num bits=\"%ld\">%g</Num>", data.bits, data.n) T(TextLiteral, "%r", xml_escape(data.cord)) T(TextJoin, "<Text%r>%r</Text>", data.lang ? CORD_all(" lang=\"", data.lang, "\"") : CORD_EMPTY, ast_list_to_xml(data.children)) |
