diff --git a/include/zhivo/ast/ASTNode.hpp b/include/zhivo/ast/ASTNode.hpp index 0c0d5df..5a64d0f 100644 --- a/include/zhivo/ast/ASTNode.hpp +++ b/include/zhivo/ast/ASTNode.hpp @@ -25,7 +25,7 @@ class ASTNode { protected: - std::unique_ptr address = nullptr; + std::shared_ptr address = nullptr; public: ASTNode() : address(nullptr) {} diff --git a/include/zhivo/ast/ASTNodeException.hpp b/include/zhivo/ast/ASTNodeException.hpp index 648136e..d0b7136 100644 --- a/include/zhivo/ast/ASTNodeException.hpp +++ b/include/zhivo/ast/ASTNodeException.hpp @@ -26,11 +26,11 @@ class ASTNodeException final : public std::runtime_error { private: - std::unique_ptr address; + std::shared_ptr address; public: explicit ASTNodeException( - std::unique_ptr _address, + std::shared_ptr _address, const std::string& message) : std::runtime_error(message), address(std::move(_address)) {} diff --git a/include/zhivo/ast/TerminativeSignal.hpp b/include/zhivo/ast/TerminativeSignal.hpp index e0752cd..e5c5097 100644 --- a/include/zhivo/ast/TerminativeSignal.hpp +++ b/include/zhivo/ast/TerminativeSignal.hpp @@ -59,11 +59,11 @@ class TerminativeReturnSignal : public std::exception { class TerminativeThrowSignal : public std::exception { private: - std::unique_ptr address; + std::shared_ptr address; DynamicObject value; public: - TerminativeThrowSignal(std::unique_ptr _address, DynamicObject _value) : + TerminativeThrowSignal(std::shared_ptr _address, DynamicObject _value) : address(std::move(_address)), value(std::move(_value)) {} diff --git a/include/zhivo/ast/expression/ArrayAccessExpression.hpp b/include/zhivo/ast/expression/ArrayAccessExpression.hpp index 011b776..de6133a 100644 --- a/include/zhivo/ast/expression/ArrayAccessExpression.hpp +++ b/include/zhivo/ast/expression/ArrayAccessExpression.hpp @@ -27,14 +27,14 @@ class ArrayAccessExpression final : public ASTNode { private: - std::unique_ptr array; - std::unique_ptr index; + std::shared_ptr array; + std::shared_ptr index; public: explicit ArrayAccessExpression( - std::unique_ptr _address, - std::unique_ptr _array, - std::unique_ptr _index + std::shared_ptr _address, + std::shared_ptr _array, + std::shared_ptr _index ) : array(std::move(_array)), index(std::move(_index)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/ArrayExpression.hpp b/include/zhivo/ast/expression/ArrayExpression.hpp index f8ec015..85b0e56 100644 --- a/include/zhivo/ast/expression/ArrayExpression.hpp +++ b/include/zhivo/ast/expression/ArrayExpression.hpp @@ -27,12 +27,12 @@ class ArrayExpression final : public ASTNode { private: - std::vector> elements; + std::vector> elements; public: explicit ArrayExpression( - std::unique_ptr _address, - std::vector> _elements + std::shared_ptr _address, + std::vector> _elements ) : elements(std::move(_elements)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/BinaryExpression.hpp b/include/zhivo/ast/expression/BinaryExpression.hpp index 1eceb0f..64bdb1d 100644 --- a/include/zhivo/ast/expression/BinaryExpression.hpp +++ b/include/zhivo/ast/expression/BinaryExpression.hpp @@ -27,8 +27,8 @@ class BinaryExpression final : public ASTNode { private: - std::unique_ptr left; - std::unique_ptr right; + std::shared_ptr left; + std::shared_ptr right; std::string op; DynamicObject applyStringOp(DynamicObject& lValue, DynamicObject& rValue); @@ -39,10 +39,10 @@ class BinaryExpression final : public ASTNode { public: explicit BinaryExpression( - std::unique_ptr _address, - std::unique_ptr _left, + std::shared_ptr _address, + std::shared_ptr _left, std::string _op, - std::unique_ptr _right + std::shared_ptr _right ) : left(std::move(_left)), right(std::move(_right)), op(_op) { diff --git a/include/zhivo/ast/expression/BlockExpression.hpp b/include/zhivo/ast/expression/BlockExpression.hpp index 5dbd044..17f53e2 100644 --- a/include/zhivo/ast/expression/BlockExpression.hpp +++ b/include/zhivo/ast/expression/BlockExpression.hpp @@ -27,12 +27,12 @@ class BlockExpression final : public ASTNode { private: - std::vector> statements; + std::vector> statements; public: explicit BlockExpression( - std::unique_ptr _address, - std::vector> _statements + std::shared_ptr _address, + std::vector> _statements ) : statements(std::move(_statements)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/BooleanLiteralExpression.hpp b/include/zhivo/ast/expression/BooleanLiteralExpression.hpp index bd8366a..83bc1c9 100644 --- a/include/zhivo/ast/expression/BooleanLiteralExpression.hpp +++ b/include/zhivo/ast/expression/BooleanLiteralExpression.hpp @@ -29,7 +29,7 @@ class BooleanLiteralExpression final : public ASTNode { public: explicit BooleanLiteralExpression( - std::unique_ptr _address, + std::shared_ptr _address, bool _value ) : value(_value) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/CatchHandleExpression.hpp b/include/zhivo/ast/expression/CatchHandleExpression.hpp index d9ccbcf..7695277 100644 --- a/include/zhivo/ast/expression/CatchHandleExpression.hpp +++ b/include/zhivo/ast/expression/CatchHandleExpression.hpp @@ -28,18 +28,18 @@ class CatchHandleExpression final : public ASTNode { private: - std::unique_ptr catchBlock; - std::unique_ptr handleBlock; - std::unique_ptr handler; - std::unique_ptr finalBlock; + std::shared_ptr catchBlock; + std::shared_ptr handleBlock; + std::shared_ptr handler; + std::shared_ptr finalBlock; public: explicit CatchHandleExpression( - std::unique_ptr _address, - std::unique_ptr _catchBlock, - std::unique_ptr _handleBlock, - std::unique_ptr _handler, - std::unique_ptr _finalBlock + std::shared_ptr _address, + std::shared_ptr _catchBlock, + std::shared_ptr _handleBlock, + std::shared_ptr _handler, + std::shared_ptr _finalBlock ) : catchBlock(std::move(_catchBlock)), handleBlock(std::move(_handleBlock)), handler(std::move(_handler)), diff --git a/include/zhivo/ast/expression/FunctionCallExpression.hpp b/include/zhivo/ast/expression/FunctionCallExpression.hpp index 97dbf07..dcc6905 100644 --- a/include/zhivo/ast/expression/FunctionCallExpression.hpp +++ b/include/zhivo/ast/expression/FunctionCallExpression.hpp @@ -30,14 +30,14 @@ class FunctionCallExpression final : public ASTNode { private: - std::unique_ptr callable; - std::vector> arguments; + std::shared_ptr callable; + std::vector> arguments; public: explicit FunctionCallExpression( - std::unique_ptr _address, - std::unique_ptr _callable, - std::vector> _arguments + std::shared_ptr _address, + std::shared_ptr _callable, + std::vector> _arguments ) : callable(std::move(_callable)), arguments(std::move(_arguments)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/FunctionDeclarationExpression.hpp b/include/zhivo/ast/expression/FunctionDeclarationExpression.hpp index 7783053..da7cd1a 100644 --- a/include/zhivo/ast/expression/FunctionDeclarationExpression.hpp +++ b/include/zhivo/ast/expression/FunctionDeclarationExpression.hpp @@ -29,14 +29,14 @@ class FunctionDeclarationExpression final : public ASTNode { private: - std::vector> parameters; - std::unique_ptr body; + std::vector> parameters; + std::shared_ptr body; public: explicit FunctionDeclarationExpression( - std::unique_ptr _address, - std::vector> _parameters, - std::unique_ptr _body + std::shared_ptr _address, + std::vector> _parameters, + std::shared_ptr _body ) : parameters(std::move(_parameters)), body(std::move(_body)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/GroupedExpression.hpp b/include/zhivo/ast/expression/GroupedExpression.hpp index ada1cd1..8039013 100644 --- a/include/zhivo/ast/expression/GroupedExpression.hpp +++ b/include/zhivo/ast/expression/GroupedExpression.hpp @@ -25,12 +25,12 @@ class GroupedExpression final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit GroupedExpression( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/IfElseExpression.hpp b/include/zhivo/ast/expression/IfElseExpression.hpp index 155985a..b513926 100644 --- a/include/zhivo/ast/expression/IfElseExpression.hpp +++ b/include/zhivo/ast/expression/IfElseExpression.hpp @@ -25,16 +25,16 @@ class IfElseExpression final : public ASTNode { private: - std::unique_ptr condition; - std::unique_ptr thenBranch; - std::unique_ptr elseBranch; + std::shared_ptr condition; + std::shared_ptr thenBranch; + std::shared_ptr elseBranch; public: explicit IfElseExpression( - std::unique_ptr _address, - std::unique_ptr _condition, - std::unique_ptr _thenBranch, - std::unique_ptr _elseBranch + std::shared_ptr _address, + std::shared_ptr _condition, + std::shared_ptr _thenBranch, + std::shared_ptr _elseBranch ) : condition(std::move(_condition)), thenBranch(std::move(_thenBranch)), elseBranch(std::move(_elseBranch)) { diff --git a/include/zhivo/ast/expression/LoopExpression.hpp b/include/zhivo/ast/expression/LoopExpression.hpp index 8e4a947..7a5234f 100644 --- a/include/zhivo/ast/expression/LoopExpression.hpp +++ b/include/zhivo/ast/expression/LoopExpression.hpp @@ -27,18 +27,18 @@ class LoopExpression final : public ASTNode { private: - std::unique_ptr initial; - std::unique_ptr condition; - std::unique_ptr postexpr; - std::unique_ptr body; + std::shared_ptr initial; + std::shared_ptr condition; + std::shared_ptr postexpr; + std::shared_ptr body; public: explicit LoopExpression( - std::unique_ptr _address, - std::unique_ptr _initial, - std::unique_ptr _condition, - std::unique_ptr _postexpr, - std::unique_ptr _body + std::shared_ptr _address, + std::shared_ptr _initial, + std::shared_ptr _condition, + std::shared_ptr _postexpr, + std::shared_ptr _body ) : initial(std::move(_initial)), condition(std::move(_condition)), postexpr(std::move(_postexpr)), diff --git a/include/zhivo/ast/expression/MaybeExpression.hpp b/include/zhivo/ast/expression/MaybeExpression.hpp index 46bd7b1..16de397 100644 --- a/include/zhivo/ast/expression/MaybeExpression.hpp +++ b/include/zhivo/ast/expression/MaybeExpression.hpp @@ -26,7 +26,7 @@ class MaybeExpression final : public ASTNode { public: - explicit MaybeExpression(std::unique_ptr _address) { + explicit MaybeExpression(std::shared_ptr _address) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/NilCoalescingExpression.hpp b/include/zhivo/ast/expression/NilCoalescingExpression.hpp index 7f54821..0300581 100644 --- a/include/zhivo/ast/expression/NilCoalescingExpression.hpp +++ b/include/zhivo/ast/expression/NilCoalescingExpression.hpp @@ -24,14 +24,14 @@ class NilCoalescingExpression final : public ASTNode { private: - std::unique_ptr left; - std::unique_ptr right; + std::shared_ptr left; + std::shared_ptr right; public: explicit NilCoalescingExpression( - std::unique_ptr _address, - std::unique_ptr _left, - std::unique_ptr _right + std::shared_ptr _address, + std::shared_ptr _left, + std::shared_ptr _right ) : left(std::move(_left)), right(std::move(_right)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/NilLiteralExpression.hpp b/include/zhivo/ast/expression/NilLiteralExpression.hpp index 656ad95..c2a0847 100644 --- a/include/zhivo/ast/expression/NilLiteralExpression.hpp +++ b/include/zhivo/ast/expression/NilLiteralExpression.hpp @@ -25,7 +25,7 @@ class NilLiteralExpression final : public ASTNode { public: - explicit NilLiteralExpression(std::unique_ptr _address) { + explicit NilLiteralExpression(std::shared_ptr _address) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/NumberLiteralExpression.hpp b/include/zhivo/ast/expression/NumberLiteralExpression.hpp index 868a0c5..68ea34c 100644 --- a/include/zhivo/ast/expression/NumberLiteralExpression.hpp +++ b/include/zhivo/ast/expression/NumberLiteralExpression.hpp @@ -29,7 +29,7 @@ class NumberLiteralExpression final : public ASTNode { public: explicit NumberLiteralExpression( - std::unique_ptr _address, + std::shared_ptr _address, double _value ) : value(_value) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/ParallelExpression.hpp b/include/zhivo/ast/expression/ParallelExpression.hpp index 3a028c7..70be200 100644 --- a/include/zhivo/ast/expression/ParallelExpression.hpp +++ b/include/zhivo/ast/expression/ParallelExpression.hpp @@ -25,12 +25,12 @@ class ParallelExpression final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit ParallelExpression( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/RandomExpression.hpp b/include/zhivo/ast/expression/RandomExpression.hpp index 40de140..ebc3a23 100644 --- a/include/zhivo/ast/expression/RandomExpression.hpp +++ b/include/zhivo/ast/expression/RandomExpression.hpp @@ -25,14 +25,14 @@ class RandomExpression final : public ASTNode { private: - std::unique_ptr thenBranch; - std::unique_ptr elseBranch; + std::shared_ptr thenBranch; + std::shared_ptr elseBranch; public: explicit RandomExpression( - std::unique_ptr _address, - std::unique_ptr _thenBranch, - std::unique_ptr _elseBranch + std::shared_ptr _address, + std::shared_ptr _thenBranch, + std::shared_ptr _elseBranch ) : thenBranch(std::move(_thenBranch)), elseBranch(std::move(_elseBranch)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/RegexExpression.hpp b/include/zhivo/ast/expression/RegexExpression.hpp index f84ab70..28bae40 100644 --- a/include/zhivo/ast/expression/RegexExpression.hpp +++ b/include/zhivo/ast/expression/RegexExpression.hpp @@ -29,7 +29,7 @@ class RegexExpression final : public ASTNode { std::string regExpression; public: explicit RegexExpression( - std::unique_ptr _address, + std::shared_ptr _address, std::string& _regExpression ) : regExpression(std::move(_regExpression)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/RenderExpression.hpp b/include/zhivo/ast/expression/RenderExpression.hpp index 00da27c..50be1b7 100644 --- a/include/zhivo/ast/expression/RenderExpression.hpp +++ b/include/zhivo/ast/expression/RenderExpression.hpp @@ -23,16 +23,16 @@ class RenderExpression final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; bool newLine; bool errorStream; public: explicit RenderExpression( - std::unique_ptr _address, + std::shared_ptr _address, bool _newLine, bool _errorStream, - std::unique_ptr _expression + std::shared_ptr _expression ) : expression(std::move(_expression)), newLine(_newLine), errorStream(_errorStream) { diff --git a/include/zhivo/ast/expression/StringLiteralExpression.hpp b/include/zhivo/ast/expression/StringLiteralExpression.hpp index bf3cfbc..79defb1 100644 --- a/include/zhivo/ast/expression/StringLiteralExpression.hpp +++ b/include/zhivo/ast/expression/StringLiteralExpression.hpp @@ -31,7 +31,7 @@ class StringLiteralExpression final : public ASTNode { public: explicit StringLiteralExpression( - std::unique_ptr _address, + std::shared_ptr _address, std::string _value ) : value(_value) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/TypeExpression.hpp b/include/zhivo/ast/expression/TypeExpression.hpp index faa1859..779fb3f 100644 --- a/include/zhivo/ast/expression/TypeExpression.hpp +++ b/include/zhivo/ast/expression/TypeExpression.hpp @@ -27,12 +27,12 @@ class TypeExpression final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit TypeExpression( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/expression/UnaryExpression.hpp b/include/zhivo/ast/expression/UnaryExpression.hpp index 297d5aa..30af12d 100644 --- a/include/zhivo/ast/expression/UnaryExpression.hpp +++ b/include/zhivo/ast/expression/UnaryExpression.hpp @@ -26,13 +26,13 @@ class UnaryExpression final : public ASTNode { private: std::string op; - std::unique_ptr expression; + std::shared_ptr expression; public: explicit UnaryExpression( - std::unique_ptr _address, + std::shared_ptr _address, std::string _op, - std::unique_ptr _expression + std::shared_ptr _expression ) : op(std::move(_op)), expression(std::move(_expression)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/expression/UnlessExpression.hpp b/include/zhivo/ast/expression/UnlessExpression.hpp index fe4e4c8..9c1b88a 100644 --- a/include/zhivo/ast/expression/UnlessExpression.hpp +++ b/include/zhivo/ast/expression/UnlessExpression.hpp @@ -25,16 +25,16 @@ class UnlessExpression final : public ASTNode { private: - std::unique_ptr condition; - std::unique_ptr thenBranch; - std::unique_ptr elseBranch; + std::shared_ptr condition; + std::shared_ptr thenBranch; + std::shared_ptr elseBranch; public: explicit UnlessExpression( - std::unique_ptr _address, - std::unique_ptr _condition, - std::unique_ptr _thenBranch, - std::unique_ptr _elseBranch + std::shared_ptr _address, + std::shared_ptr _condition, + std::shared_ptr _thenBranch, + std::shared_ptr _elseBranch ) : condition(std::move(_condition)), thenBranch(std::move(_thenBranch)), elseBranch(std::move(_elseBranch)) { diff --git a/include/zhivo/ast/expression/VariableAccessExpression.hpp b/include/zhivo/ast/expression/VariableAccessExpression.hpp index 1ee7b24..718f86e 100644 --- a/include/zhivo/ast/expression/VariableAccessExpression.hpp +++ b/include/zhivo/ast/expression/VariableAccessExpression.hpp @@ -27,13 +27,13 @@ class VariableAccessExpression final : public ASTNode { private: - std::unique_ptr name; + std::shared_ptr name; public: explicit VariableAccessExpression( - std::unique_ptr _name + std::shared_ptr _name ) : name(std::move(_name)) { - this->address = std::make_unique(*this->name); + this->address = std::make_shared(*this->name); } Token getName() const; diff --git a/include/zhivo/ast/expression/VariableDeclarationExpression.hpp b/include/zhivo/ast/expression/VariableDeclarationExpression.hpp index c86e4ed..b65cace 100644 --- a/include/zhivo/ast/expression/VariableDeclarationExpression.hpp +++ b/include/zhivo/ast/expression/VariableDeclarationExpression.hpp @@ -27,13 +27,13 @@ class VariableDeclarationExpression final : public ASTNode { private: - std::map> declarations; + std::map> declarations; std::string nativePath; public: explicit VariableDeclarationExpression( - std::unique_ptr _address, - std::map> _declarations, + std::shared_ptr _address, + std::map> _declarations, std::string _nativePath ) : declarations(std::move(_declarations)), nativePath(_nativePath) { @@ -44,7 +44,7 @@ class VariableDeclarationExpression final : public ASTNode { static NativeFunction loadNativeFunction( std::string& libName, std::string& funcName, - std::unique_ptr address + std::shared_ptr address ); }; diff --git a/include/zhivo/ast/expression/WhenExpression.hpp b/include/zhivo/ast/expression/WhenExpression.hpp index 827d299..1713c2e 100644 --- a/include/zhivo/ast/expression/WhenExpression.hpp +++ b/include/zhivo/ast/expression/WhenExpression.hpp @@ -27,16 +27,16 @@ class WhenExpression final : public ASTNode { private: - std::unique_ptr expression; - std::vector, std::unique_ptr>> cases; - std::unique_ptr defaultCase; + std::shared_ptr expression; + std::vector, std::shared_ptr>> cases; + std::shared_ptr defaultCase; public: explicit WhenExpression( - std::unique_ptr _address, - std::unique_ptr _expression, - std::vector, std::unique_ptr>> _cases, - std::unique_ptr _defaultCase + std::shared_ptr _address, + std::shared_ptr _expression, + std::vector, std::shared_ptr>> _cases, + std::shared_ptr _defaultCase ) : expression(std::move(_expression)), cases(std::move(_cases)), defaultCase(std::move(_defaultCase)) { diff --git a/include/zhivo/ast/expression/WhileExpression.hpp b/include/zhivo/ast/expression/WhileExpression.hpp index 489fc78..60d4bed 100644 --- a/include/zhivo/ast/expression/WhileExpression.hpp +++ b/include/zhivo/ast/expression/WhileExpression.hpp @@ -27,14 +27,14 @@ class WhileExpression final : public ASTNode { private: - std::unique_ptr expression; - std::unique_ptr body; + std::shared_ptr expression; + std::shared_ptr body; public: explicit WhileExpression( - std::unique_ptr _address, - std::unique_ptr _expression, - std::unique_ptr _body + std::shared_ptr _address, + std::shared_ptr _expression, + std::shared_ptr _body ) : expression(std::move(_expression)), body(std::move(_body)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/statement/BreakStatement.hpp b/include/zhivo/ast/statement/BreakStatement.hpp index 6c4f7ce..fdef9f9 100644 --- a/include/zhivo/ast/statement/BreakStatement.hpp +++ b/include/zhivo/ast/statement/BreakStatement.hpp @@ -27,7 +27,7 @@ class BreakStatement final : public ASTNode { public: - explicit BreakStatement(std::unique_ptr _address) { + explicit BreakStatement(std::shared_ptr _address) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/statement/ContinueStatement.hpp b/include/zhivo/ast/statement/ContinueStatement.hpp index a6a020f..5671f37 100644 --- a/include/zhivo/ast/statement/ContinueStatement.hpp +++ b/include/zhivo/ast/statement/ContinueStatement.hpp @@ -27,7 +27,7 @@ class ContinueStatement final : public ASTNode { public: - explicit ContinueStatement(std::unique_ptr _address) { + explicit ContinueStatement(std::shared_ptr _address) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/statement/ExpressionStatement.hpp b/include/zhivo/ast/statement/ExpressionStatement.hpp index 2b199e6..fdb8ff6 100644 --- a/include/zhivo/ast/statement/ExpressionStatement.hpp +++ b/include/zhivo/ast/statement/ExpressionStatement.hpp @@ -25,12 +25,12 @@ class ExpressionStatement final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit ExpressionStatement( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/statement/ReturnStatement.hpp b/include/zhivo/ast/statement/ReturnStatement.hpp index 4f0da58..cf71384 100644 --- a/include/zhivo/ast/statement/ReturnStatement.hpp +++ b/include/zhivo/ast/statement/ReturnStatement.hpp @@ -27,12 +27,12 @@ class ReturnStatement final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit ReturnStatement( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/statement/TestStatement.hpp b/include/zhivo/ast/statement/TestStatement.hpp index c7d1531..6cc0d8a 100644 --- a/include/zhivo/ast/statement/TestStatement.hpp +++ b/include/zhivo/ast/statement/TestStatement.hpp @@ -26,14 +26,14 @@ class TestStatement final : public ASTNode { private: - std::unique_ptr testName; - std::unique_ptr testBody; + std::shared_ptr testName; + std::shared_ptr testBody; public: explicit TestStatement( - std::unique_ptr _address, - std::unique_ptr _testName, - std::unique_ptr _testBody + std::shared_ptr _address, + std::shared_ptr _testName, + std::shared_ptr _testBody ) : testName(std::move(_testName)), testBody(std::move(_testBody)) { this->address = std::move(_address); diff --git a/include/zhivo/ast/statement/ThrowStatement.hpp b/include/zhivo/ast/statement/ThrowStatement.hpp index 0d47c97..bb759f2 100644 --- a/include/zhivo/ast/statement/ThrowStatement.hpp +++ b/include/zhivo/ast/statement/ThrowStatement.hpp @@ -27,12 +27,12 @@ class ThrowStatement final : public ASTNode { private: - std::unique_ptr expression; + std::shared_ptr expression; public: explicit ThrowStatement( - std::unique_ptr _address, - std::unique_ptr _expression + std::shared_ptr _address, + std::shared_ptr _expression ) : expression(std::move(_expression)) { this->address = std::move(_address); } diff --git a/include/zhivo/ast/statement/WaitStatement.hpp b/include/zhivo/ast/statement/WaitStatement.hpp index 0765107..2bb8102 100644 --- a/include/zhivo/ast/statement/WaitStatement.hpp +++ b/include/zhivo/ast/statement/WaitStatement.hpp @@ -26,7 +26,7 @@ class WaitStatement final : public ASTNode { public: - explicit WaitStatement(std::unique_ptr _address) { + explicit WaitStatement(std::shared_ptr _address) { this->address = std::move(_address); } diff --git a/include/zhivo/core/DynamicObject.hpp b/include/zhivo/core/DynamicObject.hpp index e547592..709d047 100644 --- a/include/zhivo/core/DynamicObject.hpp +++ b/include/zhivo/core/DynamicObject.hpp @@ -170,9 +170,9 @@ class DynamicObject final { bool getBool() const; void setArrayElement( - std::unique_ptr reference, + std::shared_ptr reference, size_t index, - std::unique_ptr object + std::shared_ptr object ); DynamicObject callFromNative( diff --git a/include/zhivo/core/RegexWrapper.hpp b/include/zhivo/core/RegexWrapper.hpp index 73c6019..2527a2e 100644 --- a/include/zhivo/core/RegexWrapper.hpp +++ b/include/zhivo/core/RegexWrapper.hpp @@ -26,12 +26,12 @@ class RegexWrapper final { private: std::string pattern; - std::unique_ptr regex; + std::shared_ptr regex; public: RegexWrapper(const std::string& _pattern) : pattern(std::move(_pattern)), - regex(std::make_unique(this->pattern)) {} + regex(std::make_shared(this->pattern)) {} const std::string& getPattern() const; const std::regex getRegex() const; diff --git a/include/zhivo/core/SymbolTable.hpp b/include/zhivo/core/SymbolTable.hpp index 68e9288..c6944a8 100644 --- a/include/zhivo/core/SymbolTable.hpp +++ b/include/zhivo/core/SymbolTable.hpp @@ -52,7 +52,7 @@ class SymbolTable final { SymbolTable& operator=(const SymbolTable& other); DynamicObject getSymbol( - std::unique_ptr reference, + std::shared_ptr reference, const std::string& name ); diff --git a/include/zhivo/parser/Parser.hpp b/include/zhivo/parser/Parser.hpp index de4e4f7..fc4a6d4 100644 --- a/include/zhivo/parser/Parser.hpp +++ b/include/zhivo/parser/Parser.hpp @@ -28,48 +28,48 @@ class Parser final { private: - std::vector> globalStatements; + std::vector> globalStatements; std::vector tokens; int length; int index = 0; - std::unique_ptr exprArray(); - std::unique_ptr exprBlock(); - std::unique_ptr exprCatchHandle(); - std::unique_ptr exprFunctionDecl(); - std::unique_ptr exprLoop(); - std::unique_ptr exprIf(); - std::unique_ptr exprLiteral(); - std::unique_ptr exprRandom(); - std::unique_ptr exprRender(); - std::unique_ptr exprType(); - std::unique_ptr exprUnless(); - std::unique_ptr exprWhen(); - std::unique_ptr exprWhile(); - std::unique_ptr exprPrimary(); - std::unique_ptr exprLogicOr(); - std::unique_ptr exprLogicAnd(); - std::unique_ptr exprBitwiseOr(); - std::unique_ptr exprBitwiseXor(); - std::unique_ptr exprBitwiseAnd(); - std::unique_ptr exprNilCoalescing(); - std::unique_ptr exprEquality(); - std::unique_ptr exprComparison(); - std::unique_ptr exprShift(); - std::unique_ptr exprTerm(); - std::unique_ptr exprFactor(); - std::unique_ptr exprParallel(); - std::unique_ptr exprVal(); + std::shared_ptr exprArray(); + std::shared_ptr exprBlock(); + std::shared_ptr exprCatchHandle(); + std::shared_ptr exprFunctionDecl(); + std::shared_ptr exprLoop(); + std::shared_ptr exprIf(); + std::shared_ptr exprLiteral(); + std::shared_ptr exprRandom(); + std::shared_ptr exprRender(); + std::shared_ptr exprType(); + std::shared_ptr exprUnless(); + std::shared_ptr exprWhen(); + std::shared_ptr exprWhile(); + std::shared_ptr exprPrimary(); + std::shared_ptr exprLogicOr(); + std::shared_ptr exprLogicAnd(); + std::shared_ptr exprBitwiseOr(); + std::shared_ptr exprBitwiseXor(); + std::shared_ptr exprBitwiseAnd(); + std::shared_ptr exprNilCoalescing(); + std::shared_ptr exprEquality(); + std::shared_ptr exprComparison(); + std::shared_ptr exprShift(); + std::shared_ptr exprTerm(); + std::shared_ptr exprFactor(); + std::shared_ptr exprParallel(); + std::shared_ptr exprVal(); - std::unique_ptr stmtBreak(); - std::unique_ptr stmtContinue(); - std::unique_ptr stmtRet(); - std::unique_ptr stmtThrow(); - std::unique_ptr stmtTest(); - std::unique_ptr stmtWait(); + std::shared_ptr stmtBreak(); + std::shared_ptr stmtContinue(); + std::shared_ptr stmtRet(); + std::shared_ptr stmtThrow(); + std::shared_ptr stmtTest(); + std::shared_ptr stmtWait(); - std::unique_ptr expression(); - std::unique_ptr statement(); + std::shared_ptr expression(); + std::shared_ptr statement(); Token previous(); Token peek(); @@ -88,7 +88,7 @@ class Parser final { tokens(_tokens), length(static_cast(_tokens.size())) {} - const std::vector>& getGlobalStatements() const; + const std::vector>& getGlobalStatements() const; void parse(); static Parser fromFile(const std::string& fileName); diff --git a/include/zhivo/parser/ParserException.hpp b/include/zhivo/parser/ParserException.hpp index d015a27..8be9790 100644 --- a/include/zhivo/parser/ParserException.hpp +++ b/include/zhivo/parser/ParserException.hpp @@ -26,11 +26,11 @@ class ParserException final : public std::runtime_error { private: - std::unique_ptr address; + std::shared_ptr address; public: explicit ParserException( - std::unique_ptr _address, + std::shared_ptr _address, const std::string& message) : std::runtime_error(message), address(std::move(_address)) {} diff --git a/include/zhivo/parser/Tokenizer.hpp b/include/zhivo/parser/Tokenizer.hpp index 4be709f..8cb4cf3 100644 --- a/include/zhivo/parser/Tokenizer.hpp +++ b/include/zhivo/parser/Tokenizer.hpp @@ -62,7 +62,7 @@ class Tokenizer final { length((int) this->source.length()), index(0) {} - static std::unique_ptr loadFile(const std::string& filePath); + static std::shared_ptr loadFile(const std::string& filePath); void scan(); const std::vector& getTokens() const;