diff options
| author | Roland Reichwein <mail@reichwein.it> | 2020-10-26 15:38:54 +0100 | 
|---|---|---|
| committer | Roland Reichwein <mail@reichwein.it> | 2020-10-26 15:38:54 +0100 | 
| commit | ce77838c4f32b9dc237f0c4b17d1f1e1741254d4 (patch) | |
| tree | f8b987e81bd94bff0a4035ddfe75d344664ece10 /cpp.cpp | |
| parent | addbdf3cf71c6d332bdf86a101a7df544fe5a9a2 (diff) | |
Added ProgramOpts
Diffstat (limited to 'cpp.cpp')
| -rw-r--r-- | cpp.cpp | 23 | 
1 files changed, 19 insertions, 4 deletions
@@ -13,9 +13,12 @@  #include <functional>  #include <unordered_set>  #include <unordered_map> +#include <filesystem>  using namespace Gram; +namespace fs = std::filesystem; +  CPP::CPP(){}  CPP::~CPP(){} @@ -227,15 +230,27 @@ std::vector<Gram::TreeNode> CPP::analysis(const std::vector<Token>& tokens)  namespace {   CPP::map_type map_translation_unit { -  //{"top-level-declaration-seq", [](){}}, -  {"top-level-declaration-seq/top-level-declaration/declaration/function-definition", [](){}}, +  {"/translation-unit/top-level-declaration-seq/top-level-declaration/declaration/function-definition", [](){}},   };  } // anonymous namespace -void CPP::traverse(index_t node_id, map_type& map) +void CPP::traverse(index_t node_id, map_type& map, fs::path parent_path)  { - // TODO + fs::path current_path{parent_path / m_nodes[node_id].type}; +  + // execute callbacks + auto it{map.find(current_path.generic_string())}; + if (it != map.end()) { +  std::cout << "DEBUG: Found " << current_path << std::endl; + } + + // recurse tree + for (const auto& child_id: m_nodes[node_id].child_ids) { +  if (ChildIdIsNode(child_id)) { +   traverse(child_id, map, current_path); +  } + }  }  // Phase 7.c: Translate  | 
