From 5e119f776780c05ca2002ef692d7458801585bdc Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Mon, 12 Jan 2026 21:17:36 +0000 Subject: lowercase types support. --- src/repl/repl.c | 67 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 25 deletions(-) (limited to 'src/repl/repl.c') diff --git a/src/repl/repl.c b/src/repl/repl.c index c259bff..22fe95d 100644 --- a/src/repl/repl.c +++ b/src/repl/repl.c @@ -1218,9 +1218,8 @@ void run_repl(const char *self_path) child->type == NODE_EXPR_CALL || child->type == NODE_EXPR_MEMBER || child->type == NODE_EXPR_INDEX || child->type == NODE_EXPR_CAST || child->type == NODE_EXPR_SIZEOF || child->type == NODE_EXPR_STRUCT_INIT || - child->type == NODE_EXPR_ARRAY_LITERAL || - child->type == NODE_EXPR_SLICE || child->type == NODE_TERNARY || - child->type == NODE_MATCH) + child->type == NODE_EXPR_ARRAY_LITERAL || child->type == NODE_EXPR_SLICE || + child->type == NODE_TERNARY || child->type == NODE_MATCH) { is_expr = 1; } @@ -1229,21 +1228,30 @@ void run_repl(const char *self_path) if (is_expr) { size_t probesz = 4096; - for(int i=0; i&1", self_path, p_path); - + FILE *pp = popen(p_cmd, "r"); int is_void = 0; - if (pp) { + if (pp) + { char buf[1024]; - while(fgets(buf, sizeof(buf), pp)) { - if (strstr(buf, "void") && strstr(buf, "expression")) { + while (fgets(buf, sizeof(buf), pp)) + { + if (strstr(buf, "void") && strstr(buf, "expression")) + { is_void = 1; } } pclose(pp); } - if (!is_void) { - strcat(full_code, "println \"{"); - strcat(full_code, last_line); - strcat(full_code, "}\";"); - } else { + if (!is_void) + { + strcat(full_code, "println \"{"); strcat(full_code, last_line); + strcat(full_code, "}\";"); } - } else { + else + { + strcat(full_code, last_line); + } + } + else + { strcat(full_code, last_line); } free(probe_code); -- cgit v1.2.3