From 2321865084e41dd1c005135f9901f09595e9658e Mon Sep 17 00:00:00 2001 From: Yilin Sun Date: Wed, 8 Mar 2023 16:47:39 +0800 Subject: [PATCH] Added error and warning output from parser. Signed-off-by: Yilin Sun --- src/app_mrb_repl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app_mrb_repl.c b/src/app_mrb_repl.c index 385596d..e7caeb8 100644 --- a/src/app_mrb_repl.c +++ b/src/app_mrb_repl.c @@ -235,6 +235,14 @@ int app_mrb_repl_exec(bool *exit) { /* TODO: Compile block and feed to VM */ /* TODO: Adjust CXT->lineno */ + if(parser->nerr) { + printf("Error at line %d: %s\n", parser->error_buffer[0].lineno, parser->error_buffer[0].message); + } + + if(parser->nwarn) { + printf("Warn at line %d: %s\n", parser->warn_buffer[0].lineno, parser->warn_buffer[0].message); + } + mrb_gc_arena_restore(s_mrb_state, s_gc_arena_idx); /* We are done with current block, free buffer */