Add rpp files
[rpp.git] / src / visitor.cpp
blob8a402bea842b1d2fee4f4e33ee6f88acbef62aad
1 /****************************************************************************
2 **
3 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
4 **
5 ** This file is part of Qt Jambi.
6 **
7 ** ** This file may be used under the terms of the GNU General Public
8 ** License version 2.0 as published by the Free Software Foundation
9 ** and appearing in the file LICENSE.GPL included in the packaging of
10 ** this file. Please review the following information to ensure GNU
11 ** General Public Licensing requirements will be met:
12 ** http://www.trolltech.com/products/qt/opensource.html
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** sales department at sales@trolltech.com.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ****************************************************************************/
25 /* This file is part of KDevelop
26 Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
28 This library is free software; you can redistribute it and/or
29 modify it under the terms of the GNU Library General Public
30 License version 2 as published by the Free Software Foundation.
32 This library is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 Library General Public License for more details.
37 You should have received a copy of the GNU Library General Public License
38 along with this library; see the file COPYING.LIB. If not, write to
39 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
40 Boston, MA 02110-1301, USA.
43 #include "visitor.h"
45 Visitor::visitor_fun_ptr Visitor::_S_table[AST::NODE_KIND_COUNT] = {
47 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitAccessSpecifier),
48 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitAsmDefinition),
49 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitBaseClause),
50 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitBaseSpecifier),
51 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitBinaryExpression),
52 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitCastExpression),
53 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitClassMemberAccess),
54 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitClassSpecifier),
55 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitCompoundStatement),
56 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitCondition),
57 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitConditionalExpression),
58 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitCppCastExpression),
59 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitCtorInitializer),
60 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitDeclarationStatement),
61 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitDeclarator),
62 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitDeleteExpression),
63 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitDoStatement),
64 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitElaboratedTypeSpecifier),
65 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitEnumSpecifier),
66 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitEnumerator),
67 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitExceptionSpecification),
68 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitExpressionOrDeclarationStatement),
69 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitExpressionStatement),
70 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitForStatement),
71 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitFunctionCall),
72 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitFunctionDefinition),
73 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitIfStatement),
74 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitIncrDecrExpression),
75 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitInitDeclarator),
76 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitInitializer),
77 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitInitializerClause),
78 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitLabeledStatement),
79 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitLinkageBody),
80 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitLinkageSpecification),
81 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitMemInitializer),
82 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitName),
83 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNamespace),
84 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNamespaceAliasDefinition),
85 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNewDeclarator),
86 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNewExpression),
87 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNewInitializer),
88 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitNewTypeId),
89 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitOperator),
90 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitOperatorFunctionId),
91 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitParameterDeclaration),
92 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitParameterDeclarationClause),
93 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitPostfixExpression),
94 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitPrimaryExpression),
95 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitPtrOperator),
96 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitPtrToMember),
97 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitReturnStatement),
98 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitSimpleDeclaration),
99 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitSimpleTypeSpecifier),
100 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitSizeofExpression),
101 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitStringLiteral),
102 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitSubscriptExpression),
103 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitSwitchStatement),
104 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTemplateArgument),
105 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTemplateDeclaration),
106 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTemplateParameter),
107 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitThrowExpression),
108 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTranslationUnit),
109 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTryBlockStatement),
110 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTypeId),
111 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTypeIdentification),
112 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTypeParameter),
113 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitTypedef),
114 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitUnaryExpression),
115 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitUnqualifiedName),
116 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitUsing),
117 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitUsingDirective),
118 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitWhileStatement),
119 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitWinDeclSpec),
120 reinterpret_cast<Visitor::visitor_fun_ptr>(&Visitor::visitQProperty)
123 Visitor::Visitor()
127 Visitor::~Visitor()
131 void Visitor::visit(AST *node)
133 if (node)
134 (this->*_S_table[node->kind])(node);
137 // kate: space-indent on; indent-width 2; replace-tabs on;