summaryrefslogtreecommitdiffhomepage
path: root/grammer.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-03-14 17:10:23 +0100
committerRoland Reichwein <mail@reichwein.it>2020-03-14 17:10:23 +0100
commit3a7006fcf5f8ecffd852fbba6d8ee03ce8a35dce (patch)
tree5bec440600e9de3b367d41345089e544a8fa791c /grammer.cpp
parent15a56fcb5f29b8507298144a835a819de652e788 (diff)
Remove dfa again
Diffstat (limited to 'grammer.cpp')
-rw-r--r--grammer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/grammer.cpp b/grammer.cpp
index be01adc..2379e9a 100644
--- a/grammer.cpp
+++ b/grammer.cpp
@@ -365,9 +365,9 @@ void Compiler::TrackBack()
// breadth-first search
// return: node, child
-std::map<std::string, std::string> Compiler::traverse(const std::string& lower, const std::string& upper)
+std::unordered_map<std::string, std::string> Compiler::traverse(const std::string& lower, const std::string& upper)
{
- std::map<std::string, std::string> visited; // node, child
+ std::unordered_map<std::string, std::string> visited; // node, child
std::deque<std::pair<std::string, std::string>> todo{{lower, ""}}; // node, child
while (!todo.empty()) {
@@ -401,7 +401,7 @@ std::vector<std::string> Compiler::GetPath(std::string upper, std::string lower)
std::vector<std::string> result;
// traverse bnf from lower to upper
- std::map<std::string, std::string> visited {traverse(lower, upper)};
+ std::unordered_map<std::string, std::string> visited {traverse(lower, upper)};
auto current {upper};
while (current != lower) {