From 230f309317af6ae79f49091c9580223f756dbfb8 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Mon, 12 Mar 2012 14:25:51 +0000 Subject: libpgf: a new implementation for literals which also allows custom literals. the same mechanism is now used for the metavariables --- src/runtime/c/pgf/linearize.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src/runtime/c/pgf/linearize.c') diff --git a/src/runtime/c/pgf/linearize.c b/src/runtime/c/pgf/linearize.c index 15b7ba3cc..e77eb13b9 100644 --- a/src/runtime/c/pgf/linearize.c +++ b/src/runtime/c/pgf/linearize.c @@ -27,6 +27,7 @@ #include #include #include +#include typedef GuStringMap PgfLinInfer; typedef GuSeq PgfProdSeq; @@ -338,29 +339,6 @@ finish: return ret; } -PgfCCat* -pgf_literal_cat(PgfLzn* lzn, PgfLiteral lit) -{ - int fid; - - switch (gu_variant_tag(lit)) { - case PGF_LITERAL_STR: - fid = -1; - break; - case PGF_LITERAL_INT: - fid = -2; - break; - case PGF_LITERAL_FLT: - fid = -3; - break; - default: - gu_impossible(); - return NULL; - } - - return gu_map_get(lzn->concr->ccats, &fid, PgfCCat*); -} - static PgfCCat* pgf_lzn_infer(PgfLzn* lzn, PgfExpr expr, GuPool* pool, PgfCncTree* ctree_out) { @@ -380,7 +358,7 @@ pgf_lzn_infer(PgfLzn* lzn, PgfExpr expr, GuPool* pool, PgfCncTree* ctree_out) PgfCncTreeLit, .lit = elit->lit); } - ret = pgf_literal_cat(lzn, elit->lit); + ret = pgf_literal_cat(lzn->concr, elit->lit); } default: // XXX: should we do something here? -- cgit v1.2.3