added return parsing

This commit is contained in:
Karma Riuk
2025-07-07 18:33:39 +02:00
parent 1638ddbfa1
commit 0b9d7d9c33
3 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#include "return.hpp"
namespace ast {
return_stmt::return_stmt(token::token token)
: token(std::move(token)),
value(nullptr) {}
std::string return_stmt::token_literal() const {
return token.literal;
}
return_stmt::~return_stmt() {
delete value;
};
} // namespace ast

View File

@@ -0,0 +1,16 @@
#include "ast/ast.hpp"
#include "token/token.hpp"
namespace ast {
struct return_stmt : statement {
return_stmt(token::token token);
token::token token;
expression* value;
std::string token_literal() const override;
~return_stmt();
};
} // namespace ast