1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSG_GLSLASTVISITOR_H
5#define QSSG_GLSLASTVISITOR_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DGlslParser/private/glslast_p.h>
19
20QT_BEGIN_NAMESPACE
21
22namespace GLSL {
23
24class Q_QUICK3DGLSLPARSER_EXPORT Visitor
25{
26public:
27 Visitor();
28 virtual ~Visitor();
29
30 void accept(AST *ast);
31
32 virtual bool preVisit(AST *) { return true; }
33 virtual void postVisit(AST *) {}
34
35 virtual bool visit(TranslationUnitAST *) { return true; }
36 virtual void endVisit(TranslationUnitAST *) {}
37
38 virtual bool visit(IdentifierExpressionAST *) { return true; }
39 virtual void endVisit(IdentifierExpressionAST *) {}
40
41 virtual bool visit(LiteralExpressionAST *) { return true; }
42 virtual void endVisit(LiteralExpressionAST *) {}
43
44 virtual bool visit(BinaryExpressionAST *) { return true; }
45 virtual void endVisit(BinaryExpressionAST *) {}
46
47 virtual bool visit(UnaryExpressionAST *) { return true; }
48 virtual void endVisit(UnaryExpressionAST *) {}
49
50 virtual bool visit(TernaryExpressionAST *) { return true; }
51 virtual void endVisit(TernaryExpressionAST *) {}
52
53 virtual bool visit(AssignmentExpressionAST *) { return true; }
54 virtual void endVisit(AssignmentExpressionAST *) {}
55
56 virtual bool visit(MemberAccessExpressionAST *) { return true; }
57 virtual void endVisit(MemberAccessExpressionAST *) {}
58
59 virtual bool visit(FunctionCallExpressionAST *) { return true; }
60 virtual void endVisit(FunctionCallExpressionAST *) {}
61
62 virtual bool visit(FunctionIdentifierAST *) { return true; }
63 virtual void endVisit(FunctionIdentifierAST *) {}
64
65 virtual bool visit(DeclarationExpressionAST *) { return true; }
66 virtual void endVisit(DeclarationExpressionAST *) {}
67
68 virtual bool visit(ExpressionStatementAST *) { return true; }
69 virtual void endVisit(ExpressionStatementAST *) {}
70
71 virtual bool visit(CompoundStatementAST *) { return true; }
72 virtual void endVisit(CompoundStatementAST *) {}
73
74 virtual bool visit(IfStatementAST *) { return true; }
75 virtual void endVisit(IfStatementAST *) {}
76
77 virtual bool visit(WhileStatementAST *) { return true; }
78 virtual void endVisit(WhileStatementAST *) {}
79
80 virtual bool visit(DoStatementAST *) { return true; }
81 virtual void endVisit(DoStatementAST *) {}
82
83 virtual bool visit(ForStatementAST *) { return true; }
84 virtual void endVisit(ForStatementAST *) {}
85
86 virtual bool visit(JumpStatementAST *) { return true; }
87 virtual void endVisit(JumpStatementAST *) {}
88
89 virtual bool visit(ReturnStatementAST *) { return true; }
90 virtual void endVisit(ReturnStatementAST *) {}
91
92 virtual bool visit(SwitchStatementAST *) { return true; }
93 virtual void endVisit(SwitchStatementAST *) {}
94
95 virtual bool visit(CaseLabelStatementAST *) { return true; }
96 virtual void endVisit(CaseLabelStatementAST *) {}
97
98 virtual bool visit(DeclarationStatementAST *) { return true; }
99 virtual void endVisit(DeclarationStatementAST *) {}
100
101 virtual bool visit(BasicTypeAST *) { return true; }
102 virtual void endVisit(BasicTypeAST *) {}
103
104 virtual bool visit(NamedTypeAST *) { return true; }
105 virtual void endVisit(NamedTypeAST *) {}
106
107 virtual bool visit(ArrayTypeAST *) { return true; }
108 virtual void endVisit(ArrayTypeAST *) {}
109
110 virtual bool visit(StructTypeAST *) { return true; }
111 virtual void endVisit(StructTypeAST *) {}
112
113 virtual bool visit(StructTypeAST::Field *) { return true; }
114 virtual void endVisit(StructTypeAST::Field *) {}
115
116 virtual bool visit(LayoutQualifierAST *) { return true; }
117 virtual void endVisit(LayoutQualifierAST *) {}
118
119 virtual bool visit(QualifiedTypeAST *) { return true; }
120 virtual void endVisit(QualifiedTypeAST *) {}
121
122 virtual bool visit(PrecisionDeclarationAST *) { return true; }
123 virtual void endVisit(PrecisionDeclarationAST *) {}
124
125 virtual bool visit(ParameterDeclarationAST *) { return true; }
126 virtual void endVisit(ParameterDeclarationAST *) {}
127
128 virtual bool visit(VariableDeclarationAST *) { return true; }
129 virtual void endVisit(VariableDeclarationAST *) {}
130
131 virtual bool visit(TypeDeclarationAST *) { return true; }
132 virtual void endVisit(TypeDeclarationAST *) {}
133
134 virtual bool visit(TypeAndVariableDeclarationAST *) { return true; }
135 virtual void endVisit(TypeAndVariableDeclarationAST *) {}
136
137 virtual bool visit(InvariantDeclarationAST *) { return true; }
138 virtual void endVisit(InvariantDeclarationAST *) {}
139
140 virtual bool visit(InitDeclarationAST *) { return true; }
141 virtual void endVisit(InitDeclarationAST *) {}
142
143 virtual bool visit(FunctionDeclarationAST *) { return true; }
144 virtual void endVisit(FunctionDeclarationAST *) {}
145};
146
147} // namespace GLSL
148
149QT_END_NAMESPACE
150
151#endif // QSSG_GLSLASTVISITOR_H
152

source code of qtquick3d/src/glslparser/glslastvisitor_p.h