frontend: update parser api usage with diagnostic support
This commit is contained in:
@@ -98,6 +98,8 @@ static int compile_file(const char *path, const b_arglist *args)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ivy_parser_set_diag_ctx(parser, diag);
|
||||||
|
|
||||||
struct mie_ctx *ctx = mie_ctx_create();
|
struct mie_ctx *ctx = mie_ctx_create();
|
||||||
|
|
||||||
struct ivy_codegen *codegen;
|
struct ivy_codegen *codegen;
|
||||||
@@ -135,6 +137,13 @@ static int compile_file(const char *path, const b_arglist *args)
|
|||||||
|
|
||||||
status = ivy_parser_push_token(parser, tok);
|
status = ivy_parser_push_token(parser, tok);
|
||||||
|
|
||||||
|
if (status == IVY_ERR_BAD_SYNTAX) {
|
||||||
|
ivy_diag_ctx_write(
|
||||||
|
diag, IVY_DIAG_FORMAT_PRETTY, &diag_stream);
|
||||||
|
ivy_token_destroy(tok);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (status != IVY_OK) {
|
if (status != IVY_OK) {
|
||||||
b_err("failed to parse '%s'", path);
|
b_err("failed to parse '%s'", path);
|
||||||
b_i("reason: parse error (%s)",
|
b_i("reason: parse error (%s)",
|
||||||
|
|||||||
Reference in New Issue
Block a user