added possibility of printing nodes
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ast {
|
namespace ast {
|
||||||
@@ -9,6 +10,14 @@ namespace ast {
|
|||||||
virtual ~node() = default;
|
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 statement : node {};
|
||||||
|
|
||||||
struct expression : node {};
|
struct expression : node {};
|
||||||
|
Reference in New Issue
Block a user