diff --git a/src/etc/filefuncs.cpp b/src/etc/filefuncs.cpp index 702221e..2457a7b 100644 --- a/src/etc/filefuncs.cpp +++ b/src/etc/filefuncs.cpp @@ -17,7 +17,7 @@ string getFileContent(const string& file) return fullinput; } -void setOutputFileContent(const string& language, const string& file, const string& content) { +void setOutputFileContent(const string& file, string_view content) { static ofstream outputFile (file, ofstream::out); outputFile << content; } \ No newline at end of file diff --git a/src/headers/misc.hpp b/src/headers/misc.hpp index de054d4..fb5d1d9 100644 --- a/src/headers/misc.hpp +++ b/src/headers/misc.hpp @@ -8,7 +8,7 @@ consteval const char* getVersion() noexcept { return YBCON_VERSION; } string getFileContent(const string& file); -void setOutputFileContent(const string& language, const string& file, const string& content); +void setOutputFileContent(const string& file, string_view content); #include "src/headers/parsing/ParseComponents.hpp" ParseTree parseString(const string& toParse); diff --git a/src/main.cpp b/src/main.cpp index ec98688..77572d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,10 +17,9 @@ int main(int argc, char* argv[]) { if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true; else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9); } - const auto parsedTree = parseString(getFileContent(fileName)); - const string transpiledString = transpile(parsedTree, target); + const string transpiledString = transpile(parseString(getFileContent(fileName)), target); if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n"; - setOutputFileContent(target, fileName.erase(fileName.find(".ybcon")) + target, transpiledString); + setOutputFileContent(fileName.erase(fileName.find(".ybcon")) + target, transpiledString); } else cout << "No valid file provided.\n"; return EXIT_SUCCESS;