diff options
Diffstat (limited to 'src/runtime/c/pgf/pgf.c')
| -rw-r--r-- | src/runtime/c/pgf/pgf.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/pgf.c b/src/runtime/c/pgf/pgf.c index 155b93135..ee736616c 100644 --- a/src/runtime/c/pgf/pgf.c +++ b/src/runtime/c/pgf/pgf.c @@ -166,3 +166,35 @@ pgf_has_linearization(PgfConcr* concr, PgfCId id) gu_map_get(concr->fun_indices, id, PgfCncOverloadMap*); return (overl_table != NULL); } + +GuPool* +pgf_concr_get_pool(PgfConcr* concr) +{ + GuPool* pool = concr->pool; + if (pool == NULL) + pool = gu_container(concr->abstr, PgfPGF, abstract)->pool; + return pool; +} + +void +pgf_concr_add_literal(PgfConcr *concr, PgfCId cat, + PgfLiteralCallback* callback, + GuExn* err) +{ + if (concr->cnccats == NULL || + concr->callbacks == NULL) { + GuExnData* err_data = gu_raise(err, PgfExn); + if (err_data) { + err_data->data = "The concrete syntax is not loaded"; + return; + } + } + + PgfCncCat* cnccat = + gu_map_get(concr->cnccats, cat, PgfCncCat*); + if (cnccat == NULL) + return; + + gu_map_put(concr->callbacks, cnccat, + PgfLiteralCallback*, callback); +} |
