diff trunk/src/cmd/Generate.d @ 388:ae154eceba65

Applied some fixes to scanning and printing #line tokens. Fix: Token.line_num can be null which could cause a segfault in printToken(). Renamed MID.ExpectedNumberAfterSTLine to ExpectedIntegerAfterSTLine. Fix: Added a check for TOK.Int32 and TOK.Uint32 after a number was scanned in scanSpecialTokenSequence().
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Wed, 12 Sep 2007 13:43:45 +0200
parents a92f7826a4fa
children c4bfceab7246
line wrap: on
line diff
--- a/trunk/src/cmd/Generate.d	Wed Sep 12 12:04:21 2007 +0200
+++ b/trunk/src/cmd/Generate.d	Wed Sep 12 13:43:45 2007 +0200
@@ -169,7 +169,7 @@
   // Keyword
   `<span class="k">%s</span>`,
   // HLineBegin
-  `<span class="hl">#line`,
+  `<span class="hl">`,
   // HLineEnd
   "</span>",
   // Filespec
@@ -232,7 +232,7 @@
   // Keyword
   "<k>%s</k>",
   // HLineBegin
-  "<hl>#line",
+  "<hl>",
   // HLineEnd
   "</hl>",
   // Filespec
@@ -475,9 +475,15 @@
     }
     writef(tags[DP.HLineBegin]);
     auto num = token.line_num;
+    if (num is null)
+    {
+      writef(token.start[0 .. token.end - token.start]);
+      writef(tags[DP.HLineEnd]);
+      break;
+    }
     // Print whitespace between #line and number
-    auto ptr = token.start + "#line".length;
-    printWS(ptr, num.start);
+    auto ptr = token.start;
+    printWS(ptr, num.start); // prints "#line" as well
     printToken(num, tags);
     if (token.line_filespec)
     {