diff --git a/src/eval.c b/src/eval.c index 738355d..73c5975 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1445,31 +1445,6 @@ error: return NULL; } -static void -handle_parse_error(apfl_ctx ctx, struct apfl_error error) -{ - enum apfl_result errtype = APFL_RESULT_ERR; - if (apfl_error_is_fatal_type(error.type)) { - errtype = APFL_RESULT_ERR_FATAL; - } - - const char *const_str = apfl_error_as_const_string(error); - if (const_str != NULL) { - apfl_raise_const_error(ctx, errtype, const_str); - } - - struct apfl_string string; - if (!apfl_error_as_string(error, ctx->gc.allocator, &string)) { - apfl_raise_alloc_error(ctx); - } - - if (!apfl_move_string_onto_stack(ctx, string)) { - apfl_raise_alloc_error(ctx); - } - - apfl_raise_error_with_type(ctx, -1, errtype); -} - static void iterative_runner_next_protected(apfl_ctx ctx, void *opaque) { @@ -1481,7 +1456,7 @@ iterative_runner_next_protected(apfl_ctx ctx, void *opaque) iterative_runner_eval_expr(runner, apfl_parser_get_expr(runner->parser)); return; case APFL_PARSE_ERROR: - handle_parse_error(runner->ctx, apfl_parser_get_error(runner->parser)); + apfl_raise_error_object(runner->ctx, apfl_parser_get_error(runner->parser)); return; case APFL_PARSE_EOF: runner->end = true;