grammar refactoring: part of build_visitor fixed

This commit is contained in:
ProgramSnail 2023-04-09 18:49:52 +03:00
parent 2d2bb9ec65
commit 64653e6a6a
6 changed files with 245 additions and 404 deletions

View file

@ -60,13 +60,17 @@ void PrintVisitor::Visit(Partition* node) {
void PrintVisitor::Visit(Namespace* node) {
out_ << "[Namespace] ";
if (node->name.has_value()) {
switch (node->modifier) {
case Namespace::Const:
out_ << "const ";
break;
case Namespace::Var:
out_ << "var ";
break;
if (node->modifier.has_value()) {
switch (node->modifier.value()) {
case Namespace::Const:
out_ << "const ";
break;
case Namespace::Var:
out_ << "var ";
break;
}
} else {
// error
}
Visit(&node->name.value());
}
@ -647,6 +651,10 @@ void PrintVisitor::Visit(TypeclassExpression* node) {
// Identifiers, constants, etc. -----------------
void PrintVisitor::Visit(ExtendedName* node) {
out_ << "[ExtendedName " << node->name << "] ";
}
void PrintVisitor::Visit(AnyIdentifier* node) { // std::string
out_ << "[Identifier " << *node << "] ";
}