Changeset View
Changeset View
Standalone View
Standalone View
parser/dumptree.cpp
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #include "dumptree.h" | 20 | #include "dumptree.h" | ||
21 | //#include "lexer.h" | 21 | //#include "lexer.h" | ||
22 | #include "parsesession.h" | 22 | #include "parsesession.h" | ||
23 | #include "javaast.h" | 23 | #include "javaast.h" | ||
24 | #include "kdev-pg-token-stream.h" | 24 | #include "kdev-pg-token-stream.h" | ||
25 | 25 | | |||
26 | #include <QtCore/QString> | 26 | #include <QtCore/QString> | ||
27 | 27 | #include <QDebug> | |||
28 | #include <kdebug.h> | | |||
29 | 28 | | |||
30 | static char const * const names[] = { | 29 | static char const * const names[] = { | ||
31 | "additive_expression", | 30 | "additive_expression", | ||
32 | "additive_expression_rest", | 31 | "additive_expression_rest", | ||
33 | "annotation", | 32 | "annotation", | ||
34 | "annotation_arguments", | 33 | "annotation_arguments", | ||
35 | "annotation_element_array_initializer", | 34 | "annotation_element_array_initializer", | ||
36 | "annotation_element_array_value", | 35 | "annotation_element_array_value", | ||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 176 | { | |||
179 | if( m_parseSession && node ) { | 178 | if( m_parseSession && node ) { | ||
180 | for( qint64 a = node->startToken; a <= node->endToken; a++ ) { | 179 | for( qint64 a = node->startToken; a <= node->endToken; a++ ) { | ||
181 | if( !nodeText.isEmpty() ) | 180 | if( !nodeText.isEmpty() ) | ||
182 | nodeText += ' '; | 181 | nodeText += ' '; | ||
183 | nodeText += m_parseSession->symbol(a); | 182 | nodeText += m_parseSession->symbol(a); | ||
184 | } | 183 | } | ||
185 | } | 184 | } | ||
186 | if (node) { | 185 | if (node) { | ||
187 | kDebug() << QString(indent * 2, ' ').toLatin1().constData() << names[node->kind - 1000] | 186 | qDebug() << QString(indent * 2, ' ').toLatin1().constData() << names[node->kind - 1000] | ||
188 | << "[" << node->startToken << "," << node->endToken << "]" << nodeText << endl; | 187 | << "[" << node->startToken << "," << node->endToken << "]" << nodeText << endl; | ||
189 | } | 188 | } | ||
190 | 189 | | |||
191 | ++indent; | 190 | ++indent; | ||
192 | DefaultVisitor::visitNode(node); | 191 | DefaultVisitor::visitNode(node); | ||
193 | --indent; | 192 | --indent; | ||
194 | 193 | | |||
195 | if (node) { | 194 | if (node) { | ||
196 | kDebug() << QString(indent * 2, ' ').toLatin1().constData() << names[node->kind - 1000]; | 195 | qDebug() << QString(indent * 2, ' ').toLatin1().constData() << names[node->kind - 1000]; | ||
197 | } | 196 | } | ||
198 | } | 197 | } | ||
199 | 198 | | |||
200 | DumpTree::~ DumpTree( ) | 199 | DumpTree::~ DumpTree( ) | ||
201 | { | 200 | { | ||
202 | } | 201 | } | ||
203 | 202 | |