Remove a parameter from the setOutputFileContent function and remove a variable in the main function.
This commit is contained in:
parent
c22e59bd62
commit
85c155fc3b
|
@ -17,7 +17,7 @@ string getFileContent(const string& file)
|
||||||
return fullinput;
|
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);
|
static ofstream outputFile (file, ofstream::out);
|
||||||
outputFile << content;
|
outputFile << content;
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
consteval const char* getVersion() noexcept { return YBCON_VERSION; }
|
consteval const char* getVersion() noexcept { return YBCON_VERSION; }
|
||||||
|
|
||||||
string getFileContent(const string& file);
|
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"
|
#include "src/headers/parsing/ParseComponents.hpp"
|
||||||
ParseTree parseString(const string& toParse);
|
ParseTree parseString(const string& toParse);
|
||||||
|
|
|
@ -17,10 +17,9 @@ int main(int argc, char* argv[]) {
|
||||||
if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true;
|
if ((currentArg == "--printresult") || (currentArg == "-p")) printResult = true;
|
||||||
else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9);
|
else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9);
|
||||||
}
|
}
|
||||||
const auto parsedTree = parseString(getFileContent(fileName));
|
const string transpiledString = transpile(parseString(getFileContent(fileName)), target);
|
||||||
const string transpiledString = transpile(parsedTree, target);
|
|
||||||
if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n";
|
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";
|
else cout << "No valid file provided.\n";
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue