mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-08-19 10:46:22 -06:00
avoid looping with recursive epsilon categories
This commit is contained in:
@@ -140,6 +140,24 @@ void PgfAbstractParser::symbol(Item *item, State *state, PgfSymbol sym)
|
||||
suspend(cont,item,n_suspended1,suspended.size());
|
||||
}
|
||||
} else {
|
||||
interval_t value_i = item->interval(item->rule->args[symcat->d]);
|
||||
interval_t lin_idx_i = item->interval(ref<PgfLParam>::from_ptr(&symcat->r));
|
||||
|
||||
bool found = false;
|
||||
CCat *prev_ccat = ccat;
|
||||
while (prev_ccat != NULL && prev_ccat->fid > initial_fid && prev_ccat->cont->state == state) {
|
||||
if (prev_ccat->value == value_i && prev_ccat->lin_idx == lin_idx_i) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
prev_ccat = prev_ccat->cont->ccat;
|
||||
}
|
||||
if (found) {
|
||||
item->dot++;
|
||||
state->push_item(item);
|
||||
break;
|
||||
}
|
||||
|
||||
Cont *&cont = state->conts2[ccat];
|
||||
if (cont == NULL) {
|
||||
cont = new Cont;
|
||||
@@ -151,9 +169,6 @@ void PgfAbstractParser::symbol(Item *item, State *state, PgfSymbol sym)
|
||||
cont->state = state;
|
||||
}
|
||||
|
||||
interval_t value_i = item->interval(item->rule->args[symcat->d]);
|
||||
interval_t lin_idx_i = item->interval(ref<PgfLParam>::from_ptr(&symcat->r));
|
||||
|
||||
bool subsumed = false;
|
||||
for (auto it1 : cont->suspended.overlaps(value_i)) {
|
||||
if (it1.first.first <= value_i.first && it1.first.second >= value_i.second) {
|
||||
|
||||
Reference in New Issue
Block a user