mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
LR0: Converted ::getExpected from std::vector to std::set
This commit is contained in:
parent
1305c0cb55
commit
31b53e8c23
2 changed files with 6 additions and 6 deletions
|
@ -116,13 +116,12 @@ LR0::Closure LR0::getClosure (const Closure& items)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Collect a unique set of expected symbols from the closure.
|
||||
std::vector <std::string> LR0::getExpected (const Closure& closure)
|
||||
std::set <std::string> LR0::getExpected (const Closure& closure)
|
||||
{
|
||||
std::vector <std::string> expected;
|
||||
std::set <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 ());
|
||||
if (! item.done ())
|
||||
expected.insert (item.next ());
|
||||
|
||||
return expected;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define INCLUDED_LR0
|
||||
|
||||
#include <Grammar.h>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
|
||||
private:
|
||||
Closure getClosure (const Closure&);
|
||||
std::vector <std::string> getExpected (const Closure&);
|
||||
std::set <std::string> getExpected (const Closure&);
|
||||
|
||||
private:
|
||||
// Copy of the augmented grammar.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue