Replaced a couple of UnGetChar calls with ChPushBack calls. The
UnGetChar call is wrong after skipspaces().
This commit is contained in:
parent
d6e0e461f7
commit
91cb060d10
|
@ -388,7 +388,7 @@ do_define()
|
||||||
/* read the replacement text if there is any */
|
/* read the replacement text if there is any */
|
||||||
ch = skipspaces(ch,0); /* find first character of the text */
|
ch = skipspaces(ch,0); /* find first character of the text */
|
||||||
ASSERT(ch != EOI);
|
ASSERT(ch != EOI);
|
||||||
/* UngetChar() is not right when replacement starts with a '/' */
|
/* UnGetChar() is not right when replacement starts with a '/' */
|
||||||
ChPushBack(ch);
|
ChPushBack(ch);
|
||||||
repl_text = get_text((nformals > 0) ? formals : 0, &length);
|
repl_text = get_text((nformals > 0) ? formals : 0, &length);
|
||||||
macro_def(id, repl_text, nformals, length, NOFLAG);
|
macro_def(id, repl_text, nformals, length, NOFLAG);
|
||||||
|
|
|
@ -150,7 +150,7 @@ expand_macro(repl, idf)
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
ch = skipspaces(ch,1);
|
ch = skipspaces(ch,1);
|
||||||
if (ch != '(') { /* no replacement if no () */
|
if (ch != '(') { /* no replacement if no () */
|
||||||
UnGetChar();
|
ChPushBack(ch);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
getactuals(repl, idf);
|
getactuals(repl, idf);
|
||||||
|
@ -194,17 +194,17 @@ expand_defined(repl)
|
||||||
if ((class(ch) != STIDF) && (class(ch) != STELL)) {
|
if ((class(ch) != STIDF) && (class(ch) != STELL)) {
|
||||||
error("identifier missing");
|
error("identifier missing");
|
||||||
if (parens && ch != ')') error(") missing");
|
if (parens && ch != ')') error(") missing");
|
||||||
if (!parens || ch != ')') UnGetChar();
|
if (!parens || ch != ')') ChPushBack(ch);
|
||||||
add2repl(repl, '0');
|
add2repl(repl, '0');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UnGetChar();
|
ChPushBack(ch);
|
||||||
id = GetIdentifier(0);
|
id = GetIdentifier(0);
|
||||||
ASSERT(id || class(ch) == STELL);
|
ASSERT(id || class(ch) == STELL);
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
ch = skipspaces(ch, 0);
|
ch = skipspaces(ch, 0);
|
||||||
if (parens && ch != ')') error(") missing");
|
if (parens && ch != ')') error(") missing");
|
||||||
if (!parens || ch != ')') UnGetChar();
|
if (!parens || ch != ')') ChPushBack(ch);
|
||||||
add2repl(repl, (id && id->id_macro) ? '1' : '0');
|
add2repl(repl, (id && id->id_macro) ? '1' : '0');
|
||||||
add2repl(repl, ' ');
|
add2repl(repl, ' ');
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ do_define()
|
||||||
/* read the replacement text if there is any */
|
/* read the replacement text if there is any */
|
||||||
ch = skipspaces(ch,0); /* find first character of the text */
|
ch = skipspaces(ch,0); /* find first character of the text */
|
||||||
assert(ch != EOI);
|
assert(ch != EOI);
|
||||||
/* UngetChar() is not right when replacement starts with a '/' */
|
/* UnGetChar() is not right when replacement starts with a '/' */
|
||||||
ChPushBack(ch);
|
ChPushBack(ch);
|
||||||
repl_text = get_text((nformals > 0) ? formals : 0, &length);
|
repl_text = get_text((nformals > 0) ? formals : 0, &length);
|
||||||
macro_def(str2idf(str, 0), repl_text, nformals, length, NOFLAG);
|
macro_def(str2idf(str, 0), repl_text, nformals, length, NOFLAG);
|
||||||
|
|
|
@ -140,7 +140,7 @@ expand_macro(repl, idf)
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
ch = skipspaces(ch,1);
|
ch = skipspaces(ch,1);
|
||||||
if (ch != '(') { /* no replacement if no () */
|
if (ch != '(') { /* no replacement if no () */
|
||||||
UnGetChar();
|
ChPushBack(ch);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
getactuals(repl, idf);
|
getactuals(repl, idf);
|
||||||
|
@ -185,11 +185,11 @@ expand_defined(repl)
|
||||||
if ((class(ch) != STIDF) && (class(ch) != STELL)) {
|
if ((class(ch) != STIDF) && (class(ch) != STELL)) {
|
||||||
error("identifier missing");
|
error("identifier missing");
|
||||||
if (parens && ch != ')') error(") missing");
|
if (parens && ch != ')') error(") missing");
|
||||||
if (!parens || ch != ')') UnGetChar();
|
if (!parens || ch != ')') ChPushBack(ch);
|
||||||
add2repl(repl,'0');
|
add2repl(repl,'0');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UnGetChar();
|
ChPushBack(ch);
|
||||||
str = GetIdentifier(0);
|
str = GetIdentifier(0);
|
||||||
if (str) {
|
if (str) {
|
||||||
id = findidf(str);
|
id = findidf(str);
|
||||||
|
@ -198,7 +198,7 @@ expand_defined(repl)
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
ch = skipspaces(ch, 0);
|
ch = skipspaces(ch, 0);
|
||||||
if (parens && ch != ')') error(") missing");
|
if (parens && ch != ')') error(") missing");
|
||||||
if (!parens || ch != ')') UnGetChar();
|
if (!parens || ch != ')') ChPushBack(ch);
|
||||||
add2repl(repl, (id && id->id_macro) ? '1' : '0');
|
add2repl(repl, (id && id->id_macro) ? '1' : '0');
|
||||||
add2repl(repl, ' ');
|
add2repl(repl, ' ');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue