keep comments in actions; they may be significant (for lint)

This commit is contained in:
ceriel 1990-08-07 10:48:02 +00:00
parent 17158641e0
commit 4a34358b6a
2 changed files with 7 additions and 4 deletions

View file

@ -589,6 +589,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
ch = input(); ch = input();
unput(ch); unput(ch);
if (ch == '*') { if (ch == '*') {
putc('/', f);
skipcomment(1); skipcomment(1);
continue; continue;
} }

View file

@ -240,20 +240,22 @@ unput(c) {
skipcomment(flag) { skipcomment(flag) {
/* /*
* Skip comment. If flag != 0, the comment is inside a fragment * 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 * of C-code, so keep it.
* C-compiler to keep a correct line count
*/ */
register int ch; register int ch;
int saved; /* line count on which comment starts */ int saved; /* line count on which comment starts */
saved = linecount; saved = linecount;
if (input() != '*') error(linecount,"Illegal comment"); if (input() != '*') error(linecount,"Illegal comment");
if (flag) putc('*', fact);
do { do {
ch = input(); ch = input();
if (flag) putc(ch, fact);
while (ch == '*') { 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); } while (ch != EOF);
error(saved,"Comment does not terminate"); error(saved,"Comment does not terminate");
} }