annotate generator/parser/visitor.h @ 1:e78566595089

initial import
author mandel
date Mon, 11 May 2009 16:01:50 +0000
parents
children 09a0f1d048f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
e78566595089 initial import
mandel
parents:
diff changeset
1 /****************************************************************************
e78566595089 initial import
mandel
parents:
diff changeset
2 **
e78566595089 initial import
mandel
parents:
diff changeset
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved.
e78566595089 initial import
mandel
parents:
diff changeset
4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
e78566595089 initial import
mandel
parents:
diff changeset
5 **
e78566595089 initial import
mandel
parents:
diff changeset
6 ** This file is part of Qt Jambi.
e78566595089 initial import
mandel
parents:
diff changeset
7 **
e78566595089 initial import
mandel
parents:
diff changeset
8 ** * Commercial Usage
e78566595089 initial import
mandel
parents:
diff changeset
9 * Licensees holding valid Qt Commercial licenses may use this file in
e78566595089 initial import
mandel
parents:
diff changeset
10 * accordance with the Qt Commercial License Agreement provided with the
e78566595089 initial import
mandel
parents:
diff changeset
11 * Software or, alternatively, in accordance with the terms contained in
e78566595089 initial import
mandel
parents:
diff changeset
12 * a written agreement between you and Nokia.
e78566595089 initial import
mandel
parents:
diff changeset
13 *
e78566595089 initial import
mandel
parents:
diff changeset
14 *
e78566595089 initial import
mandel
parents:
diff changeset
15 * GNU General Public License Usage
e78566595089 initial import
mandel
parents:
diff changeset
16 * Alternatively, this file may be used under the terms of the GNU
e78566595089 initial import
mandel
parents:
diff changeset
17 * General Public License versions 2.0 or 3.0 as published by the Free
e78566595089 initial import
mandel
parents:
diff changeset
18 * Software Foundation and appearing in the file LICENSE.GPL included in
e78566595089 initial import
mandel
parents:
diff changeset
19 * the packaging of this file. Please review the following information
e78566595089 initial import
mandel
parents:
diff changeset
20 * to ensure GNU General Public Licensing requirements will be met:
e78566595089 initial import
mandel
parents:
diff changeset
21 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
e78566595089 initial import
mandel
parents:
diff changeset
22 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special
e78566595089 initial import
mandel
parents:
diff changeset
23 * exception, Nokia gives you certain additional rights. These rights
e78566595089 initial import
mandel
parents:
diff changeset
24 * are described in the Nokia Qt GPL Exception version 1.2, included in
e78566595089 initial import
mandel
parents:
diff changeset
25 * the file GPL_EXCEPTION.txt in this package.
e78566595089 initial import
mandel
parents:
diff changeset
26 *
e78566595089 initial import
mandel
parents:
diff changeset
27 * Qt for Windows(R) Licensees
e78566595089 initial import
mandel
parents:
diff changeset
28 * As a special exception, Nokia, as the sole copyright holder for Qt
e78566595089 initial import
mandel
parents:
diff changeset
29 * Designer, grants users of the Qt/Eclipse Integration plug-in the
e78566595089 initial import
mandel
parents:
diff changeset
30 * right for the Qt/Eclipse Integration to link to functionality
e78566595089 initial import
mandel
parents:
diff changeset
31 * provided by Qt Designer and its related libraries.
e78566595089 initial import
mandel
parents:
diff changeset
32 *
e78566595089 initial import
mandel
parents:
diff changeset
33 *
e78566595089 initial import
mandel
parents:
diff changeset
34 * If you are unsure which license is appropriate for your use, please
e78566595089 initial import
mandel
parents:
diff changeset
35 * contact the sales department at qt-sales@nokia.com.
e78566595089 initial import
mandel
parents:
diff changeset
36
e78566595089 initial import
mandel
parents:
diff changeset
37 **
e78566595089 initial import
mandel
parents:
diff changeset
38 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
e78566595089 initial import
mandel
parents:
diff changeset
39 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
e78566595089 initial import
mandel
parents:
diff changeset
40 **
e78566595089 initial import
mandel
parents:
diff changeset
41 ****************************************************************************/
e78566595089 initial import
mandel
parents:
diff changeset
42
e78566595089 initial import
mandel
parents:
diff changeset
43
e78566595089 initial import
mandel
parents:
diff changeset
44 #ifndef VISITOR_H
e78566595089 initial import
mandel
parents:
diff changeset
45 #define VISITOR_H
e78566595089 initial import
mandel
parents:
diff changeset
46
e78566595089 initial import
mandel
parents:
diff changeset
47 #include "ast.h"
e78566595089 initial import
mandel
parents:
diff changeset
48
e78566595089 initial import
mandel
parents:
diff changeset
49 class Visitor
e78566595089 initial import
mandel
parents:
diff changeset
50 {
e78566595089 initial import
mandel
parents:
diff changeset
51 public:
e78566595089 initial import
mandel
parents:
diff changeset
52 Visitor();
e78566595089 initial import
mandel
parents:
diff changeset
53 virtual ~Visitor();
e78566595089 initial import
mandel
parents:
diff changeset
54
e78566595089 initial import
mandel
parents:
diff changeset
55 virtual void visit(AST *node);
e78566595089 initial import
mandel
parents:
diff changeset
56
e78566595089 initial import
mandel
parents:
diff changeset
57 protected:
e78566595089 initial import
mandel
parents:
diff changeset
58 virtual void visitAccessSpecifier(AccessSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
59 virtual void visitAsmDefinition(AsmDefinitionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
60 virtual void visitBaseClause(BaseClauseAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
61 virtual void visitBaseSpecifier(BaseSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
62 virtual void visitBinaryExpression(BinaryExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
63 virtual void visitCastExpression(CastExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
64 virtual void visitClassMemberAccess(ClassMemberAccessAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
65 virtual void visitClassSpecifier(ClassSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
66 virtual void visitCompoundStatement(CompoundStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
67 virtual void visitCondition(ConditionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
68 virtual void visitConditionalExpression(ConditionalExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
69 virtual void visitCppCastExpression(CppCastExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
70 virtual void visitCtorInitializer(CtorInitializerAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
71 virtual void visitDeclarationStatement(DeclarationStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
72 virtual void visitDeclarator(DeclaratorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
73 virtual void visitDeleteExpression(DeleteExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
74 virtual void visitDoStatement(DoStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
75 virtual void visitElaboratedTypeSpecifier(ElaboratedTypeSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
76 virtual void visitEnumSpecifier(EnumSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
77 virtual void visitEnumerator(EnumeratorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
78 virtual void visitExceptionSpecification(ExceptionSpecificationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
79 virtual void visitExpressionOrDeclarationStatement(ExpressionOrDeclarationStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
80 virtual void visitExpressionStatement(ExpressionStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
81 virtual void visitForStatement(ForStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
82 virtual void visitFunctionCall(FunctionCallAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
83 virtual void visitFunctionDefinition(FunctionDefinitionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
84 virtual void visitIfStatement(IfStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
85 virtual void visitIncrDecrExpression(IncrDecrExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
86 virtual void visitInitDeclarator(InitDeclaratorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
87 virtual void visitInitializer(InitializerAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
88 virtual void visitInitializerClause(InitializerClauseAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
89 virtual void visitLabeledStatement(LabeledStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
90 virtual void visitLinkageBody(LinkageBodyAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
91 virtual void visitLinkageSpecification(LinkageSpecificationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
92 virtual void visitMemInitializer(MemInitializerAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
93 virtual void visitName(NameAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
94 virtual void visitNamespace(NamespaceAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
95 virtual void visitNamespaceAliasDefinition(NamespaceAliasDefinitionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
96 virtual void visitNewDeclarator(NewDeclaratorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
97 virtual void visitNewExpression(NewExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
98 virtual void visitNewInitializer(NewInitializerAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
99 virtual void visitNewTypeId(NewTypeIdAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
100 virtual void visitOperator(OperatorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
101 virtual void visitOperatorFunctionId(OperatorFunctionIdAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
102 virtual void visitParameterDeclaration(ParameterDeclarationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
103 virtual void visitParameterDeclarationClause(ParameterDeclarationClauseAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
104 virtual void visitPostfixExpression(PostfixExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
105 virtual void visitPrimaryExpression(PrimaryExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
106 virtual void visitPtrOperator(PtrOperatorAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
107 virtual void visitPtrToMember(PtrToMemberAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
108 virtual void visitReturnStatement(ReturnStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
109 virtual void visitSimpleDeclaration(SimpleDeclarationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
110 virtual void visitSimpleTypeSpecifier(SimpleTypeSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
111 virtual void visitSizeofExpression(SizeofExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
112 virtual void visitStringLiteral(StringLiteralAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
113 virtual void visitSubscriptExpression(SubscriptExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
114 virtual void visitSwitchStatement(SwitchStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
115 virtual void visitTemplateArgument(TemplateArgumentAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
116 virtual void visitTemplateDeclaration(TemplateDeclarationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
117 virtual void visitTemplateParameter(TemplateParameterAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
118 virtual void visitThrowExpression(ThrowExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
119 virtual void visitTranslationUnit(TranslationUnitAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
120 virtual void visitTryBlockStatement(TryBlockStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
121 virtual void visitTypeId(TypeIdAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
122 virtual void visitTypeIdentification(TypeIdentificationAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
123 virtual void visitTypeParameter(TypeParameterAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
124 virtual void visitTypedef(TypedefAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
125 virtual void visitUnaryExpression(UnaryExpressionAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
126 virtual void visitUnqualifiedName(UnqualifiedNameAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
127 virtual void visitUsing(UsingAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
128 virtual void visitUsingDirective(UsingDirectiveAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
129 virtual void visitWhileStatement(WhileStatementAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
130 virtual void visitWinDeclSpec(WinDeclSpecAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
131 virtual void visitQProperty(QPropertyAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
132 virtual void visitForwardDeclarationSpecifier(ForwardDeclarationSpecifierAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
133 virtual void visitQEnums(QEnumsAST *) {}
e78566595089 initial import
mandel
parents:
diff changeset
134
e78566595089 initial import
mandel
parents:
diff changeset
135 private:
e78566595089 initial import
mandel
parents:
diff changeset
136 typedef void (Visitor::*visitor_fun_ptr)(AST *);
e78566595089 initial import
mandel
parents:
diff changeset
137 static visitor_fun_ptr _S_table[];
e78566595089 initial import
mandel
parents:
diff changeset
138 };
e78566595089 initial import
mandel
parents:
diff changeset
139
e78566595089 initial import
mandel
parents:
diff changeset
140 template <class _Tp>
e78566595089 initial import
mandel
parents:
diff changeset
141 void visitNodes(Visitor *v, const ListNode<_Tp> *nodes)
e78566595089 initial import
mandel
parents:
diff changeset
142 {
e78566595089 initial import
mandel
parents:
diff changeset
143 if (!nodes)
e78566595089 initial import
mandel
parents:
diff changeset
144 return;
e78566595089 initial import
mandel
parents:
diff changeset
145
e78566595089 initial import
mandel
parents:
diff changeset
146 const ListNode<_Tp>
e78566595089 initial import
mandel
parents:
diff changeset
147 *it = nodes->toFront(),
e78566595089 initial import
mandel
parents:
diff changeset
148 *end = it;
e78566595089 initial import
mandel
parents:
diff changeset
149
e78566595089 initial import
mandel
parents:
diff changeset
150 do
e78566595089 initial import
mandel
parents:
diff changeset
151 {
e78566595089 initial import
mandel
parents:
diff changeset
152 v->visit(it->element);
e78566595089 initial import
mandel
parents:
diff changeset
153 it = it->next;
e78566595089 initial import
mandel
parents:
diff changeset
154 }
e78566595089 initial import
mandel
parents:
diff changeset
155 while (it != end);
e78566595089 initial import
mandel
parents:
diff changeset
156 }
e78566595089 initial import
mandel
parents:
diff changeset
157
e78566595089 initial import
mandel
parents:
diff changeset
158 #endif // VISITOR_H
e78566595089 initial import
mandel
parents:
diff changeset
159
e78566595089 initial import
mandel
parents:
diff changeset
160 // kate: space-indent on; indent-width 2; replace-tabs on;