Fix: prevent unintentional token pasting

This commit is contained in:
ceriel 1994-03-01 15:04:52 +00:00
parent b03e2f6a8b
commit b8b3054bba
2 changed files with 10 additions and 0 deletions

View file

@ -350,6 +350,7 @@ actual(repl)
ch = GetChar(); ch = GetChar();
} while (in_idf(ch)); } while (in_idf(ch));
*p++ = '\0'; *p++ = '\0';
ch = '\0'; /* It could be an unstashed TOKSEP */
UnGetChar(); UnGetChar();
/* When the identifier has an associated macro /* When the identifier has an associated macro
@ -376,6 +377,7 @@ actual(repl)
if (ch == '.') { if (ch == '.') {
ch = GetChar(); ch = GetChar();
if (class(ch) != STNUM) { if (class(ch) != STNUM) {
ch = '\0'; /* It could be an unstashed TOKSEP */
UnGetChar(); UnGetChar();
continue; continue;
} }
@ -393,6 +395,7 @@ actual(repl)
} }
} }
} }
ch = '\0'; /* It could be an unstashed TOKSEP */
UnGetChar(); UnGetChar();
} else if (ch == '(') { } else if (ch == '(') {
/* a comma may occur between parentheses */ /* a comma may occur between parentheses */
@ -455,6 +458,7 @@ a_new_line: ch = GetChar();
} }
if (ch != '/') { if (ch != '/') {
UnGetChar(); UnGetChar();
ch = ' ';
stash(repl, ' ', !nostashraw); stash(repl, ' ', !nostashraw);
} }
} else if (ch == '/') { } else if (ch == '/') {
@ -464,6 +468,7 @@ a_new_line: ch = GetChar();
stash(repl, ' ', !nostashraw); stash(repl, ' ', !nostashraw);
} else { } else {
UnGetChar(); UnGetChar();
ch = '/';
stash(repl, '/', !nostashraw); stash(repl, '/', !nostashraw);
} }
} else if (ch == '\'' || ch == '"') { } else if (ch == '\'' || ch == '"') {

View file

@ -344,6 +344,7 @@ actual(repl)
ch = GetChar(); ch = GetChar();
} while (in_idf(ch)); } while (in_idf(ch));
*p++ = '\0'; *p++ = '\0';
ch = '\0'; /* Could be a non-stashed TOKSEP */
UnGetChar(); UnGetChar();
/* When the identifier has an associated macro /* When the identifier has an associated macro
@ -370,6 +371,7 @@ actual(repl)
if (ch == '.') { if (ch == '.') {
ch = GetChar(); ch = GetChar();
if (class(ch) != STNUM) { if (class(ch) != STNUM) {
ch = '\0'; /* Could be a non-stashed TOKSEP */
UnGetChar(); UnGetChar();
continue; continue;
} }
@ -387,6 +389,7 @@ actual(repl)
} }
} }
} }
ch = '\0'; /* Could be a non-stashed TOKSEP */
UnGetChar(); UnGetChar();
} else if (ch == '(') { } else if (ch == '(') {
/* a comma may occur within parentheses */ /* a comma may occur within parentheses */
@ -445,6 +448,7 @@ a_new_line: ch = GetChar();
} }
if (ch != '/') { if (ch != '/') {
UnGetChar(); UnGetChar();
ch = ' ';
stash(repl, ' ', !nostashraw); stash(repl, ' ', !nostashraw);
} }
} else if (ch == '/') { } else if (ch == '/') {
@ -454,6 +458,7 @@ a_new_line: ch = GetChar();
stash(repl, ' ', !nostashraw); stash(repl, ' ', !nostashraw);
} else { } else {
UnGetChar(); UnGetChar();
ch = '/';
stash(repl, '/', !nostashraw); stash(repl, '/', !nostashraw);
} }
} else if (ch == '\'' || ch == '"') { } else if (ch == '\'' || ch == '"') {