LR0: Added ::getExpected to ::closure

This commit is contained in:
Paul Beckingham 2016-01-02 14:27:00 -05:00
parent 679f094f16
commit f658c5d35c

View file

@ -97,10 +97,20 @@ void LR0::initialize (const Grammar& grammar)
LR0::Closure LR0::getClosure (const Closure& items)
{
LR0::Closure closure;
for (auto & item : items)
for (auto& item : items)
{
// closure(I) includes I.
closure.push_back (item);
// Obtain all the expected symbols.
auto expected = getExpectations (items);
for (auto& exp : expected)
{
std::cout << "# Expecting " << exp << "\n";
std::cout << "# Add expansion of " << exp << "\n";
}
}
return closure;
}