blob: 1041d612dd6ab08be22ef14ca7de8fef4076083f [file] [log] [blame]
Ted Kremenek6a340832008-03-18 21:19:49 +00001//== HTMLRewrite.cpp - Translate source code into prettified HTML --*- C++ -*-//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the HTMLRewriter clas, which is used to translate the
11// text of a source file into prettified HTML.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Rewrite/Rewriter.h"
16#include "clang/Rewrite/HTMLRewrite.h"
Chris Lattner3245a0a2008-04-16 06:11:58 +000017#include "clang/Lex/Preprocessor.h"
Ted Kremenek6a340832008-03-18 21:19:49 +000018#include "clang/Basic/SourceManager.h"
Chris Lattner57df3b92008-04-16 04:11:35 +000019#include "llvm/ADT/SmallString.h"
Ted Kremenek6a340832008-03-18 21:19:49 +000020#include "llvm/Support/MemoryBuffer.h"
21#include <sstream>
Ted Kremenek6a340832008-03-18 21:19:49 +000022using namespace clang;
23
Chris Lattner9402b572008-04-16 23:06:45 +000024
Chris Lattner5ef3e2c2008-04-16 22:45:51 +000025/// HighlightRange - Highlight a range in the source code with the specified
26/// start/end tags. B/E must be in the same file. This ensures that
27/// start/end tags are placed at the start/end of each line if the range is
28/// multiline.
29void html::HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
30 const char *StartTag, const char *EndTag) {
31 SourceManager &SM = R.getSourceMgr();
32 B = SM.getLogicalLoc(B);
33 E = SM.getLogicalLoc(E);
34 unsigned FileID = SM.getCanonicalFileID(B);
35 assert(SM.getCanonicalFileID(E) == FileID && "B/E not in the same file!");
36
37 unsigned BOffset = SM.getFullFilePos(B);
38 unsigned EOffset = SM.getFullFilePos(E);
39
40 // Include the whole end token in the range.
41 EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr());
42
43 HighlightRange(R.getEditBuffer(FileID), BOffset, EOffset,
44 SM.getBufferData(FileID).first, StartTag, EndTag);
45}
46
47/// HighlightRange - This is the same as the above method, but takes
48/// decomposed file locations.
49void html::HighlightRange(RewriteBuffer &RB, unsigned B, unsigned E,
50 const char *BufferStart,
51 const char *StartTag, const char *EndTag) {
Chris Lattner9402b572008-04-16 23:06:45 +000052 // Insert the tag at the absolute start/end of the range.
Chris Lattner5ef3e2c2008-04-16 22:45:51 +000053 RB.InsertTextAfter(B, StartTag, strlen(StartTag));
54 RB.InsertTextBefore(E, EndTag, strlen(EndTag));
55
Chris Lattner9402b572008-04-16 23:06:45 +000056 // Scan the range to see if there is a \r or \n. If so, and if the line is
57 // not blank, insert tags on that line as well.
58 bool HadOpenTag = true;
59
60 unsigned LastNonWhiteSpace = B;
61 for (unsigned i = B; i != E; ++i) {
62 switch (BufferStart[i]) {
63 case '\r':
64 case '\n':
65 // Okay, we found a newline in the range. If we have an open tag, we need
66 // to insert a close tag at the first non-whitespace before the newline.
67 if (HadOpenTag)
68 RB.InsertTextBefore(LastNonWhiteSpace+1, EndTag, strlen(EndTag));
69
70 // Instead of inserting an open tag immediately after the newline, we
71 // wait until we see a non-whitespace character. This prevents us from
72 // inserting tags around blank lines, and also allows the open tag to
73 // be put *after* whitespace on a non-blank line.
74 HadOpenTag = false;
75 break;
76 case '\0':
77 case ' ':
78 case '\t':
79 case '\f':
80 case '\v':
81 // Ignore whitespace.
82 break;
83
84 default:
85 // If there is no tag open, do it now.
86 if (!HadOpenTag) {
87 RB.InsertTextAfter(i, StartTag, strlen(StartTag));
88 HadOpenTag = true;
89 }
90
91 // Remember this character.
92 LastNonWhiteSpace = i;
93 break;
94 }
95 }
Chris Lattner5ef3e2c2008-04-16 22:45:51 +000096}
97
Ted Kremenekfa5be362008-04-08 22:37:58 +000098void html::EscapeText(Rewriter& R, unsigned FileID,
99 bool EscapeSpaces, bool ReplaceTabs) {
Ted Kremenek6a340832008-03-18 21:19:49 +0000100
101 const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FileID);
102 const char* C = Buf->getBufferStart();
103 const char* FileEnd = Buf->getBufferEnd();
104
105 assert (C <= FileEnd);
106
Chris Lattner73527142008-04-16 04:33:23 +0000107 RewriteBuffer &RB = R.getEditBuffer(FileID);
108
Ted Kremenek6a340832008-03-18 21:19:49 +0000109 for (unsigned FilePos = 0; C != FileEnd ; ++C, ++FilePos) {
Ted Kremenek49cd6352008-04-03 07:12:29 +0000110
Ted Kremenek6a340832008-03-18 21:19:49 +0000111 switch (*C) {
Chris Lattner73527142008-04-16 04:33:23 +0000112 default: break;
113
114 case ' ':
115 if (EscapeSpaces)
116 RB.ReplaceText(FilePos, 1, "&nbsp;", 6);
117 break;
Ted Kremenek6a340832008-03-18 21:19:49 +0000118
Chris Lattner73527142008-04-16 04:33:23 +0000119 case '\t':
120 if (!ReplaceTabs)
Ted Kremenek49cd6352008-04-03 07:12:29 +0000121 break;
Chris Lattner73527142008-04-16 04:33:23 +0000122 if (EscapeSpaces)
Chris Lattner6f46be22008-04-17 00:40:45 +0000123 RB.ReplaceText(FilePos, 1, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", 6*8);
Chris Lattner73527142008-04-16 04:33:23 +0000124 else
Chris Lattner6f46be22008-04-17 00:40:45 +0000125 RB.ReplaceText(FilePos, 1, " ", 8);
Chris Lattner73527142008-04-16 04:33:23 +0000126 break;
127
128 case '<':
129 RB.ReplaceText(FilePos, 1, "&lt;", 4);
130 break;
131
132 case '>':
133 RB.ReplaceText(FilePos, 1, "&gt;", 4);
134 break;
135
136 case '&':
137 RB.ReplaceText(FilePos, 1, "&amp;", 5);
138 break;
Ted Kremenek6a340832008-03-18 21:19:49 +0000139 }
140 }
141}
142
Ted Kremenekfa5be362008-04-08 22:37:58 +0000143std::string html::EscapeText(const std::string& s, bool EscapeSpaces,
144 bool ReplaceTabs) {
Ted Kremenek053ef592008-03-27 17:15:29 +0000145
146 unsigned len = s.size();
147 std::ostringstream os;
148
149 for (unsigned i = 0 ; i < len; ++i) {
150
151 char c = s[i];
Ted Kremenek053ef592008-03-27 17:15:29 +0000152 switch (c) {
Chris Lattner8570f0b2008-04-16 04:37:29 +0000153 default:
154 os << c; break;
155
156 case ' ':
157 if (EscapeSpaces) os << "&nbsp;";
158 else os << ' ';
159 break;
160
161 case '\t':
162 if (ReplaceTabs)
163 for (unsigned i = 0; i < 4; ++i)
164 os << "&nbsp;";
165 else
166 os << c;
167
Ted Kremenek053ef592008-03-27 17:15:29 +0000168 break;
Chris Lattner8570f0b2008-04-16 04:37:29 +0000169
170 case '<': os << "&lt;"; break;
171 case '>': os << "&gt;"; break;
172 case '&': os << "&amp;"; break;
Ted Kremenek053ef592008-03-27 17:15:29 +0000173 }
174 }
175
176 return os.str();
177}
178
Chris Lattner8570f0b2008-04-16 04:37:29 +0000179static void AddLineNumber(RewriteBuffer &RB, unsigned LineNo,
180 unsigned B, unsigned E) {
Chris Lattner57df3b92008-04-16 04:11:35 +0000181 llvm::SmallString<100> Str;
182 Str += "<tr><td class=\"num\" id=\"LN";
183 Str.append_uint(LineNo);
184 Str += "\">";
185 Str.append_uint(LineNo);
186 Str += "</td><td class=\"line\">";
187
Ted Kremenek49cd6352008-04-03 07:12:29 +0000188 if (B == E) { // Handle empty lines.
Chris Lattner57df3b92008-04-16 04:11:35 +0000189 Str += " </td></tr>";
Chris Lattner8570f0b2008-04-16 04:37:29 +0000190 RB.InsertTextBefore(B, &Str[0], Str.size());
Chris Lattner57df3b92008-04-16 04:11:35 +0000191 } else {
Chris Lattner8570f0b2008-04-16 04:37:29 +0000192 RB.InsertTextBefore(B, &Str[0], Str.size());
193 RB.InsertTextBefore(E, "</td></tr>", strlen("</td></tr>"));
Ted Kremenek49cd6352008-04-03 07:12:29 +0000194 }
Ted Kremenekb485cd12008-03-18 23:08:51 +0000195}
196
197void html::AddLineNumbers(Rewriter& R, unsigned FileID) {
198
199 const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FileID);
200 const char* FileBeg = Buf->getBufferStart();
201 const char* FileEnd = Buf->getBufferEnd();
202 const char* C = FileBeg;
Chris Lattner8570f0b2008-04-16 04:37:29 +0000203 RewriteBuffer &RB = R.getEditBuffer(FileID);
Ted Kremenekb485cd12008-03-18 23:08:51 +0000204
205 assert (C <= FileEnd);
206
207 unsigned LineNo = 0;
208 unsigned FilePos = 0;
209
210 while (C != FileEnd) {
211
212 ++LineNo;
213 unsigned LineStartPos = FilePos;
214 unsigned LineEndPos = FileEnd - FileBeg;
215
216 assert (FilePos <= LineEndPos);
217 assert (C < FileEnd);
218
219 // Scan until the newline (or end-of-file).
220
Ted Kremenek49cd6352008-04-03 07:12:29 +0000221 while (C != FileEnd) {
222 char c = *C;
223 ++C;
224
225 if (c == '\n') {
226 LineEndPos = FilePos++;
Ted Kremenekb485cd12008-03-18 23:08:51 +0000227 break;
228 }
Ted Kremenek49cd6352008-04-03 07:12:29 +0000229
230 ++FilePos;
231 }
Ted Kremenekb485cd12008-03-18 23:08:51 +0000232
Chris Lattner8570f0b2008-04-16 04:37:29 +0000233 AddLineNumber(RB, LineNo, LineStartPos, LineEndPos);
Ted Kremenekd6c13602008-03-19 05:07:26 +0000234 }
235
Chris Lattner8570f0b2008-04-16 04:37:29 +0000236 // Add one big table tag that surrounds all of the code.
237 RB.InsertTextBefore(0, "<table class=\"code\">\n",
238 strlen("<table class=\"code\">\n"));
Ted Kremenekd6c13602008-03-19 05:07:26 +0000239
Chris Lattner8570f0b2008-04-16 04:37:29 +0000240 RB.InsertTextAfter(FileEnd - FileBeg, "</table>", strlen("</table>"));
Ted Kremenekb485cd12008-03-18 23:08:51 +0000241}
Ted Kremenekad0a2032008-03-19 06:14:37 +0000242
243void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID) {
244
245 const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FileID);
246 const char* FileStart = Buf->getBufferStart();
247 const char* FileEnd = Buf->getBufferEnd();
248
249 SourceLocation StartLoc = SourceLocation::getFileLoc(FileID, 0);
250 SourceLocation EndLoc = SourceLocation::getFileLoc(FileID, FileEnd-FileStart);
251
252 // Generate header
Ted Kremenek70bcba62008-04-09 15:40:40 +0000253 R.InsertCStrBefore(StartLoc,
Ted Kremenek07339a62008-04-17 19:57:27 +0000254 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
255 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
256 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"
Ted Kremenek70bcba62008-04-09 15:40:40 +0000257 "<style type=\"text/css\">\n"
258 " body { color:#000000; background-color:#ffffff }\n"
259 " body { font-family:Helvetica, sans-serif; font-size:10pt }\n"
Ted Kremenek4b0f8132008-04-15 21:25:08 +0000260 " h1 { font-size:14pt }\n"
Ted Kremenek70bcba62008-04-09 15:40:40 +0000261 " .code { border-spacing:0px; width:100%; }\n"
262 " .code { font-family: \"Andale Mono\", monospace; font-size:10pt }\n"
263 " .code { line-height: 1.2em }\n"
Chris Lattner5ef3e2c2008-04-16 22:45:51 +0000264 " .comment { color: #A0A0A0; font-style: oblique }\n"
Chris Lattnerc4586c22008-04-16 06:35:07 +0000265 " .keyword { color: #FF00FF }\n"
Chris Lattner5deb96d2008-04-16 23:21:17 +0000266 " .directive { color: #00A000 }\n"
Chris Lattner6f46be22008-04-17 00:40:45 +0000267 // Macro expansions.
Ted Kremenek07339a62008-04-17 19:57:27 +0000268 " .expansion { display: none; }\n"
269 " .macro:hover .expansion { display: block; border: 2px solid #FF0000; "
270 "padding: 2px; background-color:#FFF0F0;"
Chris Lattner6f46be22008-04-17 00:40:45 +0000271 " -webkit-border-radius:5px; -webkit-box-shadow:1px 1px 7px #000; "
272 "position: absolute; top: -1em; left:10em } \n"
273 " .macro { color: #FF0000; background-color:#FFC0C0;"
274 // Macros are position: relative to provide base for expansions.
275 " position: relative }\n"
Ted Kremenek70bcba62008-04-09 15:40:40 +0000276 " .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }\n"
277 " .num { text-align:right; font-size: smaller }\n"
278 " .num { color:#444444 }\n"
279 " .line { padding-left: 1ex; border-left: 3px solid #ccc }\n"
280 " .line { white-space: pre }\n"
281 " .msg { background-color:#fff8b4; color:#000000 }\n"
282 " .msg { -webkit-box-shadow:1px 1px 7px #000 }\n"
283 " .msg { -webkit-border-radius:5px }\n"
284 " .msg { font-family:Helvetica, sans-serif; font-size: smaller }\n"
285 " .msg { font-weight: bold }\n"
286 " .msg { float:left }\n"
287 " .msg { padding:0.5em 1ex 0.5em 1ex }\n"
288 " .msg { margin-top:10px; margin-bottom:10px }\n"
289 " .mrange { background-color:#dfddf3 }\n"
290 " .mrange { border-bottom:1px solid #6F9DBE }\n"
291 " .PathIndex { font-weight: bold }\n"
Ted Kremenek4b0f8132008-04-15 21:25:08 +0000292 " table.simpletable {\n"
293 " padding: 5px;\n"
294 " font-size:12pt;\n"
295 " margin:20px;\n"
296 " border-collapse: collapse; border-spacing: 0px;\n"
297 " }\n"
298 " td.rowname {\n"
299 " text-align:right; font-weight:bold; color:#444444;\n"
300 " padding-right:2ex; }\n"
Ted Kremenek70bcba62008-04-09 15:40:40 +0000301 "</style>\n</head>\n<body>");
302
Ted Kremenekad0a2032008-03-19 06:14:37 +0000303 // Generate footer
304
Ted Kremenek70bcba62008-04-09 15:40:40 +0000305 R.InsertCStrAfter(EndLoc, "</body></html>\n");
Ted Kremenekad0a2032008-03-19 06:14:37 +0000306}
Chris Lattner3245a0a2008-04-16 06:11:58 +0000307
308/// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
309/// information about keywords, macro expansions etc. This uses the macro
310/// table state from the end of the file, so it won't be perfectly perfect,
311/// but it will be reasonably close.
312void html::SyntaxHighlight(Rewriter &R, unsigned FileID, Preprocessor &PP) {
313 RewriteBuffer &RB = R.getEditBuffer(FileID);
314
Chris Lattnera745e8c2008-04-16 20:51:51 +0000315 const SourceManager &SourceMgr = PP.getSourceManager();
316 std::pair<const char*, const char*> File = SourceMgr.getBufferData(FileID);
317 const char *BufferStart = File.first;
318
319 Lexer L(SourceLocation::getFileLoc(FileID, 0), PP.getLangOptions(),
320 File.first, File.second);
321
Chris Lattner3245a0a2008-04-16 06:11:58 +0000322 // Inform the preprocessor that we want to retain comments as tokens, so we
323 // can highlight them.
Chris Lattner678c6352008-04-16 20:54:51 +0000324 L.SetCommentRetentionState(true);
Chris Lattner3245a0a2008-04-16 06:11:58 +0000325
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000326 // Lex all the tokens in raw mode, to avoid entering #includes or expanding
327 // macros.
Chris Lattner3245a0a2008-04-16 06:11:58 +0000328 Token Tok;
Chris Lattnera745e8c2008-04-16 20:51:51 +0000329 L.LexRawToken(Tok);
Chris Lattner74ea3e52008-04-16 06:53:09 +0000330
Chris Lattner74ea3e52008-04-16 06:53:09 +0000331 while (Tok.isNot(tok::eof)) {
332 // Since we are lexing unexpanded tokens, all tokens are from the main
333 // FileID.
334 unsigned TokOffs = SourceMgr.getFullFilePos(Tok.getLocation());
Chris Lattner3245a0a2008-04-16 06:11:58 +0000335 unsigned TokLen = Tok.getLength();
336 switch (Tok.getKind()) {
Chris Lattnera745e8c2008-04-16 20:51:51 +0000337 default: break;
338 case tok::identifier: {
339 // Fill in Result.IdentifierInfo, looking up the identifier in the
340 // identifier table.
341 IdentifierInfo *II = PP.LookUpIdentifierInfo(Tok, BufferStart+TokOffs);
342
343 // If this is a pp-identifier, for a keyword, highlight it as such.
Chris Lattner5ef3e2c2008-04-16 22:45:51 +0000344 if (II->getTokenID() != tok::identifier)
345 HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart,
346 "<span class='keyword'>", "</span>");
Chris Lattnerc4586c22008-04-16 06:35:07 +0000347 break;
Chris Lattnera745e8c2008-04-16 20:51:51 +0000348 }
Chris Lattner3245a0a2008-04-16 06:11:58 +0000349 case tok::comment:
Chris Lattner5ef3e2c2008-04-16 22:45:51 +0000350 HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart,
351 "<span class='comment'>", "</span>");
Chris Lattner3245a0a2008-04-16 06:11:58 +0000352 break;
Chris Lattner5deb96d2008-04-16 23:21:17 +0000353 case tok::hash: {
Chris Lattner74ea3e52008-04-16 06:53:09 +0000354 // If this is a preprocessor directive, all tokens to end of line are too.
Chris Lattner5deb96d2008-04-16 23:21:17 +0000355 if (!Tok.isAtStartOfLine())
356 break;
357
358 // Eat all of the tokens until we get to the next one at the start of
359 // line.
360 unsigned TokEnd = TokOffs+TokLen;
361 L.LexRawToken(Tok);
362 while (!Tok.isAtStartOfLine() && Tok.isNot(tok::eof)) {
363 TokEnd = SourceMgr.getFullFilePos(Tok.getLocation())+Tok.getLength();
364 L.LexRawToken(Tok);
Chris Lattner74ea3e52008-04-16 06:53:09 +0000365 }
Chris Lattner5deb96d2008-04-16 23:21:17 +0000366
367 // Find end of line. This is a hack.
368 HighlightRange(RB, TokOffs, TokEnd, BufferStart,
369 "<span class='directive'>", "</span>");
370
371 // Don't skip the next token.
372 continue;
373 }
Chris Lattner3245a0a2008-04-16 06:11:58 +0000374 }
375
Chris Lattnera745e8c2008-04-16 20:51:51 +0000376 L.LexRawToken(Tok);
Chris Lattner74ea3e52008-04-16 06:53:09 +0000377 }
Chris Lattner3245a0a2008-04-16 06:11:58 +0000378}
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000379
380/// HighlightMacros - This uses the macro table state from the end of the
381/// file, to reexpand macros and insert (into the HTML) information about the
382/// macro expansions. This won't be perfectly perfect, but it will be
383/// reasonably close.
384void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP) {
385 RewriteBuffer &RB = R.getEditBuffer(FileID);
386
387 // Inform the preprocessor that we don't want comments.
388 PP.SetCommentRetentionState(false, false);
389
390 // Start parsing the specified input file.
391 PP.EnterMainSourceFile();
392
393 // Lex all the tokens.
394 const SourceManager &SourceMgr = PP.getSourceManager();
395 Token Tok;
396 PP.Lex(Tok);
397 while (Tok.isNot(tok::eof)) {
398 // Ignore non-macro tokens.
399 if (!Tok.getLocation().isMacroID()) {
400 PP.Lex(Tok);
401 continue;
402 }
403
404 // Ignore tokens whose logical location was not the main file.
405 SourceLocation LLoc = SourceMgr.getLogicalLoc(Tok.getLocation());
406 std::pair<unsigned, unsigned> LLocInfo =
407 SourceMgr.getDecomposedFileLoc(LLoc);
408
409 if (LLocInfo.first != FileID) {
410 PP.Lex(Tok);
411 continue;
412 }
413
414 // Okay, we have the first token of a macro expansion: highlight the
415 // instantiation.
416
417 // Get the size of current macro call itself.
418 // FIXME: This should highlight the args of a function-like
419 // macro, using a heuristic.
420 unsigned TokLen = Lexer::MeasureTokenLength(LLoc, SourceMgr);
421
422 unsigned TokOffs = LLocInfo.second;
Chris Lattner6f46be22008-04-17 00:40:45 +0000423 // Highlight the macro invocation itself.
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000424 RB.InsertTextAfter(TokOffs, "<span class='macro'>",
425 strlen("<span class='macro'>"));
426 RB.InsertTextBefore(TokOffs+TokLen, "</span>", strlen("</span>"));
427
Chris Lattner6f46be22008-04-17 00:40:45 +0000428 std::string Expansion = PP.getSpelling(Tok);
429 unsigned LineLen = Expansion.size();
430
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000431 // Okay, eat this token, getting the next one.
432 PP.Lex(Tok);
433
434 // Skip all the rest of the tokens that are part of this macro
435 // instantiation. It would be really nice to pop up a window with all the
436 // spelling of the tokens or something.
437 while (!Tok.is(tok::eof) &&
Chris Lattner6f46be22008-04-17 00:40:45 +0000438 SourceMgr.getLogicalLoc(Tok.getLocation()) == LLoc) {
439 // Insert a newline if the macro expansion is getting large.
440 if (LineLen > 60) {
441 Expansion += "<br>";
442 LineLen = 0;
443 }
444
445 LineLen -= Expansion.size();
446 Expansion += ' ' + PP.getSpelling(Tok);
447 LineLen += Expansion.size();
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000448 PP.Lex(Tok);
Chris Lattner6f46be22008-04-17 00:40:45 +0000449 }
450
451 // Insert the information about the expansion inside the macro span.
452 Expansion = "<span class='expansion'>" + Expansion + "</span>";
453 RB.InsertTextBefore(TokOffs+TokLen, Expansion.c_str(), Expansion.size());
Chris Lattnerc54d50a2008-04-16 06:32:08 +0000454 }
455}
456
457