]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/output.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / glsl / output.h
index 5b03420223c3f70fb57f7f900f6708e2da5efe39..ec794912adfd55c8d42d49b806bc0ce292be0ecc 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GL_SL_OUTPUT_H_
 #define MSP_GL_SL_OUTPUT_H_
 
+#include "compiler.h"
 #include "syntax.h"
 #include "visitor.h"
 
@@ -8,21 +9,21 @@ namespace Msp {
 namespace GL {
 namespace SL {
 
+/** Formats the syntax tree as GLSL. */
 class Formatter: private TraversingVisitor
 {
 private:
-       Stage *stage;
+       Stage *stage = 0;
        std::string formatted;
-       unsigned source_index;
-       unsigned source_line;
-       unsigned indent;
-       bool parameter_list;
-       std::string block_interface;
+       unsigned source_index = 0;
+       unsigned source_line = 1;
+       unsigned indent = 0;
+       bool parameter_list = false;
+       bool omit_builtin = false;
+       bool r_empty_name = false;
 
 public:
-       Formatter();
-
-       const std::string &apply(Stage &);
+       std::string apply(Stage &);
 
 private:
        void append(const std::string &);
@@ -30,13 +31,15 @@ private:
        void set_source(unsigned, unsigned);
 
        virtual void visit(Block &);
+       void visit_expression(Expression &, const Operator *, bool);
        virtual void visit(Literal &);
-       virtual void visit(ParenthesizedExpression &);
        virtual void visit(VariableReference &);
        virtual void visit(MemberAccess &);
+       virtual void visit(Swizzle &);
        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 &);
@@ -45,13 +48,12 @@ private:
        virtual void visit(InterfaceLayout &);
        virtual void visit(StructDeclaration &);
        virtual void visit(VariableDeclaration &);
-       virtual void visit(InterfaceBlock &);
        virtual void visit(FunctionDeclaration &);
        virtual void visit(Conditional &);
        virtual void visit(Iteration &);
+       virtual void visit(Passthrough &);
        virtual void visit(Return &);
        virtual void visit(Jump &);
-       using TraversingVisitor::visit;
 };
 
 } // namespace SL