keep comments in actions; they may be significant (for lint)
authorceriel <none@none>
Tue, 7 Aug 1990 10:48:02 +0000 (10:48 +0000)
committerceriel <none@none>
Tue, 7 Aug 1990 10:48:02 +0000 (10:48 +0000)
util/LLgen/src/LLgen.g
util/LLgen/src/tokens.g

index afa8cc7..c6ba3c9 100644 (file)
@@ -589,6 +589,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
                        ch = input();
                        unput(ch);
                        if (ch == '*') {
+                               putc('/', f);
                                skipcomment(1);
                                continue;
                        }
index 8f1481c..c292969 100644 (file)
@@ -240,20 +240,22 @@ unput(c) {
 skipcomment(flag) {
        /*
         * Skip comment. If flag != 0, the comment is inside a fragment
-        * of C-code, so the newlines in it must be copied to enable the
-        * C-compiler to keep a correct line count
+        * of C-code, so keep it.
         */
        register int    ch;
        int             saved;  /* line count on which comment starts */
 
        saved = linecount;
        if (input() != '*') error(linecount,"Illegal comment");
+       if (flag) putc('*', fact);
        do {
                ch = input();
+               if (flag) putc(ch, fact);
                while (ch == '*') {
-                       if ((ch = input()) == '/') return;
+                       ch = input();
+                       if (flag) putc(ch, fact);
+                       if (ch == '/') return;
                }
-               if (flag && ch == '\n') putc(ch,fact);
        } while (ch != EOF);
        error(saved,"Comment does not terminate");
 }