bug fixes

This commit is contained in:
Krasimir Angelov
2026-05-13 22:05:44 +02:00
parent c37e7b5a7a
commit 1daa00aa29
+14 -14
View File
@@ -2,8 +2,8 @@
#include "printer.h" #include "printer.h"
#include "parser.h" #include "parser.h"
//#define DEBUG_PARSER #define DEBUG_PARSER
//#define DEBUG_EXPRS #define DEBUG_EXPRS
PgfAbstractParser::PgfAbstractParser(ref<PgfConcr> concr) PgfAbstractParser::PgfAbstractParser(ref<PgfConcr> concr)
{ {
@@ -582,21 +582,15 @@ void PgfAbstractParser::td_predict(State *state, Cont *cont, Production *prod, I
} }
for (size_t i = 0; i < item->args.size(); i++) { for (size_t i = 0; i < item->args.size(); i++) {
if (prod->args[i] != NULL) { if (!item->instantiate(item->rule->args[i], prod->rule, &prod->vars[0], prod->rule->args[i])) {
/* if (!item->instantiate(item->rule->args[i], prod->args[i]->value)) { delete item;
delete item; goto next;
goto next;
}*/
} else {
/*if (!item->instantiate(item->rule->args[i], prod->args[i]->value)) {
delete item;
continue;
}*/
} }
item->args[i] = prod->args[i]; item->args[i] = prod->args[i];
} }
process(item, state->start, false); process(item, state->start, false);
next:;
} }
} }
default:; default:;
@@ -1466,15 +1460,21 @@ void PgfParseTableMaker::symbol_bind(Item *item, const PgfTextSpot &spot, PgfSym
void PgfParseTableMaker::suspend(Cont *cont,Item *item,size_t n_suspended) void PgfParseTableMaker::suspend(Cont *cont,Item *item,size_t n_suspended)
{ {
// collect the cats first, since calling combine in
// the loop will change the search index
std::vector<CCat*> ccats;
for (auto it1 : cont->state->completed[cont]) { for (auto it1 : cont->state->completed[cont]) {
for (auto it2 : it1.second) { for (auto it2 : it1.second) {
CCat *ccat = it2.second; CCat *ccat = it2.second;
if (ccat != NULL) { if (ccat != NULL) {
Item *new_item = new (item) Item; ccats.push_back(ccat);
combine(cont->state,new_item,ccat);
} }
} }
} }
for (CCat *ccat : ccats) {
Item *new_item = new (item) Item;
combine(cont->state,new_item,ccat);
}
auto pitem = clone_item(item); auto pitem = clone_item(item);
auto acat = ref<PgfSymbolACat>::from_ptr((PgfSymbolACat*) &cont->lincat->name); auto acat = ref<PgfSymbolACat>::from_ptr((PgfSymbolACat*) &cont->lincat->name);