]> granicus.if.org Git - clang/commitdiff
Patch by Kovarththanan Rajaratnam!
authorTed Kremenek <kremenek@apple.com>
Sun, 31 Aug 2008 16:37:56 +0000 (16:37 +0000)
committerTed Kremenek <kremenek@apple.com>
Sun, 31 Aug 2008 16:37:56 +0000 (16:37 +0000)
"This minor patch adds markup of string literals with a red colour."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/HTMLRewrite.cpp

index f86f29d5b92e3ce1e2764793557404bb5dc52cd2..43c04793f0855734ab1564722f6d64b01c50b0ea 100644 (file)
@@ -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,
                      "<span class='comment'>", "</span>");
       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,
+                     "<span class='string_literal'>", "</span>");
+      break;
     case tok::hash: {
       // If this is a preprocessor directive, all tokens to end of line are too.
       if (!Tok.isAtStartOfLine())