PorygonLang/src/Script.hpp

47 lines
1.0 KiB
C++

#ifndef PORYGONLANG_SCRIPT_HPP
#define PORYGONLANG_SCRIPT_HPP
#include <utility>
#include <string>
#include <unordered_map>
#include "Diagnostics/DiagnosticsHolder.hpp"
#include "Binder/BoundStatements/BoundStatement.hpp"
class Script;
class Evaluator;
#include "Evaluator/Evaluator.hpp"
#include "Evaluator/EvalValues/EvalValue.hpp"
#include "Utilities/HashedString.hpp"
using namespace std;
class Script {
friend class Evaluator;
Evaluator* _evaluator;
unordered_map<int, shared_ptr<EvalValue>>* _scriptVariables;
BoundScriptStatement* _boundScript;
explicit Script();
void Parse(string script);
public:
static Script* Create(string script);
DiagnosticsHolder* Diagnostics;
~Script();
void Evaluate();
EvalValue* GetLastValue();
EvalValue* GetVariable(const string& key);
bool HasVariable(const string& key);
EvalValue* CallFunction(const string& key, vector<EvalValue*> variables);
bool HasFunction(const string& key);
};
#endif //PORYGONLANG_SCRIPT_HPP