diff --git a/src/Parser/Expression/Expression.cpp b/src/Parser/Expression/Expression.cpp index 6e5a91c..5a3b580 100644 --- a/src/Parser/Expression/Expression.cpp +++ b/src/Parser/Expression/Expression.cpp @@ -15,7 +15,3 @@ ValueType Expression::getValueType() { bool Expression::isValid() { return kind != ExpressionKind::INVALID; } - -string Expression::toString(int indent) { - return "EXPRESSION"; -} diff --git a/src/Parser/Expression/Expression.h b/src/Parser/Expression/Expression.h index ccc92d5..2749e52 100644 --- a/src/Parser/Expression/Expression.h +++ b/src/Parser/Expression/Expression.h @@ -28,10 +28,10 @@ protected: public: Expression(ExpressionKind kind, ValueType valueType); + virtual ~Expression() { } ExpressionKind getKind(); ValueType getValueType(); bool isValid(); - virtual string toString(int indent); }; #endif \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionBinary.cpp b/src/Parser/Expression/ExpressionBinary.cpp index bd062b9..29a42be 100644 --- a/src/Parser/Expression/ExpressionBinary.cpp +++ b/src/Parser/Expression/ExpressionBinary.cpp @@ -71,30 +71,3 @@ shared_ptr ExpressionBinary::getLeft() { shared_ptr ExpressionBinary::getRight() { return right; } - -string ExpressionBinary::toString(int indent) { - switch (operation) { - case ExpressionBinaryOperation::EQUAL: - return "{= " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::NOT_EQUAL: - return "{!= " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::LESS: - return "{< " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::LESS_EQUAL: - return "{<= " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::GREATER: - return "{> " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::GREATER_EQUAL: - return "{<= " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::ADD: - return "{+ " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::SUB: - return "{- " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::MUL: - return "{* " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::DIV: - return "{/ " + left->toString(0) + " " + right->toString(0) + "}"; - case ExpressionBinaryOperation::MOD: - return "{% " + left->toString(0) + " " + right->toString(0) + "}"; - } -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionBinary.h b/src/Parser/Expression/ExpressionBinary.h index 5fbc44c..0c5bb4c 100644 --- a/src/Parser/Expression/ExpressionBinary.h +++ b/src/Parser/Expression/ExpressionBinary.h @@ -26,5 +26,4 @@ public: ExpressionBinaryOperation getOperation(); shared_ptr getLeft(); shared_ptr getRight(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionBlock.cpp b/src/Parser/Expression/ExpressionBlock.cpp index 77f734c..c21d5ba 100644 --- a/src/Parser/Expression/ExpressionBlock.cpp +++ b/src/Parser/Expression/ExpressionBlock.cpp @@ -23,7 +23,3 @@ shared_ptr ExpressionBlock::getStatementBlock() { shared_ptr ExpressionBlock::getResultStatementExpression() { return resultStatementExpression; } - -string ExpressionBlock::toString(int indent) { - return ""; -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionBlock.h b/src/Parser/Expression/ExpressionBlock.h index 05f5663..42850b8 100644 --- a/src/Parser/Expression/ExpressionBlock.h +++ b/src/Parser/Expression/ExpressionBlock.h @@ -13,5 +13,4 @@ public: ExpressionBlock(vector> statements); shared_ptr getStatementBlock(); shared_ptr getResultStatementExpression(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionCall.cpp b/src/Parser/Expression/ExpressionCall.cpp index 315590b..ea917e9 100644 --- a/src/Parser/Expression/ExpressionCall.cpp +++ b/src/Parser/Expression/ExpressionCall.cpp @@ -10,17 +10,3 @@ string ExpressionCall::getName() { vector> ExpressionCall::getArgumentExpressions() { return argumentExpressions; } - -string ExpressionCall::toString(int indent) { - string value; - - value += "CALL(" + name + "):"; - for (shared_ptr &argumentExpression : argumentExpressions) { - value += "\n"; - for (int ind=0; indtoString(indent+1) + ","; - } - - return value; -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionCall.h b/src/Parser/Expression/ExpressionCall.h index 5a06308..70df042 100644 --- a/src/Parser/Expression/ExpressionCall.h +++ b/src/Parser/Expression/ExpressionCall.h @@ -9,5 +9,4 @@ public: ExpressionCall(string name, vector> argumentExpressions); string getName(); vector> getArgumentExpressions(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionGrouping.cpp b/src/Parser/Expression/ExpressionGrouping.cpp index d5762fc..a9c783a 100644 --- a/src/Parser/Expression/ExpressionGrouping.cpp +++ b/src/Parser/Expression/ExpressionGrouping.cpp @@ -6,7 +6,3 @@ Expression(ExpressionKind::GROUPING, expression->getValueType()), expression(exp shared_ptr ExpressionGrouping::getExpression() { return expression; } - -string ExpressionGrouping::toString(int indent) { - return "( " + expression->toString(0) + " )"; -} diff --git a/src/Parser/Expression/ExpressionGrouping.h b/src/Parser/Expression/ExpressionGrouping.h index e30a6ec..490f3fc 100644 --- a/src/Parser/Expression/ExpressionGrouping.h +++ b/src/Parser/Expression/ExpressionGrouping.h @@ -7,5 +7,4 @@ private: public: ExpressionGrouping(shared_ptr expression); shared_ptr getExpression(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionIfElse.cpp b/src/Parser/Expression/ExpressionIfElse.cpp index 2d4d374..5c2d6d9 100644 --- a/src/Parser/Expression/ExpressionIfElse.cpp +++ b/src/Parser/Expression/ExpressionIfElse.cpp @@ -20,21 +20,3 @@ shared_ptr ExpressionIfElse::getThenBlock() { shared_ptr ExpressionIfElse::getElseBlock() { return elseBlock; } - -string ExpressionIfElse::toString(int indent) { - string value; - value += "IF(" + condition->toString(0) + "):\n"; - - value += thenBlock->toString(indent+1); - if (elseBlock != nullptr) { - for (int ind=0; indtoString(indent+1); - } - for (int ind=0; ind getCondition(); shared_ptr getThenBlock(); shared_ptr getElseBlock(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionInvalid.cpp b/src/Parser/Expression/ExpressionInvalid.cpp index 3f0ae4c..b4d4b5b 100644 --- a/src/Parser/Expression/ExpressionInvalid.cpp +++ b/src/Parser/Expression/ExpressionInvalid.cpp @@ -7,7 +7,3 @@ Expression(ExpressionKind::INVALID, ValueType::NONE), token(token) { shared_ptr ExpressionInvalid::getToken() { return token; } - -string ExpressionInvalid::toString(int indent) { - return "Invalid token " + token->toString() + " at " + to_string(token->getLine()) + ":" + to_string(token->getColumn()) + "\n"; -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionInvalid.h b/src/Parser/Expression/ExpressionInvalid.h index 6e2f454..a64bb06 100644 --- a/src/Parser/Expression/ExpressionInvalid.h +++ b/src/Parser/Expression/ExpressionInvalid.h @@ -7,5 +7,4 @@ private: public: ExpressionInvalid(shared_ptr token); shared_ptr getToken(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionLiteral.cpp b/src/Parser/Expression/ExpressionLiteral.cpp index c69688d..df85403 100644 --- a/src/Parser/Expression/ExpressionLiteral.cpp +++ b/src/Parser/Expression/ExpressionLiteral.cpp @@ -52,16 +52,3 @@ int32_t ExpressionLiteral::getSint32Value() { float ExpressionLiteral::getReal32Value() { return real32Value; } - -string ExpressionLiteral::toString(int indent) { - switch (valueType) { - case ValueType::NONE: - return "NONE"; - case ValueType::BOOL: - return boolValue ? "true" : "false"; - case ValueType::SINT32: - return to_string(sint32Value); - case ValueType::REAL32: - return to_string(real32Value); - } -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionLiteral.h b/src/Parser/Expression/ExpressionLiteral.h index 852f7e3..77972d2 100644 --- a/src/Parser/Expression/ExpressionLiteral.h +++ b/src/Parser/Expression/ExpressionLiteral.h @@ -13,5 +13,4 @@ public: bool getBoolValue(); int32_t getSint32Value(); float getReal32Value(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionVariable.cpp b/src/Parser/Expression/ExpressionVariable.cpp index e6a1838..da9e78e 100644 --- a/src/Parser/Expression/ExpressionVariable.cpp +++ b/src/Parser/Expression/ExpressionVariable.cpp @@ -6,7 +6,3 @@ Expression(ExpressionKind::VAR, ValueType::NONE), name(name) { } string ExpressionVariable::getName() { return name; } - -string ExpressionVariable::toString(int indent) { - return "VAR(" + name + ")"; -} \ No newline at end of file diff --git a/src/Parser/Expression/ExpressionVariable.h b/src/Parser/Expression/ExpressionVariable.h index 0b10e5d..bd0b99f 100644 --- a/src/Parser/Expression/ExpressionVariable.h +++ b/src/Parser/Expression/ExpressionVariable.h @@ -7,5 +7,4 @@ private: public: ExpressionVariable(string name); string getName(); - string toString(int indent) override; }; \ No newline at end of file diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index aabdcee..f2a38f6 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -337,7 +337,7 @@ shared_ptr Parser::matchStatementExpression() { if (expression == nullptr) return nullptr; else if (!expression->isValid()) - return make_shared(tokens.at(currentIndex), expression->toString(0)); + return make_shared(tokens.at(currentIndex), "");// expression->toString(0)); return make_shared(expression); } diff --git a/src/Parser/Statement/Statement.h b/src/Parser/Statement/Statement.h index 8ec4fd5..ccdcfdd 100644 --- a/src/Parser/Statement/Statement.h +++ b/src/Parser/Statement/Statement.h @@ -25,7 +25,7 @@ private: public: Statement(StatementKind kind); - virtual ~Statement() {} + virtual ~Statement() { } StatementKind getKind(); bool isValid(); };