Skip to content

Commit

Permalink
back to void from std::Any
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsVind committed May 1, 2024
1 parent 2ce9da1 commit 75e3317
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 187 deletions.
78 changes: 39 additions & 39 deletions include/src/ast/AstVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,47 @@ class UnaryNodeList;

class AstVisitor : public std::enable_shared_from_this<AstVisitor> {
public:
virtual std::any visit(const std::shared_ptr<AndExprNode> &node);
virtual std::any visit(const std::shared_ptr<AssignNode> &node);
virtual std::any visit(const std::shared_ptr<ColumnNode> &node);
virtual std::any visit(const std::shared_ptr<DivExprNode> &node);
virtual std::any visit(const std::shared_ptr<ElseNode> &node);
virtual std::any visit(const std::shared_ptr<EqualExprNode> &node);
virtual std::any visit(const std::shared_ptr<ExpoExprNode> &node);
virtual std::any visit(const std::shared_ptr<FilterNode> &node);
virtual std::any visit(const std::shared_ptr<GreaterEqualExprNode> &node);
virtual std::any visit(const std::shared_ptr<GreaterExprNode> &node);
virtual std::any visit(const std::shared_ptr<HeaderIndexNode> &node);
virtual std::any visit(const std::shared_ptr<IfNode> &node);
virtual std::any visit(const std::shared_ptr<IndexNode> &node);
virtual std::any visit(const std::shared_ptr<IntersectionExprNode> &node);
virtual std::any visit(const std::shared_ptr<LeafNode> &node);
virtual std::any visit(const std::shared_ptr<LessEqualExprNode> &node);
virtual std::any visit(const std::shared_ptr<LessExprNode> &node);
virtual std::any visit(const std::shared_ptr<ListNode> &node);
virtual std::any visit(const std::shared_ptr<MinusExprNode> &node);
virtual std::any visit(const std::shared_ptr<MinusNode> &node);
virtual std::any visit(const std::shared_ptr<ModExprNode> &node);
virtual std::any visit(const std::shared_ptr<MultExprNode> &node);
virtual std::any visit(const std::shared_ptr<NotEqualExprNode> &node);
virtual std::any visit(const std::shared_ptr<NotNode> &node);
virtual std::any visit(const std::shared_ptr<OrExprNode> &node);
virtual std::any visit(const std::shared_ptr<ParNode> &node);
virtual std::any visit(const std::shared_ptr<PlusExprNode> &node);
virtual std::any visit(const std::shared_ptr<PlusNode> &node);
virtual std::any visit(const std::shared_ptr<ProcCallNode> &node);
virtual std::any visit(const std::shared_ptr<ProcDecNode> &node);
virtual std::any visit(const std::shared_ptr<ProgNode> &node);
virtual std::any visit(const std::shared_ptr<ReturnNode> &node);
virtual std::any visit(const std::shared_ptr<TableNode> &node);
virtual std::any visit(const std::shared_ptr<UnaryExprNode> &node);
virtual std::any visit(const std::shared_ptr<UnionExprNode> &node);
virtual std::any visit(const std::shared_ptr<WhileNode> &node);
virtual void visit(const std::shared_ptr<AndExprNode> &node);
virtual void visit(const std::shared_ptr<AssignNode> &node);
virtual void visit(const std::shared_ptr<ColumnNode> &node);
virtual void visit(const std::shared_ptr<DivExprNode> &node);
virtual void visit(const std::shared_ptr<ElseNode> &node);
virtual void visit(const std::shared_ptr<EqualExprNode> &node);
virtual void visit(const std::shared_ptr<ExpoExprNode> &node);
virtual void visit(const std::shared_ptr<FilterNode> &node);
virtual void visit(const std::shared_ptr<GreaterEqualExprNode> &node);
virtual void visit(const std::shared_ptr<GreaterExprNode> &node);
virtual void visit(const std::shared_ptr<HeaderIndexNode> &node);
virtual void visit(const std::shared_ptr<IfNode> &node);
virtual void visit(const std::shared_ptr<IndexNode> &node);
virtual void visit(const std::shared_ptr<IntersectionExprNode> &node);
virtual void visit(const std::shared_ptr<LeafNode> &node);
virtual void visit(const std::shared_ptr<LessEqualExprNode> &node);
virtual void visit(const std::shared_ptr<LessExprNode> &node);
virtual void visit(const std::shared_ptr<ListNode> &node);
virtual void visit(const std::shared_ptr<MinusExprNode> &node);
virtual void visit(const std::shared_ptr<MinusNode> &node);
virtual void visit(const std::shared_ptr<ModExprNode> &node);
virtual void visit(const std::shared_ptr<MultExprNode> &node);
virtual void visit(const std::shared_ptr<NotEqualExprNode> &node);
virtual void visit(const std::shared_ptr<NotNode> &node);
virtual void visit(const std::shared_ptr<OrExprNode> &node);
virtual void visit(const std::shared_ptr<ParNode> &node);
virtual void visit(const std::shared_ptr<PlusExprNode> &node);
virtual void visit(const std::shared_ptr<PlusNode> &node);
virtual void visit(const std::shared_ptr<ProcCallNode> &node);
virtual void visit(const std::shared_ptr<ProcDecNode> &node);
virtual void visit(const std::shared_ptr<ProgNode> &node);
virtual void visit(const std::shared_ptr<ReturnNode> &node);
virtual void visit(const std::shared_ptr<TableNode> &node);
virtual void visit(const std::shared_ptr<UnaryExprNode> &node);
virtual void visit(const std::shared_ptr<UnionExprNode> &node);
virtual void visit(const std::shared_ptr<WhileNode> &node);

private:
std::any visit(const std::shared_ptr<BinaryNode> &node);
std::any visit(const std::shared_ptr<UnaryNode> &node);
std::any visit(const std::shared_ptr<UnaryNodeList> &node);
void visit(const std::shared_ptr<BinaryNode> &node);
void visit(const std::shared_ptr<UnaryNode> &node);
void visit(const std::shared_ptr<UnaryNodeList> &node);
};

