Compare commits

...

2 commits

Author SHA1 Message Date
bb501d9c1e repl: add output when leaving from c-d 2019-10-20 13:13:32 -03:00
c75db19523 repl: ignore comments
closes #10
2019-10-20 13:12:49 -03:00

View file

@ -109,7 +109,10 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
lang.reset();
var rd_line = readline.readline(c"> ");
if (rd_line == null) break;
if (rd_line == null) {
std.debug.warn("leaving from eof\n");
break;
}
readline.add_history(rd_line);
//defer std.heap.c_allocator.destroy(rd_line);
@ -137,6 +140,8 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
} else if (std.mem.eql(u8, line, "quit") or std.mem.eql(u8, line, "q")) {
std.debug.warn("leaving\n");
break;
} else if (std.mem.startsWith(u8, line, "#")) {
continue;
}
var cmds_parsed = lang.parse(line) catch |err| {