]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/syntax.h
Store a pointer to operator info rather than the token in expressions
[libs/gl.git] / source / glsl / syntax.h
index e7c642ba4abe0c9f4b2d8b91b065a85e499f0362..682a0f5aeeaa2246b01226df25536a23a91d9c7a 100644 (file)
@@ -39,6 +39,8 @@ struct Operator
        Associativity assoc;
 
        static const Operator operators[];
+
+       static const Operator &get_operator(const std::string &, Type);
 };
 
 enum
@@ -127,6 +129,10 @@ struct Block: Node
 
 struct Expression: Node
 {
+       const Operator *oper;
+
+       Expression();
+
        virtual Expression *clone() const = 0;
 };
 
@@ -188,11 +194,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 +203,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 &);