X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fsyntax.cpp;h=c8058c4fe9a228b102cbe4792daa83dc3f921f70;hb=e8542d921a07b7391d558cb3349a68f26675f797;hp=c60b33bf5bad26b86d2b0abc53b7ba442b451ce2;hpb=19a24f859cd7fcf581442319499ae24b3e7385a4;p=libs%2Fgl.git diff --git a/source/glsl/syntax.cpp b/source/glsl/syntax.cpp index c60b33bf..c8058c4f 100644 --- a/source/glsl/syntax.cpp +++ b/source/glsl/syntax.cpp @@ -21,10 +21,10 @@ const Operator Operator::operators[] = { "-", 3, PREFIX, RIGHT_TO_LEFT }, { "~", 3, PREFIX, RIGHT_TO_LEFT }, { "!", 3, PREFIX, RIGHT_TO_LEFT }, - { "*", 4, BINARY, LEFT_TO_RIGHT }, + { "*", 4, BINARY, ASSOCIATIVE }, { "/", 4, BINARY, LEFT_TO_RIGHT }, { "%", 4, BINARY, LEFT_TO_RIGHT }, - { "+", 5, BINARY, LEFT_TO_RIGHT }, + { "+", 5, BINARY, ASSOCIATIVE }, { "-", 5, BINARY, LEFT_TO_RIGHT }, { "<<", 6, BINARY, LEFT_TO_RIGHT }, { ">>", 6, BINARY, LEFT_TO_RIGHT }, @@ -34,12 +34,12 @@ const Operator Operator::operators[] = { ">=", 7, BINARY, LEFT_TO_RIGHT }, { "==", 8, BINARY, LEFT_TO_RIGHT }, { "!=", 8, BINARY, LEFT_TO_RIGHT }, - { "&", 9, BINARY, LEFT_TO_RIGHT }, - { "^", 10, BINARY, LEFT_TO_RIGHT }, - { "|", 11, BINARY, LEFT_TO_RIGHT }, - { "&&", 12, BINARY, LEFT_TO_RIGHT }, - { "^^", 13, BINARY, LEFT_TO_RIGHT }, - { "||", 14, BINARY, LEFT_TO_RIGHT }, + { "&", 9, BINARY, ASSOCIATIVE }, + { "^", 10, BINARY, ASSOCIATIVE }, + { "|", 11, BINARY, ASSOCIATIVE }, + { "&&", 12, BINARY, ASSOCIATIVE }, + { "^^", 13, BINARY, ASSOCIATIVE }, + { "||", 14, BINARY, ASSOCIATIVE }, { "?", 15, BINARY, RIGHT_TO_LEFT }, { ":", 15, BINARY, RIGHT_TO_LEFT }, { "=", 16, BINARY, RIGHT_TO_LEFT }, @@ -75,12 +75,6 @@ NodeContainer::NodeContainer(const NodeContainer &c): } -Statement::Statement(): - source(GENERATED_SOURCE), - line(1) -{ } - - Block::Block(): use_braces(false), parent(0) @@ -243,6 +237,39 @@ void InterfaceLayout::visit(NodeVisitor &visitor) } +BasicTypeDeclaration::BasicTypeDeclaration(): + kind(ALIAS), + size(0), + base_type(0) +{ } + +BasicTypeDeclaration::BasicTypeDeclaration(const BasicTypeDeclaration &other): + TypeDeclaration(other), + kind(other.kind), + size(other.size), + base(other.base), + base_type(0) +{ } + +void BasicTypeDeclaration::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + +ImageTypeDeclaration::ImageTypeDeclaration(): + dimensions(TWO), + array(false), + sampled(true), + shadow(false) +{ } + +void ImageTypeDeclaration::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + StructDeclaration::StructDeclaration() { members.use_braces = true; @@ -320,7 +347,8 @@ void InterfaceBlock::visit(NodeVisitor &visitor) FunctionDeclaration::FunctionDeclaration(): - definition(0) + definition(0), + return_type_declaration(0) { } FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other): @@ -329,7 +357,8 @@ FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other): name(other.name), parameters(other.parameters), body(other.body), - definition(other.definition==&other ? this : 0) + definition(other.definition==&other ? this : 0), + return_type_declaration(0) { } void FunctionDeclaration::visit(NodeVisitor &visitor)