mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
ASTDot.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
5
6
7namespace m {
8
9namespace ast {
10
13{
14 static constexpr const char * const GRAPH_TYPE = "graph";
15 static constexpr const char * const EDGE = " -- ";
16
17 std::ostream &out;
18
19 private:
20 int indent_;
21
22 public:
27 ASTDot(std::ostream &out, int indent = 0);
28 ~ASTDot();
29
30 using ConstASTVisitor::operator();
31#define DECLARE(CLASS) void operator()(Const<CLASS>&) override;
33#undef DECLARE
34
35 private:
37 std::ostream & indent() const {
38 M_insist(indent_ >= 0, "Indent must not be negative! Missing increment or superfluous decrement?");
39 if (indent_)
40 out << '\n' << std::string(2 * indent_, ' ');
41 return out;
42 }
43
51 void cluster(Const<Clause> &c, const char *name, const char *label, const char *color);
52};
53
54}
55
56}
#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
Implements printing the AST in dot language.
Definition: ASTDot.hpp:13
static constexpr const char *const GRAPH_TYPE
Definition: ASTDot.hpp:14
std::ostream & out
the output stream to print to
Definition: ASTDot.hpp:17
static constexpr const char *const EDGE
Definition: ASTDot.hpp:15
int indent_
the current indentation for pretty printing
Definition: ASTDot.hpp:20