the bottom up filtering in the C runtime is temporary disabled. It takes too much memory and even makes it impossible to load the Finnish and the German parsing grammars.

This commit is contained in:
kr.angelov
2013-03-19 10:59:44 +00:00
parent 8041999405
commit 1ddcfc219e

View File

@@ -10,6 +10,7 @@
//#define PGF_PARSER_DEBUG //#define PGF_PARSER_DEBUG
//#define PGF_COUNTS_DEBUG //#define PGF_COUNTS_DEBUG
//#define PGF_LEFTCORNER_DEBUG //#define PGF_LEFTCORNER_DEBUG
//#define PGF_LEFTCORNER_FILTER
typedef GuBuf PgfItemBuf; typedef GuBuf PgfItemBuf;
static GU_DEFINE_TYPE(PgfItemBuf, abstract, _); static GU_DEFINE_TYPE(PgfItemBuf, abstract, _);
@@ -939,6 +940,7 @@ pgf_parsing_complete(PgfParseState* before, PgfParseState* after,
} }
} }
#if PGF_LEFTCORNER_FILTER
typedef struct { typedef struct {
GuMapItor fn; GuMapItor fn;
PgfConcr* concr; PgfConcr* concr;
@@ -962,11 +964,13 @@ pgf_parsing_bu_filter_iter(GuMapItor* fn, const void* key, void* value, GuExn* e
} }
} }
} }
#endif
static bool static bool
pgf_parsing_bu_filter(PgfParseState* before, PgfParseState* after, pgf_parsing_bu_filter(PgfParseState* before, PgfParseState* after,
PgfCCat* ccat, size_t lin_idx) PgfCCat* ccat, size_t lin_idx)
{ {
#if PGF_LEFTCORNER_FILTER
while (ccat->conts != NULL) // back to the original PgfCCat while (ccat->conts != NULL) // back to the original PgfCCat
ccat = ccat->conts->ccat; ccat = ccat->conts->ccat;
PgfCFCat cfc = {ccat, lin_idx}; PgfCFCat cfc = {ccat, lin_idx};
@@ -980,7 +984,7 @@ pgf_parsing_bu_filter(PgfParseState* before, PgfParseState* after,
gu_map_iter(after->ts->lexicon_idx, &clo.fn, NULL); gu_map_iter(after->ts->lexicon_idx, &clo.fn, NULL);
return clo.filter; return clo.filter;
} }
#endif
return false; return false;
} }
@@ -2410,6 +2414,7 @@ pgf_parser_leftcorner_iter_cats(GuMapItor* fn, const void* key, void* value, GuE
} }
} }
#ifdef PGF_LEFTCORNER_FILTER
static void static void
pgf_parser_leftcorner_closure(PgfProductionIdx* set, PgfItemBuf* items, pgf_parser_leftcorner_closure(PgfProductionIdx* set, PgfItemBuf* items,
PgfContsMap* conts_map, GuPool* pool) PgfContsMap* conts_map, GuPool* pool)
@@ -2472,6 +2477,7 @@ pgf_parser_leftcorner_iter_conts(GuMapItor* fn, const void* key, void* value, Gu
} }
} }
} }
#endif
void void
pgf_parser_index(PgfConcr* concr, GuPool *pool) pgf_parser_index(PgfConcr* concr, GuPool *pool)
@@ -2486,11 +2492,13 @@ pgf_parser_index(PgfConcr* concr, GuPool *pool)
pool, tmp_pool }; pool, tmp_pool };
gu_map_iter(concr->ccats, &clo1.fn, NULL); gu_map_iter(concr->ccats, &clo1.fn, NULL);
#ifdef PGF_LEFTCORNER_FILTER
PgfLeftcornerFn clo2 = { { pgf_parser_leftcorner_iter_conts }, PgfLeftcornerFn clo2 = { { pgf_parser_leftcorner_iter_conts },
concr, conts_map, generated_cats, concr, conts_map, generated_cats,
concr->total_cats, concr->total_cats,
pool, tmp_pool }; pool, tmp_pool };
gu_map_iter(conts_map, &clo2.fn, NULL); gu_map_iter(conts_map, &clo2.fn, NULL);
#endif
gu_pool_free(tmp_pool); gu_pool_free(tmp_pool);
} }