PorygonLang/src/Script.cpp

24 lines
494 B
C++
Raw Normal View History

2019-05-21 10:59:15 +00:00
#include <utility>
#include "Script.hpp"
2019-05-21 11:56:08 +00:00
#include "Parser/Lexer.hpp"
#include "Parser/Parser.hpp"
2019-05-21 10:59:15 +00:00
Script Script::Create(string script) {
auto s = Script();
s.Parse(std::move(script));
return s;
}
void Script::Parse(string script) {
2019-05-21 11:56:08 +00:00
auto lexer = Lexer(std::move(script), this);
2019-05-21 10:59:15 +00:00
auto lexResult = lexer.Lex();
auto parser = Parser(lexResult);
auto parseResult = parser.Parse();
for (auto token : lexResult){
delete token;
}
lexResult.clear();
}