#endif
140 changes: 70 additions & 70 deletions include/tests/AstTestVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,180 +11,180 @@ class AstTestVisitor : public AstVisitor {
: parser(parser), lexer(lexer), expectedTreeNodes(expectedTreeNodes) {}


std::any visit(const std::shared_ptr<AndExprNode> &node) override {
void visit(const std::shared_ptr<AndExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<AssignNode> &node) override {
void visit(const std::shared_ptr<AssignNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ColumnNode> &node) override {
void visit(const std::shared_ptr<ColumnNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<DivExprNode> &node) override {
void visit(const std::shared_ptr<DivExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ElseNode> &node) override {
void visit(const std::shared_ptr<ElseNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<EqualExprNode> &node) override {
void visit(const std::shared_ptr<EqualExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ExpoExprNode> &node) override {
void visit(const std::shared_ptr<ExpoExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<FilterNode> &node) override {
void visit(const std::shared_ptr<FilterNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<GreaterEqualExprNode> &node) override {
void visit(const std::shared_ptr<GreaterEqualExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<GreaterExprNode> &node) override {
void visit(const std::shared_ptr<GreaterExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<HeaderIndexNode> &node) override {
void visit(const std::shared_ptr<HeaderIndexNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<IfNode> &node) override {
void visit(const std::shared_ptr<IfNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<IndexNode> &node) override {
void visit(const std::shared_ptr<IndexNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<IntersectionExprNode> &node) override {
void visit(const std::shared_ptr<IntersectionExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<LeafNode> &node) override {
void visit(const std::shared_ptr<LeafNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<LessEqualExprNode> &node) override {
void visit(const std::shared_ptr<LessEqualExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<LessExprNode> &node) override {
void visit(const std::shared_ptr<LessExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ListNode> &node) override {
void visit(const std::shared_ptr<ListNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<MinusExprNode> &node) override {
void visit(const std::shared_ptr<MinusExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<MinusNode> &node) override {
void visit(const std::shared_ptr<MinusNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ModExprNode> &node) override {
void visit(const std::shared_ptr<ModExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<MultExprNode> &node) override {
void visit(const std::shared_ptr<MultExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<NotNode> &node) override {
void visit(const std::shared_ptr<NotNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<OrExprNode> &node) override {
void visit(const std::shared_ptr<OrExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ParNode> &node) override {
void visit(const std::shared_ptr<ParNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<PlusExprNode> &node) override {
void visit(const std::shared_ptr<PlusExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<PlusNode> &node) override {
void visit(const std::shared_ptr<PlusNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ProcCallNode> &node) override {
void visit(const std::shared_ptr<ProcCallNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ProcDecNode> &node) override {
void visit(const std::shared_ptr<ProcDecNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ProgNode> &node) override {
void visit(const std::shared_ptr<ProgNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<ReturnNode> &node) override {
void visit(const std::shared_ptr<ReturnNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<TableNode> &node) override {
void visit(const std::shared_ptr<TableNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<UnaryExprNode> &node) override {
void visit(const std::shared_ptr<UnaryExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<UnionExprNode> &node) override {
void visit(const std::shared_ptr<UnionExprNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
std::any visit(const std::shared_ptr<WhileNode> &node) override {
void visit(const std::shared_ptr<WhileNode> &node) override {
std::shared_ptr<AstNode> astNode = std::dynamic_pointer_cast<AstNode>(node);
test(astNode);
return AstVisitor::visit(node);
AstVisitor::visit(node);
};
private:
dplgrammar::DplParser* parser;
Expand Down
Loading

0 comments on commit 75e3317

Please sign in to comment.