From 4a34358b6a701cd75f01aac31124e86622081c73 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 7 Aug 1990 10:48:02 +0000 Subject: [PATCH] keep comments in actions; they may be significant (for lint) --- util/LLgen/src/LLgen.g | 1 + util/LLgen/src/tokens.g | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/util/LLgen/src/LLgen.g b/util/LLgen/src/LLgen.g index afa8cc72f..c6ba3c99e 100644 --- a/util/LLgen/src/LLgen.g +++ b/util/LLgen/src/LLgen.g @@ -589,6 +589,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; { ch = input(); unput(ch); if (ch == '*') { + putc('/', f); skipcomment(1); continue; } diff --git a/util/LLgen/src/tokens.g b/util/LLgen/src/tokens.g index 8f1481c35..c2929698b 100644 --- a/util/LLgen/src/tokens.g +++ b/util/LLgen/src/tokens.g @@ -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"); } -- 2.34.1