aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-13 01:30:25 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-13 01:30:25 -0400
commitd08f795794b33a5d52e39c6b9f0c4e6e88fede3d (patch)
tree7267e0828b73685f9af0c3e9cf58212c45af289c /ast.c
parentc1c889b024529ac754f83caec4cc15971123d07b (diff)
Partially working first draft of bigints
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ast.c b/ast.c
index 2e9afaed..69991e4c 100644
--- a/ast.c
+++ b/ast.c
@@ -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, "&", "&amp;", INT64_MAX);
- text = Text$replace(text, "<", "&lt;", INT64_MAX);
- text = Text$replace(text, ">", "&gt;", INT64_MAX);
+ text = Text$replace(text, "&", "&amp;", I(-1));
+ text = Text$replace(text, "<", "&lt;", I(-1));
+ text = Text$replace(text, ">", "&gt;", 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))