now fully functional Java API for custom literals

This commit is contained in:
kr.angelov
2014-04-10 14:14:31 +00:00
parent 348c9c4233
commit 1ca09448f9
14 changed files with 399 additions and 110 deletions

View File

@@ -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);
}