mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Grammar: Converted from std::set to std::vector to preserve ordering
This commit is contained in:
parent
9b126699e7
commit
c73464b39f
2 changed files with 8 additions and 9 deletions
|
@ -144,24 +144,24 @@ std::string Grammar::start () const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::set <std::string> Grammar::rules () const
|
std::vector <std::string> Grammar::rules () const
|
||||||
{
|
{
|
||||||
std::set <std::string> results;
|
std::vector <std::string> results;
|
||||||
for (auto& rule : _rules)
|
for (auto& rule : _rules)
|
||||||
results.insert (rule.first);
|
results.push_back (rule.first);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::set <std::string> Grammar::terminals () const
|
std::vector <std::string> Grammar::terminals () const
|
||||||
{
|
{
|
||||||
std::set <std::string> results;
|
std::vector <std::string> results;
|
||||||
for (auto& rule : _rules)
|
for (auto& rule : _rules)
|
||||||
for (auto& production : rule.second)
|
for (auto& production : rule.second)
|
||||||
for (auto& token : production)
|
for (auto& token : production)
|
||||||
if (_rules.find (token._token) == _rules.end ())
|
if (_rules.find (token._token) == _rules.end ())
|
||||||
results.insert (token._token);
|
results.push_back (token._token);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -40,8 +39,8 @@ public:
|
||||||
void loadFromFile (File&);
|
void loadFromFile (File&);
|
||||||
void loadFromString (const std::string&);
|
void loadFromString (const std::string&);
|
||||||
std::string start () const;
|
std::string start () const;
|
||||||
std::set <std::string> rules () const;
|
std::vector <std::string> rules () const;
|
||||||
std::set <std::string> terminals () const;
|
std::vector <std::string> terminals () const;
|
||||||
std::string dump () const;
|
std::string dump () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue