// // Created by username404 on 09/01/2021. // #include using namespace std; enum LANGUAGE: unsigned short {LUA=2,JS=3,PY=4}; pair validLanguage(const string& it) { const string languages[3] = {".lua", ".js", ".py"}; LANGUAGE selected = LUA; bool valid = false; for (unsigned short i = 0; (i < languages->size()); i++) { if (it == languages[i]) { selected = static_cast(i + 2); valid = true; break; } } return pair(selected, valid); } #include "src/headers/parsing/ParseComponents.hpp" string transpile(ParseTree tree, string language) { string transpiled; auto valided = validLanguage(language); if (valided.second) { switch (valided.first) { // TODO Complete this part case LUA: break; case JS: break; case PY: break; } // TODO Actually transpile } else { cout << '"' << (char) toupper(language.at(1)) << language.erase(0, 2) << "\" is not a valid target."; exit(1); } return transpiled; }