Skip to content
Snippets Groups Projects
Commit 4bd8b477 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Show the token only in leaf nodes.

parent 21b26a79
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment