1 #ifndef MSP_GL_SL_DEBUG_H_
2 #define MSP_GL_SL_DEBUG_H_
11 /** Creates a textual representation of the syntax tree. The result is encoded
13 class DumpTree: private TraversingVisitor
19 STRAIGHT = 0x2502, // │
21 BRANCH_LAST = 0x2514, // └
30 Branch(const char *t, Node *n = 0): text(t), node(n) { }
31 Branch(const std::string &t, Node *n = 0): text(t), node(n) { }
32 Branch(Node *n): node(n) { }
35 std::map<const Node *, unsigned> node_labels;
36 std::string formatted;
37 std::vector<TreeChars> tree;
40 std::string apply(Stage &);
41 std::string apply(Node &n) { n.visit(*this); return formatted; }
44 void append(const std::string &);
45 void append(const Node &, const std::string &);
46 void append_subtree(const std::vector<Branch> &);
47 void append_subtree(Node &);
51 unsigned get_label(const Node &);
52 std::string format_type(TypeDeclaration *);
55 typename T::const_iterator increment(typename T::const_iterator &, const T &);
57 virtual void visit(Block &);
58 virtual void visit(Literal &);
59 virtual void visit(VariableReference &);
60 virtual void visit(InterfaceBlockReference &);
61 virtual void visit(MemberAccess &);
62 virtual void visit(Swizzle &);
63 virtual void visit(UnaryExpression &);
64 virtual void visit(BinaryExpression &);
65 virtual void visit(Assignment &);
66 virtual void visit(TernaryExpression &);
67 virtual void visit(FunctionCall &);
68 virtual void visit(ExpressionStatement &);
69 virtual void visit(Import &);
70 virtual void visit(Precision &);
71 virtual void visit(Layout &);
72 virtual void visit(InterfaceLayout &);
73 virtual void visit(BasicTypeDeclaration &);
74 virtual void visit(ImageTypeDeclaration &);
75 virtual void visit(StructDeclaration &);
76 virtual void visit(VariableDeclaration &);
77 virtual void visit(InterfaceBlock &);
78 virtual void visit(FunctionDeclaration &);
79 virtual void visit(Conditional &);
80 virtual void visit(Iteration &);
81 virtual void visit(Passthrough &);
82 virtual void visit(Return &);
83 virtual void visit(Jump &);