diff options
Diffstat (limited to 'src/bootstrap/main.c')
-rwxr-xr-x | src/bootstrap/main.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c index b5fd821..662831e 100755 --- a/src/bootstrap/main.c +++ b/src/bootstrap/main.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | 5 | ||
6 | #include "string_view.c" | 6 | #include "string_view.c" |
7 | #include "read_line.c" | ||
7 | 8 | ||
8 | void | 9 | void |
9 | process_source(const StringView *source) { | 10 | process_source(const StringView *source) { |
@@ -14,11 +15,17 @@ process_source(const StringView *source) { | |||
14 | 15 | ||
15 | void | 16 | void |
16 | run_repl(void) { | 17 | run_repl(void) { |
17 | printf("BDL REPL (Press Ctrl-C to exit)\n"); | 18 | printf("BDL REPL (Press Ctrl-D or Ctrl-C to exit)\n"); |
18 | while (true) { | 19 | while (true) { |
19 | printf(REPL_PROMPT); | 20 | printf(REPL_PROMPT); |
20 | getchar(); | 21 | StringView sv = read_line(); |
21 | process_source(NULL); | 22 | if (sv.start == NULL) { |
23 | return; | ||
24 | } | ||
25 | process_source(&sv); | ||
26 | if (sv.n != 0) { | ||
27 | printf("\n"); | ||
28 | } | ||
22 | } | 29 | } |
23 | } | 30 | } |
24 | 31 | ||