From afe2a9fe7745d85c3522299723946d9a72b90f63 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sun, 31 Aug 2008 16:37:56 +0000 Subject: [PATCH] Patch by Kovarththanan Rajaratnam! "This minor patch adds markup of string literals with a red colour." llvm-svn: 55589 --- clang/lib/Rewrite/HTMLRewrite.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index f86f29d5b92e..43c04793f085 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -288,6 +288,7 @@ void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID, " .code { line-height: 1.2em }\n" " .comment { color: green; font-style: oblique }\n" " .keyword { color: blue }\n" + " .string_literal { color: red }\n" " .directive { color: darkmagenta }\n" // Macro expansions. " .expansion { display: none; }\n" @@ -378,6 +379,15 @@ void html::SyntaxHighlight(Rewriter &R, unsigned FileID, Preprocessor &PP) { HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart, "", ""); break; + case tok::wide_string_literal: + // Chop off the L prefix + ++TokOffs; + --TokLen; + // FALL THROUGH. + case tok::string_literal: + HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart, + "", ""); + break; case tok::hash: { // If this is a preprocessor directive, all tokens to end of line are too. if (!Tok.isAtStartOfLine())