From 00cf382196f81e22256e22e5c79a9d3503db5e91 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 13 Oct 2021 21:08:17 +0200 Subject: Add supress-errors primitive and variable tests --- src/bootstrap/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/bootstrap/main.c') diff --git a/src/bootstrap/main.c b/src/bootstrap/main.c index 052f1c0..c589b2d 100755 --- a/src/bootstrap/main.c +++ b/src/bootstrap/main.c @@ -61,6 +61,7 @@ init(void) { MAKE_ENV_PROC(global_env, "fixnum?", proc_is_fixnum); MAKE_ENV_PROC(global_env, "pair?", proc_is_pair); MAKE_ENV_PROC(global_env, "procedure?", proc_is_procedure); + MAKE_ENV_PROC(global_env, "error?", proc_is_error); MAKE_ENV_PROC(global_env, "not", proc_not); MAKE_ENV_PROC(global_env, "and", proc_and); MAKE_ENV_PROC(global_env, "or", proc_or); @@ -74,6 +75,9 @@ init(void) { MAKE_ENV_PROC(global_env, "eq?", proc_equal); MAKE_ENV_PROC(global_env, "def", proc_define); MAKE_ENV_PROC(global_env, "set!", proc_set); + + // Runtime procedures. + MAKE_ENV_PROC(global_env, "supress-errors", proc_supress_errors); } void @@ -125,7 +129,7 @@ run_repl(void) { process_source(&sv); // Check if there were any errors. - if (errors_n != 0) { + if (errors_n != 0 && !supress_errors) { for (size_t i = 0; i < errors_n; i++) { Error err = errors[i]; for (size_t j = 0; j < err.col + sizeof(REPL_PROMPT) - 2; j++) { @@ -168,7 +172,7 @@ run_file(char *file_name) { process_source(&sv); // Check if there were any errors. - if (errors_n != 0) { + if (errors_n != 0 && !supress_errors) { for (size_t i = 0; i < errors_n; i++) { Error err = errors[i]; fprintf(stderr, "%s", file_name); @@ -210,7 +214,7 @@ run_stdin(void) { process_source(&sv); // Check if there were any errors. - if (errors_n != 0) { + if (errors_n != 0 && !supress_errors) { for (size_t i = 0; i < errors_n; i++) { Error err = errors[i]; fprintf(stderr, "stdin"); -- cgit v1.2.1