From bed46a062c442656b1bc16d965e12405297029d3 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 31 Mar 2020 12:19:09 +0200 Subject: Remove redundant code --- cppbnf.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'cppbnf.cpp') diff --git a/cppbnf.cpp b/cppbnf.cpp index 4f0b758..d5ffa12 100644 --- a/cppbnf.cpp +++ b/cppbnf.cpp @@ -21,30 +21,12 @@ namespace { return result; } - std::unordered_map> reverseBNF(const BNF& bnf) - { - std::unordered_map> result; - for (const auto& [symbol, lists] : bnf) { - for (const auto& list : lists) { - for (const auto& i : list) { - auto it = result.find(i); - if (it == result.end()) - result.emplace(i, std::unordered_set{symbol}); - else - it->second.insert(symbol); - } - } - } - - return result; - } - size_t numberOfStartSymbols(const BNF& bnf) { // exactly 1 start symbol std::vector startSymbols; - auto reverse{ reverseBNF(bnf) }; + auto reverse{ Reverse(bnf) }; for (const auto& [symbol, lists] : bnf) { if (reverse.find(symbol) == reverse.end()) -- cgit v1.2.3