mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-12 20:52:50 -06:00
now fully functional Java API for custom literals
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user