From 4bd8b4772b3a136a9a1683423245b0fd4f2ca77c Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Mon, 8 Mar 2010 12:21:42 +0100 Subject: [PATCH] Show the token only in leaf nodes. --- tests/manual/cplusplus-dump/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/manual/cplusplus-dump/main.cpp b/tests/manual/cplusplus-dump/main.cpp index dfd80b6b403..273a741aee9 100644 --- a/tests/manual/cplusplus-dump/main.cpp +++ b/tests/manual/cplusplus-dump/main.cpp @@ -64,6 +64,7 @@ public: void operator()(AST *ast) { std::cout << "digraph AST {" << std::endl; + // std::cout << "rankdir = \"LR\";" << std::endl; accept(ast); std::cout << "}" << std::endl; } @@ -73,9 +74,12 @@ protected: QByteArray name = abi::__cxa_demangle(typeid(*ast).name(), 0, 0, 0) + 11; name.truncate(name.length() - 3); name = QByteArray::number(_id.value(ast)) + ". " + name; - const char *x = spell(ast->firstToken()); - name += ' '; - name += x; + + if (ast->lastToken() - ast->firstToken() == 1) { + const char *x = spell(ast->firstToken()); + name += ' '; + name += x; + } name.prepend('"'); name.append('"'); @@ -95,7 +99,7 @@ protected: return true; } - virtual void postVisit(AST *ast) { + virtual void postVisit(AST *) { _stack.removeLast(); } -- GitLab