can now parse identifiers and integer literals

This commit is contained in:
Karma Riuk
2025-07-08 18:14:37 +02:00
parent e3cbba08b1
commit 79b1aeb45f
6 changed files with 111 additions and 8 deletions

View File

@@ -0,0 +1,15 @@
#include "integer.hpp"
namespace ast {
integer_literal::integer_literal(token::token token, int value)
: token(std::move(token)),
value(value) {}
std::string integer_literal::token_literal() const {
return token.literal;
};
std::string integer_literal::str() const {
return token.literal;
};
} // namespace ast

View File

@@ -0,0 +1,15 @@
#pragma once
#include "ast/ast.hpp"
#include "token/token.hpp"
namespace ast {
struct integer_literal : expression {
integer_literal(token::token token, int value);
token::token token;
int value;
std::string token_literal() const override;
std::string str() const override;
};
} // namespace ast