10 const Operator Operator::operators[] =
12 { "[", 2, BINARY, LEFT_TO_RIGHT },
13 { "(", 2, BINARY, LEFT_TO_RIGHT },
14 { ".", 2, BINARY, LEFT_TO_RIGHT },
15 { "++", 2, POSTFIX, LEFT_TO_RIGHT },
16 { "--", 2, POSTFIX, LEFT_TO_RIGHT },
17 { "++", 3, PREFIX, RIGHT_TO_LEFT },
18 { "--", 3, PREFIX, RIGHT_TO_LEFT },
19 { "+", 3, PREFIX, RIGHT_TO_LEFT },
20 { "-", 3, PREFIX, RIGHT_TO_LEFT },
21 { "~", 3, PREFIX, RIGHT_TO_LEFT },
22 { "!", 3, PREFIX, RIGHT_TO_LEFT },
23 { "*", 4, BINARY, LEFT_TO_RIGHT },
24 { "/", 4, BINARY, LEFT_TO_RIGHT },
25 { "%", 4, BINARY, LEFT_TO_RIGHT },
26 { "+", 5, BINARY, LEFT_TO_RIGHT },
27 { "-", 5, BINARY, LEFT_TO_RIGHT },
28 { "<<", 6, BINARY, LEFT_TO_RIGHT },
29 { ">>", 6, BINARY, LEFT_TO_RIGHT },
30 { "<", 7, BINARY, LEFT_TO_RIGHT },
31 { ">", 7, BINARY, LEFT_TO_RIGHT },
32 { "<=", 7, BINARY, LEFT_TO_RIGHT },
33 { ">=", 7, BINARY, LEFT_TO_RIGHT },
34 { "==", 8, BINARY, LEFT_TO_RIGHT },
35 { "!=", 8, BINARY, LEFT_TO_RIGHT },
36 { "&", 9, BINARY, LEFT_TO_RIGHT },
37 { "^", 10, BINARY, LEFT_TO_RIGHT },
38 { "|", 11, BINARY, LEFT_TO_RIGHT },
39 { "&&", 12, BINARY, LEFT_TO_RIGHT },
40 { "^^", 13, BINARY, LEFT_TO_RIGHT },
41 { "||", 14, BINARY, LEFT_TO_RIGHT },
42 { "?", 15, BINARY, RIGHT_TO_LEFT },
43 { ":", 15, BINARY, RIGHT_TO_LEFT },
44 { "=", 16, BINARY, RIGHT_TO_LEFT },
45 { "+=", 16, BINARY, RIGHT_TO_LEFT },
46 { "-=", 16, BINARY, RIGHT_TO_LEFT },
47 { "*=", 16, BINARY, RIGHT_TO_LEFT },
48 { "/=", 16, BINARY, RIGHT_TO_LEFT },
49 { "%=", 16, BINARY, RIGHT_TO_LEFT },
50 { "<<=", 16, BINARY, RIGHT_TO_LEFT },
51 { ">>=", 16, BINARY, RIGHT_TO_LEFT },
52 { "&=", 16, BINARY, RIGHT_TO_LEFT },
53 { "^=", 16, BINARY, RIGHT_TO_LEFT },
54 { "|=", 16, BINARY, RIGHT_TO_LEFT },
55 { ",", 17, BINARY, LEFT_TO_RIGHT },
56 { { 0 }, 18, NO_OPERATOR, LEFT_TO_RIGHT }
61 NodeContainer<C>::NodeContainer(const NodeContainer &c):
64 for(typename C::iterator i=this->begin(); i!=this->end(); ++i)
69 Statement::Statement():
79 void Block::visit(NodeVisitor &visitor)
85 void Literal::visit(NodeVisitor &visitor)
91 void ParenthesizedExpression::visit(NodeVisitor &visitor)
97 VariableReference::VariableReference():
101 void VariableReference::visit(NodeVisitor &visitor)
103 visitor.visit(*this);
107 void MemberAccess::visit(NodeVisitor &visitor)
109 visitor.visit(*this);
113 UnaryExpression::UnaryExpression():
117 void UnaryExpression::visit(NodeVisitor &visitor)
119 visitor.visit(*this);
123 void BinaryExpression::visit(NodeVisitor &visitor)
125 visitor.visit(*this);
129 Assignment::Assignment():
130 self_referencing(false),
131 target_declaration(0)
134 void Assignment::visit(NodeVisitor &visitor)
136 visitor.visit(*this);
140 FunctionCall::FunctionCall():
145 void FunctionCall::visit(NodeVisitor &visitor)
147 visitor.visit(*this);
151 void ExpressionStatement::visit(NodeVisitor &visitor)
153 visitor.visit(*this);
157 void Import::visit(NodeVisitor &visitor)
159 visitor.visit(*this);
163 void Precision::visit(NodeVisitor &visitor)
165 visitor.visit(*this);
169 void Layout::visit(NodeVisitor &visitor)
171 visitor.visit(*this);
175 void InterfaceLayout::visit(NodeVisitor &visitor)
177 visitor.visit(*this);
181 StructDeclaration::StructDeclaration()
183 members.use_braces = true;
186 void StructDeclaration::visit(NodeVisitor &visitor)
188 visitor.visit(*this);
192 VariableDeclaration::VariableDeclaration():
196 linked_declaration(0)
199 void VariableDeclaration::visit(NodeVisitor &visitor)
201 visitor.visit(*this);
205 InterfaceBlock::InterfaceBlock():
208 members.use_braces = true;
211 void InterfaceBlock::visit(NodeVisitor &visitor)
213 visitor.visit(*this);
217 FunctionDeclaration::FunctionDeclaration():
221 FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other):
222 return_type(other.return_type),
224 parameters(other.parameters),
225 definition(other.definition==&other ? this : other.definition),
229 void FunctionDeclaration::visit(NodeVisitor &visitor)
231 visitor.visit(*this);
235 void Conditional::visit(NodeVisitor &visitor)
237 visitor.visit(*this);
241 void Iteration::visit(NodeVisitor &visitor)
243 visitor.visit(*this);
247 void Passthrough::visit(NodeVisitor &visitor)
249 visitor.visit(*this);
253 void Return::visit(NodeVisitor &visitor)
255 visitor.visit(*this);
259 void Jump::visit(NodeVisitor &visitor)
261 visitor.visit(*this);
265 Stage::Stage(Stage::Type t):
270 const char *Stage::get_stage_name(Type type)
272 static const char *names[] = { "shared", "vertex", "geometry", "fragment" };
278 shared(Stage::SHARED)