diff options
| -rw-r--r-- | cppbnf.cpp | 20 | 
1 files changed, 1 insertions, 19 deletions
| @@ -21,30 +21,12 @@ namespace {    return result;   } - std::unordered_map<std::string, std::unordered_set<std::string>> reverseBNF(const BNF& bnf) - { -  std::unordered_map<std::string, std::unordered_set<std::string>> 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<std::string>{symbol}); -     else -      it->second.insert(symbol); -    } -   } -  } - -  return result; - } -   size_t numberOfStartSymbols(const BNF& bnf)   {    // exactly 1 start symbol    std::vector<std::string> startSymbols; -  auto reverse{ reverseBNF(bnf) }; +  auto reverse{ Reverse(bnf) };    for (const auto& [symbol, lists] : bnf) {     if (reverse.find(symbol) == reverse.end()) | 
