mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Added ::getExpectations
This commit is contained in:
parent
9327ff7c8b
commit
679f094f16
1 changed files with 5 additions and 0 deletions
|
@ -105,9 +105,14 @@ LR0::Closure LR0::getClosure (const Closure& items)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Collect a unique set of expected symbols from the closure.
|
||||||
std::vector <std::string> LR0::getExpectations (const Closure& closure)
|
std::vector <std::string> LR0::getExpectations (const Closure& closure)
|
||||||
{
|
{
|
||||||
std::vector <std::string> expected;
|
std::vector <std::string> 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;
|
return expected;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue