diff --git a/src/LR0.cpp b/src/LR0.cpp index 59c35017..7a8e7252 100644 --- a/src/LR0.cpp +++ b/src/LR0.cpp @@ -105,9 +105,14 @@ LR0::Closure LR0::getClosure (const Closure& items) } //////////////////////////////////////////////////////////////////////////////// +// Collect a unique set of expected symbols from the closure. std::vector LR0::getExpectations (const Closure& closure) { std::vector expected; + for (auto& item : closure) + if (! item.done () && + std::find (expected.begin (), expected.end (), item.next ()) == expected.end ()) + expected.push_back (item.next ()); return expected; }