diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2012-03-12 14:25:51 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2012-03-12 14:25:51 +0000 |
| commit | 230f309317af6ae79f49091c9580223f756dbfb8 (patch) | |
| tree | ee1cee3c48370fcf04b63794250c71c16b28cbfb /src/runtime/c/pgf/linearize.c | |
| parent | 1726995921f6c05686b2b06f672b1376e589f8ac (diff) | |
libpgf: a new implementation for literals which also allows custom literals. the same mechanism is now used for the metavariables
Diffstat (limited to 'src/runtime/c/pgf/linearize.c')
| -rw-r--r-- | src/runtime/c/pgf/linearize.c | 26 |
1 files changed, 2 insertions, 24 deletions
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 <gu/string.h> #include <gu/assert.h> #include <pgf/expr.h> +#include <pgf/literals.h> 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? |
