]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.h
Add a new associativity type for fully associative operators
[libs/gl.git] / source / glsl / syntax.h
index e7c642ba4abe0c9f4b2d8b91b065a85e499f0362..0821ee5fe97c8780f836b0ce75f562c939de8d10 100644 (file)
@@ -30,7 +30,8 @@ struct Operator
        enum Associativity
        {
                LEFT_TO_RIGHT,
-               RIGHT_TO_LEFT
+               RIGHT_TO_LEFT,
+               ASSOCIATIVE
        };
 
        char token[4];
@@ -39,6 +40,8 @@ struct Operator
        Associativity assoc;
 
        static const Operator operators[];
+
+       static const Operator &get_operator(const std::string &, Type);
 };
 
 enum
@@ -127,6 +130,10 @@ struct Block: Node
 
 struct Expression: Node
 {
+       const Operator *oper;
+
+       Expression();
+
        virtual Expression *clone() const = 0;
 };
 
@@ -188,11 +195,7 @@ struct MemberAccess: Expression
 
 struct UnaryExpression: Expression
 {
-       std::string oper;
        NodePtr<Expression> expression;
-       bool prefix;
-
-       UnaryExpression();
 
        virtual UnaryExpression *clone() const { return new UnaryExpression(*this); }
        virtual void visit(NodeVisitor &);
@@ -201,9 +204,7 @@ struct UnaryExpression: Expression
 struct BinaryExpression: Expression
 {
        NodePtr<Expression> left;
-       std::string oper;
        NodePtr<Expression> right;
-       std::string after;
 
        virtual BinaryExpression *clone() const { return new BinaryExpression(*this); }
        virtual void visit(NodeVisitor &);