renamed let to let_stmt

This commit is contained in:
Karma Riuk
2025-07-07 17:44:11 +02:00
parent 39eafe2360
commit b98424aa5f
6 changed files with 17 additions and 13 deletions

View File

@@ -35,6 +35,8 @@ namespace parser {
switch (current.type) {
case token::type::LET:
return parse_let();
case token::type::RETURN:
return parse_return();
default:
return nullptr;
}
@@ -49,8 +51,8 @@ namespace parser {
return false;
}
ast::let* parser::parse_let() {
ast::let* stmt = new ast::let(current);
ast::let_stmt* parser::parse_let() {
ast::let_stmt* stmt = new ast::let_stmt(current);
if (!expect_next(token::type::IDENTIFIER)) {
delete stmt;

View File

@@ -3,6 +3,7 @@
#include "ast/ast.hpp"
#include "ast/errors/error.hpp"
#include "ast/statements/let.hpp"
#include "ast/statements/return.hpp"
#include "lexer/lexer.hpp"
#include "token/token.hpp"
@@ -20,7 +21,8 @@ namespace parser {
void next_token();
ast::statement* parse_statement();
ast::let* parse_let();
ast::let_stmt* parse_let();
ast::return_stmt* parse_return();
bool expect_next(token::type);
void next_error(token::type);
};