mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-08 16:08:45 +00:00
bool literals, fixes
This commit is contained in:
parent
b1aff1935d
commit
d31979166e
24 changed files with 179 additions and 46 deletions
|
|
@ -1531,6 +1531,13 @@ void BuildVisitor::Visit(UnitLiteral* node) {
|
|||
SetPosition(node->base, current_node_);
|
||||
}
|
||||
|
||||
void BuildVisitor::Visit(BoolLiteral* node) {
|
||||
SetPosition(node->base, current_node_);
|
||||
|
||||
std::string literal = current_node_.GetValue();
|
||||
node->value = (literal == "true"); // always "false" in other way
|
||||
}
|
||||
|
||||
void BuildVisitor::Visit(Literal& node) {
|
||||
auto parse_node = current_node_;
|
||||
|
||||
|
|
@ -1553,6 +1560,9 @@ void BuildVisitor::Visit(Literal& node) {
|
|||
} else if (current_node_type == parser::tokens::UnitLiteral) {
|
||||
node = std::make_unique<UnitLiteral>();
|
||||
Visit(std::get<std::unique_ptr<UnitLiteral>>(node).get());
|
||||
} else if (current_node_type == parser::tokens::BoolLiteral) {
|
||||
node = std::make_unique<BoolLiteral>();
|
||||
Visit(std::get<std::unique_ptr<BoolLiteral>>(node).get());
|
||||
} else {
|
||||
// error
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue