From 0ece8f19abf4dba1d3c568aca60d2c960d75efa6 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Tue, 10 Dec 2013 15:00:52 +0000 Subject: loading and unloading of languages in the C runtime and in the Python bindings --- src/runtime/c/pgf/linearizer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/runtime/c/pgf/linearizer.c') diff --git a/src/runtime/c/pgf/linearizer.c b/src/runtime/c/pgf/linearizer.c index 732bce75a..0f8473639 100644 --- a/src/runtime/c/pgf/linearizer.c +++ b/src/runtime/c/pgf/linearizer.c @@ -618,8 +618,17 @@ pgf_cnc_tree_enum_next(GuEnum* self, void* to, GuPool* pool) } PgfCncTreeEnum* -pgf_lzr_concretize(PgfConcr* concr, PgfExpr expr, GuPool* pool) +pgf_lzr_concretize(PgfConcr* concr, PgfExpr expr, GuExn* err, GuPool* pool) { + if (concr->fun_indices == NULL || + concr->coerce_idx == NULL) { + GuExnData* err_data = gu_raise(err, PgfExn); + if (err_data) { + err_data->data = "The concrete syntax is not loaded"; + return NULL; + } + } + PgfLzn* lzn = gu_new(PgfLzn, pool); lzn->concr = concr; lzn->expr = expr; @@ -947,7 +956,10 @@ pgf_linearize(PgfConcr* concr, PgfExpr expr, GuOut* out, GuExn* err) GuPool* tmp_pool = gu_local_pool(); GuEnum* cts = - pgf_lzr_concretize(concr, expr, tmp_pool); + pgf_lzr_concretize(concr, expr, err, tmp_pool); + if (!gu_ok(err)) + return; + PgfCncTree ctree = gu_next(cts, PgfCncTree, tmp_pool); if (!gu_variant_is_null(ctree)) { ctree = pgf_lzr_wrap_linref(ctree, tmp_pool); -- cgit v1.2.3