aboutsummaryrefslogtreecommitdiff
path: root/src/compile/expressions.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2026-01-11 20:06:45 -0500
committerBruce Hill <bruce@bruce-hill.com>2026-01-11 20:06:45 -0500
commitb97ea6b6ac3498b21321e1f93ccc1a2dd145e9d7 (patch)
tree834180f2c5a2ad29424279153d01c2bd52679823 /src/compile/expressions.c
parent573656fce2b7e1b0fc36944f60fd135117b6bbb6 (diff)
Rename AST nodes: Int -> Integer, Num -> Number
Diffstat (limited to 'src/compile/expressions.c')
-rw-r--r--src/compile/expressions.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compile/expressions.c b/src/compile/expressions.c
index 321f5f9f..ae57204b 100644
--- a/src/compile/expressions.c
+++ b/src/compile/expressions.c
@@ -107,8 +107,8 @@ Text_t compile(env_t *env, ast_t *ast) {
// return Texts("_$", Match(ast, Var)->name);
code_err(ast, "I don't know of any variable by this name");
}
- case Int: return compile_int(ast);
- case Num: {
+ case Integer: return compile_int(ast);
+ case Number: {
const char *src = String(string_slice(ast->start, (size_t)(ast->end - ast->start)));
Text_t corrected = Text$from_str(src);
corrected = Text$replace(corrected, Text("_"), EMPTY_TEXT);
@@ -158,7 +158,8 @@ Text_t compile(env_t *env, ast_t *ast) {
return Texts(b->code, "(", compile_arguments(env, ast, fn->args, new (arg_ast_t, .value = value)), ")");
}
- if (t->tag == IntType || t->tag == FloatType || t->tag == RealType) return Texts("-(", compile(env, value), ")");
+ if (t->tag == IntType || t->tag == FloatType || t->tag == RealType)
+ return Texts("-(", compile(env, value), ")");
code_err(ast, "I don't know how to get the negative value of type ", type_to_text(t));
}
@@ -215,7 +216,8 @@ Text_t compile(env_t *env, ast_t *ast) {
comparison =
Texts("(Int$compare_value(", lhs_key, ", ", rhs_key, ")", (ast->tag == Min ? "<=" : ">="), "0)");
else if (key_t->tag == RealType)
- comparison = Texts("(Real$compare_values(", lhs_key, ", ", rhs_key, ")", (ast->tag == Min ? "<=" : ">="), "0)");
+ comparison =
+ Texts("(Real$compare_values(", lhs_key, ", ", rhs_key, ")", (ast->tag == Min ? "<=" : ">="), "0)");
else if (key_t->tag == IntType || key_t->tag == FloatType || key_t->tag == BoolType || key_t->tag == PointerType
|| key_t->tag == ByteType)
comparison = Texts("((", lhs_key, ")", (ast->tag == Min ? "<=" : ">="), "(", rhs_key, "))");