Use a reference as the parseString function's parameter instead of a unuseful pointer.
This commit is contained in:
parent
a4e42f752f
commit
9869f73e35
@ -1,7 +1,6 @@
|
||||
#ifndef YERBACON_LEX_H
|
||||
#define YERBACON_LEX_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
@ -11,7 +11,7 @@ string getFileContent(const string& file);
|
||||
void setOutputFileContent(const string& language, const string& file, const string& content);
|
||||
|
||||
#include "src/headers/parsing/ParseComponents.hpp"
|
||||
ParseTree parseString(const unique_ptr<string>& toParse);
|
||||
ParseTree parseString(const string& toParse);
|
||||
string transpile(ParseTree toTranspile, string language);
|
||||
|
||||
#endif //YERBACON_MISC_HPP
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
using namespace std;
|
||||
|
||||
#include "headers/misc.hpp"
|
||||
@ -18,7 +17,7 @@ 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(make_unique<string>(getFileContent(fileName)));
|
||||
const auto parsedTree = parseString(getFileContent(fileName));
|
||||
const string transpiledString = transpile(parsedTree, target);
|
||||
if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n";
|
||||
setOutputFileContent(target, fileName.erase(fileName.find(".ybcon")) + target, transpiledString);
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
ParseTree parseString(const unique_ptr<string>& toParse) {
|
||||
ParseTree parseString(const string& toParse) {
|
||||
ParseTree parseTree = ParseTree();
|
||||
auto lexed = lex(*toParse);
|
||||
auto lexed = lex(toParse);
|
||||
for (const tok& token: lexed) {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user