#include #ifndef PORYGONLANG_SCRIPT_HPP #define PORYGONLANG_SCRIPT_HPP #include #include #include #include "Diagnostics/DiagnosticsHolder.hpp" #include "Binder/BoundStatements/BoundStatement.hpp" #include "Evaluator/Evaluator.hpp" #include "Evaluator/EvalValues/EvalValue.hpp" #include "Utilities/HashedString.hpp" using namespace std; using namespace Porygon::Evaluation; namespace Porygon{ class Script { Evaluator* _evaluator; map>* _scriptVariables; shared_ptr _boundScript; shared_ptr _returnType; explicit Script(const u16string&); Script(shared_ptr boundScript, shared_ptr diagnostics); void Parse(const u16string& script); public: shared_ptr Diagnostics; static Script* Create(const u16string& script); static Script* Create(const string& script); static Script* Clone(const Script* script); ~Script(); shared_ptr GetReturnType(){ return _returnType; } void SetReturnType(shared_ptr t){ _returnType = std::move(t); } EvalValue* Evaluate(); EvalValue* GetLastValue(); EvalValue* GetVariable(const u16string& key); bool HasVariable(const u16string& key); shared_ptr CallFunction(const u16string& key, const vector& variables); bool HasFunction(const u16string& key); }; } #endif //PORYGONLANG_SCRIPT_HPP