summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/linearizer.c
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-12-10 15:00:52 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-12-10 15:00:52 +0000
commit0ece8f19abf4dba1d3c568aca60d2c960d75efa6 (patch)
tree88ad121f3ece72abd43491f1a95b1f70c992c991 /src/runtime/c/pgf/linearizer.c
parent8121124d722b136b116dc27afaaae174233b6731 (diff)
loading and unloading of languages in the C runtime and in the Python bindings
Diffstat (limited to 'src/runtime/c/pgf/linearizer.c')
-rw-r--r--src/runtime/c/pgf/linearizer.c16
1 files changed, 14 insertions, 2 deletions
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);