added boolean literals and tests for them (no

parsing yet)
This commit is contained in:
Karma Riuk
2025-07-11 20:55:02 +02:00
parent 8c1f4e10cd
commit 4da5f32aea
5 changed files with 93 additions and 5 deletions

View File

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

View File

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