mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 13:59:31 -06:00
libpgf: move the lindefs field from PgfCncCat to PgfCCat. display the list in the grammar printout
This commit is contained in:
@@ -4,11 +4,10 @@
|
||||
#include <gu/variant.h>
|
||||
#include <gu/assert.h>
|
||||
|
||||
|
||||
PgfCCat pgf_ccat_string = { NULL, GU_NULL_SEQ, -1 };
|
||||
PgfCCat pgf_ccat_int = { NULL, GU_NULL_SEQ, -2 };
|
||||
PgfCCat pgf_ccat_float = { NULL, GU_NULL_SEQ, -3 };
|
||||
PgfCCat pgf_ccat_var = { NULL, GU_NULL_SEQ, -4 };
|
||||
PgfCCat pgf_ccat_string = { NULL, NULL, GU_NULL_SEQ, -1 };
|
||||
PgfCCat pgf_ccat_int = { NULL, NULL, GU_NULL_SEQ, -2 };
|
||||
PgfCCat pgf_ccat_float = { NULL, NULL, GU_NULL_SEQ, -3 };
|
||||
PgfCCat pgf_ccat_var = { NULL, NULL, GU_NULL_SEQ, -4 };
|
||||
|
||||
PgfCCatId
|
||||
pgf_literal_cat(PgfLiteral lit)
|
||||
@@ -59,6 +58,7 @@ typedef GuType_GuStringMap GuType_PgfCIdMap;
|
||||
|
||||
GU_DEFINE_TYPE(PgfCCat, struct,
|
||||
GU_MEMBER_S(PgfCCat, cnccat, PgfCncCat),
|
||||
GU_MEMBER_P(PgfCCat, lindefs, PgfFunIds),
|
||||
GU_MEMBER(PgfCCat, prods, PgfProductionSeq));
|
||||
|
||||
GU_DEFINE_TYPE(PgfCCatId, shared, gu_type(PgfCCat));
|
||||
@@ -100,7 +100,6 @@ GU_DEFINE_TYPE(
|
||||
GU_MEMBER(PgfCncCat, cid, PgfCId),
|
||||
GU_MEMBER_P(PgfCncCat, cats, PgfCCatIds),
|
||||
GU_MEMBER(PgfCncCat, n_lins, size_t),
|
||||
GU_MEMBER_P(PgfCncCat, lindefs, PgfFunIds),
|
||||
GU_MEMBER_P(PgfCncCat, labels, GuStringL));
|
||||
|
||||
// GU_DEFINE_TYPE(PgfSequence, GuList, gu_ptr_type(PgfSymbol));
|
||||
|
||||
@@ -143,7 +143,6 @@ struct PgfCat {
|
||||
struct PgfCncCat {
|
||||
PgfCId cid;
|
||||
PgfCCatIds* cats;
|
||||
PgfFunIds* lindefs;
|
||||
size_t n_lins;
|
||||
|
||||
GuStringL* labels;
|
||||
@@ -173,6 +172,7 @@ struct PgfAlternative {
|
||||
|
||||
struct PgfCCat {
|
||||
PgfCncCat* cnccat;
|
||||
PgfFunIds* lindefs;
|
||||
PgfProductionSeq prods;
|
||||
int fid;
|
||||
};
|
||||
|
||||
@@ -437,6 +437,7 @@ pgf_read_to_PgfCCatId(GuType* type, PgfReader* rdr, void* to)
|
||||
if (!ccat) {
|
||||
ccat = gu_new(PgfCCat, rdr->pool);
|
||||
ccat->cnccat = NULL;
|
||||
ccat->lindefs = gu_map_get(rdr->curr_lindefs, &fid, PgfFunIds*);
|
||||
ccat->prods = gu_null_seq;
|
||||
ccat->fid = fid;
|
||||
|
||||
@@ -449,14 +450,16 @@ pgf_read_to_PgfCCatId(GuType* type, PgfReader* rdr, void* to)
|
||||
static void
|
||||
pgf_read_to_PgfCCat(GuType* type, PgfReader* rdr, void* to)
|
||||
{
|
||||
(void) type;
|
||||
gu_enter("->");
|
||||
PgfCCat* cat = to;
|
||||
cat->cnccat = NULL;
|
||||
pgf_read_to(rdr, gu_type(PgfProductionSeq), &cat->prods);
|
||||
int* fidp = rdr->curr_key;
|
||||
cat->fid = *fidp;
|
||||
gu_exit("<-");
|
||||
(void) type;
|
||||
gu_enter("->");
|
||||
int* fidp = rdr->curr_key;
|
||||
|
||||
PgfCCat* ccat = to;
|
||||
ccat->cnccat = NULL;
|
||||
ccat->lindefs = gu_map_get(rdr->curr_lindefs, fidp, PgfFunIds*);
|
||||
pgf_read_to(rdr, gu_type(PgfProductionSeq), &ccat->prods);
|
||||
ccat->fid = *fidp;
|
||||
gu_exit("<-");
|
||||
}
|
||||
|
||||
// This is only needed because new_struct would otherwise override.
|
||||
@@ -736,6 +739,7 @@ pgf_read_new_PgfCncCat(GuType* type, PgfReader* rdr, GuPool* pool,
|
||||
if (!ccat) {
|
||||
ccat = gu_new(PgfCCat, rdr->pool);
|
||||
ccat->cnccat = NULL;
|
||||
ccat->lindefs = gu_map_get(rdr->curr_lindefs, &fid, PgfFunIds*);
|
||||
ccat->prods = gu_null_seq;
|
||||
ccat->fid = fid;
|
||||
|
||||
@@ -752,7 +756,6 @@ pgf_read_new_PgfCncCat(GuType* type, PgfReader* rdr, GuPool* pool,
|
||||
}
|
||||
cnccat->n_lins = n_lins == -1 ? 0 : (size_t) n_lins;
|
||||
cnccat->cats = cats;
|
||||
cnccat->lindefs = gu_map_get(rdr->curr_lindefs, &first, PgfFunIds*);
|
||||
cnccat->labels = pgf_read_new(rdr, gu_type(GuStringL),
|
||||
pool, NULL);
|
||||
gu_exit("<-");
|
||||
|
||||
Reference in New Issue
Block a user