added boolean literals and tests for them (no
parsing yet)
This commit is contained in:
15
src/ast/expressions/boolean.cpp
Normal file
15
src/ast/expressions/boolean.cpp
Normal 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
|
17
src/ast/expressions/boolean.hpp
Normal file
17
src/ast/expressions/boolean.hpp
Normal 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
|
Reference in New Issue
Block a user