mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
ASTDumper.hpp
Go to the documentation of this file.
2
4
5
6namespace m {
7
8namespace ast {
9
12{
13 std::ostream &out;
14 private:
15 int indent_;
16
17 public:
18 ASTDumper(std::ostream &out, int indent = 0) : out(out), indent_(indent) { }
19
20 using ConstASTVisitor::operator();
21#define DECLARE(CLASS) void operator()(Const<CLASS>&) override;
23#undef DECLARE
24
25 private:
27 std::ostream & indent() const {
28 M_insist(indent_ >= 0, "Indent must not be negative! Missing increment or superfluous decrement?");
29 if (indent_)
30 out << '\n' << std::string(2 * indent_ - 2, ' ') << "` ";
31 return out;
32 }
33
34 private:
35 void print_type(const Expr &e) const;
36};
37
38}
39
40}
#define M_AST_LIST(X)
Definition: AST.hpp:1063
#define DECLARE(CLASS)
#define M_insist(...)
Definition: macro.hpp:129
‍mutable namespace
Definition: Backend.hpp:10
Dumps a textual representation of the AST to an output stream.
Definition: ASTDumper.hpp:12
ASTDumper(std::ostream &out, int indent=0)
Definition: ASTDumper.hpp:18
int indent_
the current level of indentation
Definition: ASTDumper.hpp:15
std::ostream & out
the output stream to write to
Definition: ASTDumper.hpp:13