Improved the pretty printing of enum specifiers and if-else statements.

This commit is contained in:
Roberto Raggi
2009-01-07 10:33:19 +01:00
parent fb0d60ae66
commit 0030f87e9c
2 changed files with 25 additions and 7 deletions

View File

@@ -453,11 +453,20 @@ bool PrettyPrinter::visit(EnumSpecifierAST *ast)
out << ' ';
accept(ast->name);
}
out << ' ';
out << '{';
for (EnumeratorAST *it = ast->enumerators; it; it = it->next) {
accept(it);
if (it->next)
out << ", ";
if (ast->enumerators) {
indent();
newline();
for (EnumeratorAST *it = ast->enumerators; it; it = it->next) {
accept(it);
if (it->next) {
out << ", ";
newline();
}
}
deindent();
newline();
}
out << '}';
return false;
@@ -599,9 +608,10 @@ bool PrettyPrinter::visit(IfStatementAST *ast)
out << '(';
accept(ast->condition);
out << ')';
if (ast->statement->asCompoundStatement())
if (ast->statement->asCompoundStatement()) {
out << ' ';
accept(ast->statement);
else {
} else {
indent();
newline();
accept(ast->statement);