aboutsummaryrefslogtreecommitdiff
path: root/repl.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-22 14:02:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-22 14:02:48 -0400
commitad51b208b4924d04f1d6a804178a67994b4f9e59 (patch)
tree9ae29e0af02b7406a0cf07fdd8b0dd7fdac0aedf /repl.c
parent2055439be4f5053b9a4d631cefd8bb7c83a8e4e3 (diff)
Overhaul of import syntax. Now everything uses `use`: `use foo`, `use
./foo.tm`, `use <foo.h>`, `use libfoo.so`
Diffstat (limited to 'repl.c')
-rw-r--r--repl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/repl.c b/repl.c
index 111aff1d..8ac4c7d5 100644
--- a/repl.c
+++ b/repl.c
@@ -9,6 +9,7 @@
#include <unistd.h>
#include "builtins/tomo.h"
+#include "builtins/util.h"
#include "typecheck.h"
#include "parse.h"
@@ -46,9 +47,8 @@ void repl(void)
while ((len=getline(&line, &buf_size, stdin)) >= 0) {
if (len > 1) {
char *code = line;
-#define starts_with(line, prefix) (strncmp(line, prefix " ", strlen(prefix)+1) == 0)
- if (starts_with(line, "if") || starts_with(line, "for") || starts_with(line, "while")
- || starts_with(line, "func") || starts_with(line, "struct") || starts_with(line, "lang")) {
+ if (starts_with(line, "if ") || starts_with(line, "for ") || starts_with(line, "while ")
+ || starts_with(line, "func ") || starts_with(line, "struct ") || starts_with(line, "lang ")) {
printf("\x1b[33;1m..\x1b[m ");
fflush(stdout);
code = GC_strdup(line);