]> git.tdb.fi Git - libs/gl.git/blobdiff - source/programsyntax.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / programsyntax.h
diff --git a/source/programsyntax.h b/source/programsyntax.h
deleted file mode 100644 (file)
index 8f72a0b..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-#ifndef MSP_GL_PROGRAMSYNTAX_H_
-#define MSP_GL_PROGRAMSYNTAX_H_
-
-#include <list>
-#include <map>
-#include <string>
-#include <vector>
-
-namespace Msp {
-namespace GL {
-namespace ProgramSyntax {
-
-struct NodeVisitor;
-
-struct Node
-{
-private:
-       Node &operator=(const Node &);
-public:
-       virtual ~Node() { }
-
-       virtual Node *clone() const = 0;
-       virtual void visit(NodeVisitor &) = 0;
-};
-
-template<typename T>
-class NodePtr
-{
-private:
-       T *node;
-
-public:
-       NodePtr(T *n = 0): node(n) { }
-       NodePtr(const NodePtr &p): node(clone(p.node)) { }
-       NodePtr &operator=(const NodePtr &p) { delete node; node = clone(p.node); return *this; }
-       ~NodePtr() { delete node; }
-
-private:
-       static T *clone(T *n) { return n ? n->clone() : 0; }
-
-public:
-       T *operator->() { return node; }
-       const T *operator->() const { return node; }
-       operator void *() const { return node; }
-};
-
-struct VariableDeclaration;
-
-struct Block: Node
-{
-       std::list<NodePtr<Node> > body;
-       bool use_braces;
-
-       Block();
-
-       virtual Block *clone() const { return new Block(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct Expression: Node
-{
-       virtual Expression *clone() const = 0;
-};
-
-struct Literal: Expression
-{
-       std::string token;
-
-       virtual Literal *clone() const { return new Literal(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct ParenthesizedExpression: Expression
-{
-       NodePtr<Expression> expression;
-
-       virtual ParenthesizedExpression *clone() const { return new ParenthesizedExpression(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct VariableReference: Expression
-{
-       std::string name;
-
-       virtual VariableReference *clone() const { return new VariableReference(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct MemberAccess: Expression
-{
-       NodePtr<Expression> left;
-       std::string member;
-
-       virtual MemberAccess *clone() const { return new MemberAccess(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct UnaryExpression: Expression
-{
-       std::string oper;
-       NodePtr<Expression> expression;
-       bool prefix;
-
-       UnaryExpression();
-
-       virtual UnaryExpression *clone() const { return new UnaryExpression(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct BinaryExpression: Expression
-{
-       NodePtr<Expression> left;
-       std::string oper;
-       NodePtr<Expression> right;
-       std::string after;
-       bool assignment;
-
-       BinaryExpression();
-
-       virtual BinaryExpression *clone() const { return new BinaryExpression(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct FunctionCall: Expression
-{
-       std::string name;
-       bool constructor;
-       std::vector<NodePtr<Expression> > arguments;
-
-       FunctionCall();
-
-       virtual FunctionCall *clone() const { return new FunctionCall(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct ExpressionStatement: Node
-{
-       NodePtr<Expression> expression;
-
-       virtual ExpressionStatement *clone() const { return new ExpressionStatement(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct Layout: Node
-{
-       struct Qualifier
-       {
-               std::string identifier;
-               std::string value;
-       };
-
-       std::vector<Qualifier> qualifiers;
-       std::string interface;
-
-       virtual Layout *clone() const { return new Layout(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct StructDeclaration: Node
-{
-       std::string name;
-       Block members;
-
-       StructDeclaration();
-
-       virtual StructDeclaration *clone() const { return new StructDeclaration(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct VariableDeclaration: Node
-{
-       bool constant;
-       std::string sampling;
-       std::string interface;
-       std::string type;
-       std::string name;
-       bool array;
-       NodePtr<Expression> array_size;
-       NodePtr<Expression> init_expression;
-
-       VariableDeclaration();
-
-       virtual VariableDeclaration *clone() const { return new VariableDeclaration(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct InterfaceBlock: Node
-{
-       std::string interface;
-       std::string name;
-       Block members;
-
-       InterfaceBlock();
-
-       virtual InterfaceBlock *clone() const { return new InterfaceBlock(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct FunctionDeclaration: Node
-{
-       std::string return_type;
-       std::string name;
-       std::vector<NodePtr<VariableDeclaration> > parameters;
-       bool definition;
-       Block body;
-
-       FunctionDeclaration();
-
-       virtual FunctionDeclaration *clone() const { return new FunctionDeclaration(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct Conditional: Node
-{
-       Expression *condition;
-       Block body;
-       Block else_body;
-
-       virtual Conditional *clone() const { return new Conditional(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct Iteration: Node
-{
-       NodePtr<Node> init_statement;
-       NodePtr<Expression> condition;
-       NodePtr<Expression> loop_expression;
-       Block body;
-
-       virtual Iteration *clone() const { return new Iteration(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct Return: Node
-{
-       NodePtr<Expression> expression;
-
-       virtual Return *clone() const { return new Return(*this); }
-       virtual void visit(NodeVisitor &);
-};
-
-struct NodeVisitor
-{
-       virtual ~NodeVisitor() { }
-
-       virtual void visit(Block &) { }
-       virtual void visit(Literal &) { }
-       virtual void visit(ParenthesizedExpression &) { }
-       virtual void visit(VariableReference &) { }
-       virtual void visit(MemberAccess &) { }
-       virtual void visit(UnaryExpression &) { }
-       virtual void visit(BinaryExpression &) { }
-       virtual void visit(FunctionCall &) { }
-       virtual void visit(ExpressionStatement &) { }
-       virtual void visit(Layout &) { }
-       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(Return &) { }
-};
-
-enum ContextType
-{
-       GLOBAL,
-       VERTEX,
-       GEOMETRY,
-       FRAGMENT
-};
-
-struct Context
-{
-       ContextType type;
-       bool present;
-       ProgramSyntax::Block content;
-
-       Context(ContextType);
-};
-
-struct Module
-{
-       Context global_context;
-       Context vertex_context;
-       Context geometry_context;
-       Context fragment_context;
-       std::map<std::string, StructDeclaration *> structs;
-
-       Module();
-};
-
-} // namespace ProgramSyntax
-} // namespace GL
-} // namespace Msp
-
-#endif