Added error and warning output from parser.

Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
Yilin Sun 2023-03-08 16:47:39 +08:00
parent d5bf9c6f26
commit 2321865084
1 changed files with 8 additions and 0 deletions

View File

@ -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 */