Mercurial > projects > qtd
annotate generator/parser/dumptree.cpp @ 393:1049b01aebd2
Fixed generator segfaults on OS X 10.6.
Regarding the change to dgenerator.cpp, I am not actually sure if 0 is the correct value to pass, but it seems to work and the code which had been there before was just plain incorrect ? it read past the list boundaries.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Sat, 28 Aug 2010 02:55:55 +0200 |
parents | 09a0f1d048f2 |
children |
rev | line source |
---|---|
1 | 1 /**************************************************************************** |
2 ** | |
52
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
3 ** Copyright (C) 1992-2009 Nokia. All rights reserved. |
1 | 4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org> |
5 ** | |
6 ** This file is part of Qt Jambi. | |
7 ** | |
52
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
8 ** Commercial Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
9 Licensees holding valid Qt Commercial licenses may use this file in |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
10 accordance with the Qt Commercial License Agreement provided with the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
11 Software or, alternatively, in accordance with the terms contained in |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
12 a written agreement between you and Nokia. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
13 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
14 GNU Lesser General Public License Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
15 Alternatively, this file may be used under the terms of the GNU Lesser |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
16 General Public License version 2.1 as published by the Free Software |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
17 Foundation and appearing in the file LICENSE.LGPL included in the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
18 packaging of this file. Please review the following information to |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
19 ensure the GNU Lesser General Public License version 2.1 requirements |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
20 will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
21 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
22 In addition, as a special exception, Nokia gives you certain |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
23 additional rights. These rights are described in the Nokia Qt LGPL |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
24 Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
25 package. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
26 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
27 GNU General Public License Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
28 Alternatively, this file may be used under the terms of the GNU |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
29 General Public License version 3.0 as published by the Free Software |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
30 Foundation and appearing in the file LICENSE.GPL included in the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
31 packaging of this file. Please review the following information to |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
32 ensure the GNU General Public License version 3.0 requirements will be |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
33 met: http://www.gnu.org/copyleft/gpl.html. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
34 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
35 If you are unsure which license is appropriate for your use, please |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
36 contact the sales department at qt-sales@nokia.com. |
1 | 37 |
38 ** | |
39 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | |
40 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
41 ** | |
42 ****************************************************************************/ | |
43 | |
44 | |
45 #include "dumptree.h" | |
46 | |
47 #include <QtCore/QString> | |
48 #include <QtCore/qdebug.h> | |
49 | |
50 static char const * const names[] = { | |
51 0, | |
52 "AccessSpecifier", | |
53 "AsmDefinition", | |
54 "BaseClause", | |
55 "BaseSpecifier", | |
56 "BinaryExpression", | |
57 "CastExpression", | |
58 "ClassMemberAccess", | |
59 "ClassSpecifier", | |
60 "CompoundStatement", | |
61 "Condition", | |
62 "ConditionalExpression", | |
63 "CppCastExpression", | |
64 "CtorInitializer", | |
65 "DeclarationStatement", | |
66 "Declarator", | |
67 "DeleteExpression", | |
68 "DoStatement", | |
69 "ElaboratedTypeSpecifier", | |
70 "EnumSpecifier", | |
71 "Enumerator", | |
72 "ExceptionSpecification", | |
73 "ExpressionOrDeclarationStatement", | |
74 "ExpressionStatement", | |
75 "ForStatement", | |
76 "FunctionCall", | |
77 "FunctionDefinition", | |
78 "IfStatement", | |
79 "IncrDecrExpression", | |
80 "InitDeclarator", | |
81 "Initializer", | |
82 "InitializerClause", | |
83 "LabeledStatement", | |
84 "LinkageBody", | |
85 "LinkageSpecification", | |
86 "MemInitializer", | |
87 "Name", | |
88 "Namespace", | |
89 "NamespaceAliasDefinition", | |
90 "NewDeclarator", | |
91 "NewExpression", | |
92 "NewInitializer", | |
93 "NewTypeId", | |
94 "Operator", | |
95 "OperatorFunctionId", | |
96 "ParameterDeclaration", | |
97 "ParameterDeclarationClause", | |
98 "PostfixExpression", | |
99 "PrimaryExpression", | |
100 "PtrOperator", | |
101 "PtrToMember", | |
102 "ReturnStatement", | |
103 "SimpleDeclaration", | |
104 "SimpleTypeSpecifier", | |
105 "SizeofExpression", | |
106 "StringLiteral", | |
107 "SubscriptExpression", | |
108 "SwitchStatement", | |
109 "TemplateArgument", | |
110 "TemplateDeclaration", | |
111 "TemplateParameter", | |
112 "ThrowExpression", | |
113 "TranslationUnit", | |
114 "TryBlockStatement", | |
115 "TypeId", | |
116 "TypeIdentification", | |
117 "TypeParameter", | |
118 "Typedef", | |
119 "UnaryExpression", | |
120 "UnqualifiedName", | |
121 "Using", | |
122 "UsingDirective", | |
123 "WhileStatement", | |
124 "WinDeclSpec" | |
125 }; | |
126 | |
127 DumpTree::DumpTree() | |
128 { | |
129 } | |
130 | |
131 void DumpTree::visit(AST *node) | |
132 { | |
133 static int indent = 0; | |
134 | |
135 if (node) | |
136 qDebug() << QString(indent * 2, ' ').toLatin1().constData() << names[node->kind] | |
137 << '[' << node->start_token << ", " << node->end_token << ']'; | |
138 | |
139 ++indent; | |
140 DefaultVisitor::visit(node); | |
141 --indent; | |
142 } | |
143 | |
144 // kate: space-indent on; indent-width 2; replace-tabs on; |