From 79fbc8bf495770e4a8b7c66c46acf07f4e47e568 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 30 Mar 2020 18:33:01 +0200 Subject: Speed up compile --- cpp.h | 58 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'cpp.h') diff --git a/cpp.h b/cpp.h index 571182a..dfe09ca 100644 --- a/cpp.h +++ b/cpp.h @@ -9,31 +9,37 @@ class CPP { public: -CPP(); -~CPP(); - -std::string valueOfNode(index_t node_index, const std::vector& Tree); - -// phases of translation, according to standard -void source_charset_map(); // phase 1 -void backslash_escape(); // phase 2 -std::vector preprocessing_tokenize(const std::string& s); // phase 3 -void preprocess(); // phase 4 -void execution_charset_map(); // phase 5 -void concatenate_strings(); // phase 6 -std::vector tokens_from_pptokens(const std::vector& pp_tokens); // phase 7.a -std::vector analysis(const std::vector&); // phase 7.b -void translate(const std::vector& tree); // phase 7.c -void instantiate(); // phase 8 -void link(); // phase 9 - -// all phases of translation -void compile(const std::string& code); - -std::vector getCode(); -std::vector getData(); - + CPP(); + ~CPP(); + + std::string valueOfNode(index_t node_index, const std::vector& Tree); + + // phases of translation, according to standard + void source_charset_map(); // phase 1 + void backslash_escape(); // phase 2 + std::vector preprocessing_tokenize(const std::string& s); // phase 3 + void preprocess(); // phase 4 + void execution_charset_map(); // phase 5 + void concatenate_strings(); // phase 6 + std::vector tokens_from_pptokens(const std::vector& pp_tokens); // phase 7.a + std::vector analysis(const std::vector&); // phase 7.b + void translate(); // phase 7.c + void instantiate(); // phase 8 + void link(); // phase 9 + + // all phases of translation + void compile(const std::string& code); + + std::vector getCode(); + std::vector getData(); + + typedef std::unordered_map> map_type; + private: - std::string m_code; - std::vector m_charTokens; + std::string m_code; // input / start + std::vector m_charTokens; // result of phase 3 + std::vector m_nodes; // result of phase 7.b + + void traverse(index_t node_id, map_type& map); }; + -- cgit v1.2.3