X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foutput.h;h=aec63721d080c47ea6e28f5f1d2f0e4dedd8ff5b;hb=12342e01c014137b72546c1e3a54181063e69415;hp=06bb5fd18f7069001b0275e29cc2d7986d40b0a5;hpb=1fa69bb8eec3070f5da296d6dd0bd67aea62d3bf;p=libs%2Fgl.git diff --git a/source/glsl/output.h b/source/glsl/output.h index 06bb5fd1..aec63721 100644 --- a/source/glsl/output.h +++ b/source/glsl/output.h @@ -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,10 +9,11 @@ namespace Msp { namespace GL { namespace SL { -class Formatter: public TraversingVisitor +class Formatter: private TraversingVisitor { private: Stage *stage; + Compiler::Mode mode; std::string formatted; unsigned source_index; unsigned source_line; @@ -22,14 +24,14 @@ private: public: Formatter(); - const std::string &apply(Stage &); + const std::string &apply(Stage &, Compiler::Mode); + const std::string &apply(Node &n) { n.visit(*this); return formatted; } private: void append(const std::string &); void append(char); void set_source(unsigned, unsigned); -public: - using TraversingVisitor::visit; + virtual void visit(Block &); virtual void visit(Literal &); virtual void visit(ParenthesizedExpression &); @@ -52,6 +54,7 @@ public: virtual void visit(Iteration &); virtual void visit(Return &); virtual void visit(Jump &); + using TraversingVisitor::visit; }; } // namespace SL