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)
|
||||
results.insert (rule.first);
|
||||
results.push_back (rule.first);
|
||||
|
||||
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& production : rule.second)
|
||||
for (auto& token : production)
|
||||
if (_rules.find (token._token) == _rules.end ())
|
||||
results.insert (token._token);
|
||||
results.push_back (token._token);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue