#include #ifndef PORYGONLANG_SCRIPTTYPE_HPP #define PORYGONLANG_SCRIPTTYPE_HPP #include #include #include #include "Binder/BoundVariables/BoundVariableKey.hpp" enum class TypeClass{ Error, Nil, Number, Bool, String, Function, UserData, Table, }; class ScriptType{ TypeClass _class; public: explicit ScriptType(TypeClass c){ _class = c; } virtual ~ScriptType() = default; const TypeClass GetClass(){ return _class; } virtual bool operator ==(ScriptType b){ return _class == b._class; }; virtual bool operator !=(ScriptType b){ return ! (operator==(b)); } }; class NumericScriptType : public ScriptType{ // Are we aware of whether this is a float or not? bool _awareOfFloat; // Is this value a float? bool _isFloat; public: explicit NumericScriptType(bool floatAware, bool isFloat) : ScriptType(TypeClass::Number){ _awareOfFloat = floatAware; _isFloat = isFloat; } bool IsAwareOfFloat(){ return _awareOfFloat; } bool IsFloat(){ return _isFloat; } }; class FunctionScriptType : public ScriptType{ std::shared_ptr _returnType; std::vector> _parameterTypes; std::vector> _parameterKeys; public: FunctionScriptType(std::shared_ptr returnType, std::vector> parameterTypes, std::vector> parameterKeys) : ScriptType(TypeClass::Function){ _returnType = std::move(returnType); _parameterTypes = std::move(parameterTypes); _parameterKeys = std::move(parameterKeys); } ScriptType* GetReturnType(){ return _returnType.get(); } std::vector> GetParameterTypes(){ return _parameterTypes; } std::vector> GetParameterKeys(){ return _parameterKeys; } }; #endif //PORYGONLANG_SCRIPTTYPE_HPP