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():
81 Block::Block(const Block &other):
84 use_braces(other.use_braces),
85 anonymous(other.anonymous),
89 void Block::visit(NodeVisitor &visitor)
95 void Literal::visit(NodeVisitor &visitor)
101 void ParenthesizedExpression::visit(NodeVisitor &visitor)
103 visitor.visit(*this);
107 VariableReference::VariableReference():
111 VariableReference::VariableReference(const VariableReference &other):
116 void VariableReference::visit(NodeVisitor &visitor)
118 visitor.visit(*this);
122 MemberAccess::MemberAccess():
126 MemberAccess::MemberAccess(const MemberAccess &other):
128 member(other.member),
132 void MemberAccess::visit(NodeVisitor &visitor)
134 visitor.visit(*this);
138 UnaryExpression::UnaryExpression():
142 void UnaryExpression::visit(NodeVisitor &visitor)
144 visitor.visit(*this);
148 void BinaryExpression::visit(NodeVisitor &visitor)
150 visitor.visit(*this);
154 Assignment::Assignment():
155 self_referencing(false),
156 target_declaration(0)
159 Assignment::Assignment(const Assignment &other):
160 self_referencing(other.self_referencing),
161 target_declaration(0)
164 void Assignment::visit(NodeVisitor &visitor)
166 visitor.visit(*this);
170 FunctionCall::FunctionCall():
175 FunctionCall::FunctionCall(const FunctionCall &other):
178 constructor(other.constructor),
179 arguments(other.arguments)
182 void FunctionCall::visit(NodeVisitor &visitor)
184 visitor.visit(*this);
188 void ExpressionStatement::visit(NodeVisitor &visitor)
190 visitor.visit(*this);
194 void Import::visit(NodeVisitor &visitor)
196 visitor.visit(*this);
200 void Precision::visit(NodeVisitor &visitor)
202 visitor.visit(*this);
206 void Layout::visit(NodeVisitor &visitor)
208 visitor.visit(*this);
212 void InterfaceLayout::visit(NodeVisitor &visitor)
214 visitor.visit(*this);
218 StructDeclaration::StructDeclaration()
220 members.use_braces = true;
223 void StructDeclaration::visit(NodeVisitor &visitor)
225 visitor.visit(*this);
229 VariableDeclaration::VariableDeclaration():
233 linked_declaration(0)
236 VariableDeclaration::VariableDeclaration(const VariableDeclaration &other):
237 constant(other.constant),
238 sampling(other.sampling),
239 interpolation(other.interpolation),
240 interface(other.interface),
241 precision(other.precision),
246 array_size(other.array_size),
247 init_expression(other.init_expression),
248 linked_declaration(0),
252 void VariableDeclaration::visit(NodeVisitor &visitor)
254 visitor.visit(*this);
258 InterfaceBlock::InterfaceBlock():
261 members.use_braces = true;
264 void InterfaceBlock::visit(NodeVisitor &visitor)
266 visitor.visit(*this);
270 FunctionDeclaration::FunctionDeclaration():
274 FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other):
275 return_type(other.return_type),
277 parameters(other.parameters),
278 definition(other.definition==&other ? this : 0),
282 void FunctionDeclaration::visit(NodeVisitor &visitor)
284 visitor.visit(*this);
288 void Conditional::visit(NodeVisitor &visitor)
290 visitor.visit(*this);
294 void Iteration::visit(NodeVisitor &visitor)
296 visitor.visit(*this);
300 void Passthrough::visit(NodeVisitor &visitor)
302 visitor.visit(*this);
306 void Return::visit(NodeVisitor &visitor)
308 visitor.visit(*this);
312 void Jump::visit(NodeVisitor &visitor)
314 visitor.visit(*this);
318 Stage::Stage(Stage::Type t):
323 const char *Stage::get_stage_name(Type type)
325 static const char *names[] = { "shared", "vertex", "geometry", "fragment" };
331 shared(Stage::SHARED)