// // 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) { string languages[3] = {".lua", ".js", ".py"}; LANGUAGE selected; bool valid = false; for (unsigned short i = 0; (i < languages->size()); i++) { if (it == languages[i]) { selected = static_cast(i + 2); valid = true; break; } } pair result { selected, valid }; return result; } string transpile(string toTranspile, string language) { 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 toTranspile; }