Pretty print char ltierals and wide char literals.

This commit is contained in:
Roberto Raggi
2009-01-07 10:49:08 +01:00
parent f63d56a13b
commit 8ec03e6bcd
2 changed files with 21 additions and 1 deletions

View File

@@ -33,6 +33,7 @@
#include "PrettyPrinter.h"
#include "AST.h"
#include "Token.h"
#include <iostream>
#include <string>
#include <cassert>
@@ -813,7 +814,17 @@ bool PrettyPrinter::visit(NewTypeIdAST *ast)
bool PrettyPrinter::visit(NumericLiteralAST *ast)
{
out << spell(ast->token);
switch (tokenKind(ast->token)) {
case T_CHAR_LITERAL:
out << '\'' << spell(ast->token) << '\'';
break;
case T_WIDE_CHAR_LITERAL:
out << "L\'" << spell(ast->token) << '\'';
break;
default:
out << spell(ast->token);
}
return false;
}