修正并完善代码;

This commit is contained in:
satunreric 2021-04-29 21:46:57 +08:00
parent f7355e63e2
commit da2a2f7cc8

View File

@ -628,11 +628,11 @@ public:
wcout << pool->getSymbol(p_pdt->left)->name << L" -> " ;
int i = 0;
for(const auto &symbol : p_pdt->right) {
if(i++ == dot_index) wcout << L'*';
if(i++ == dot_index) wcout << "·";
wcout << pool->getSymbol(symbol)->name;
}
if(i++ == dot_index) wcout << L'*';
if(i++ == dot_index) wcout << "·";
wcout << L',' << pool->getSymbol(item->get_terminator())->name << endl;
}
@ -924,8 +924,10 @@ public:
}
}
} else {
if(item->get_production()->left != pool->getStartSymbol()->index) {
this->add_action(ic->getIndex(), next_symbol, STATUTE, item->get_production());
if(pool->getSymbol(next_symbol)->terminator) {
if (item->get_production()->left != pool->getStartSymbol()->index) {
this->add_action(ic->getIndex(), item->get_terminator(), STATUTE, item->get_production());
}
}
}
}