added possibility of printing nodes

This commit is contained in:
Karma Riuk
2025-07-08 18:05:52 +02:00
parent 96d76153d4
commit 74c555bfc0

View File

@@ -1,5 +1,6 @@
#pragma once
#include <iostream>
#include <string>
namespace ast {
@@ -9,6 +10,14 @@ namespace ast {
virtual ~node() = default;
};
inline std::ostream& operator<<(std::ostream& os, const node& n) {
return os << n.str();
}
inline std::ostream& operator<<(std::ostream& os, const node* n) {
return os << n->str();
}
struct statement : node {};
struct expression : node {};