]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/debug.h
Refactor adding types in SL::Parser
[libs/gl.git] / source / glsl / debug.h
index 3837c569bb18e13aacf3d02a9d1d58eadecd5cb0..5b2a3d96594460459d34783a93545e22dc23cb01 100644 (file)
@@ -32,29 +32,49 @@ private:
                Branch(Node *n): node(n) { }
        };
 
+       struct Colors
+       {
+               const char *default_color;
+               const char *tree_color;
+               const char *location_color;
+               const char *label_color;
+               const char *type_color;
+               const char *name_color;
+               const char *error_color;
+       };
+
        std::map<const Node *, unsigned> node_labels;
        std::string formatted;
        std::vector<TreeChars> tree;
+       const Colors &colors;
+
+       static const Colors no_colors;
+       static const Colors default_colors;
 
 public:
-       const std::string &apply(Stage &);
+       DumpTree(bool = false);
+
+       std::string apply(Stage &);
+       std::string apply(Node &n) { n.visit(*this); return formatted; }
 
 private:
        void append(const std::string &);
+       void append(const Node &, const std::string &);
        void append_subtree(const std::vector<Branch> &);
+       void append_subtree(Node &);
        void begin_sub();
        void last_branch();
        void end_sub();
-       void annotated_branch(const std::string &, Node &);
-       unsigned get_label(const Node &);
+       std::string get_label(const Node &);
        std::string format_type(TypeDeclaration *);
+       std::string format_type(const std::string &);
+       std::string format_name(const std::string &);
 
        template<typename T>
        typename T::const_iterator increment(typename T::const_iterator &, const T &);
 
        virtual void visit(Block &);
        virtual void visit(Literal &);
-       virtual void visit(ParenthesizedExpression &);
        virtual void visit(VariableReference &);
        virtual void visit(InterfaceBlockReference &);
        virtual void visit(MemberAccess &);
@@ -62,6 +82,7 @@ private:
        virtual void visit(UnaryExpression &);
        virtual void visit(BinaryExpression &);
        virtual void visit(Assignment &);
+       virtual void visit(TernaryExpression &);
        virtual void visit(FunctionCall &);
        virtual void visit(ExpressionStatement &);
        virtual void visit(Import &);