From e0d6dac4b103a557b37f4850fe76dacf87df7cb9 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 1 Nov 2020 16:26:22 +0100 Subject: Update cppbnf.cpp --- cpp.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'cpp.cpp') diff --git a/cpp.cpp b/cpp.cpp index 563ba4c..21f4df1 100644 --- a/cpp.cpp +++ b/cpp.cpp @@ -20,16 +20,7 @@ using namespace Gram; namespace fs = std::filesystem; -CPP::CPP(): map_translation_unit ({ - {"/translation-unit/top-level-declaration-seq/top-level-declaration/declaration/function-definition", - [&](fs::path& path, index_t node_id) - { - //std::cout << "DEBUG: " << path << ", " << node_id << ", " << valueOfNode(node_id, m_nodes) << ", " << m_nodes[node_id].node_id << ", " << m_nodes[node_id].pos.node_id << std::endl; - } - }, -}) -{ -} +CPP::CPP(){} CPP::~CPP(){} @@ -245,7 +236,8 @@ std::vector CPP::analysis(const std::vector& tokens) return compiler.compile(tokens); } -void CPP::traverse(index_t node_id, map_type& map, fs::path parent_path) +#if 0 +void CPP::traverse(index_t node_id) { fs::path current_path{parent_path / m_nodes[node_id].type}; @@ -262,6 +254,11 @@ void CPP::traverse(index_t node_id, map_type& map, fs::path parent_path) } } } +#endif + +void CPP::trTranslationUnit(index_t node_id) +{ +} // Phase 7.c: Translate void CPP::translate() @@ -269,7 +266,7 @@ void CPP::translate() if (m_nodes.size() == 0) throw std::runtime_error("ICE: Tree is empty"); - traverse(0, map_translation_unit); + trTranslationUnit(0); } // Phase 8: Instantiate objects -- cgit v1.2.3