fixes to preprocessor part

This commit is contained in:
ceriel 1987-08-07 19:53:54 +00:00
parent 3ea06a4a2a
commit 4623ed60b0
3 changed files with 15 additions and 4 deletions

View file

@ -31,7 +31,7 @@ IMPORT char *getwdir();
PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
/* 1 if a corresponding ELSE has been */
/* encountered. */
PRIVATE int nestlevel = -1; /* initially no nesting level. */
int nestlevel = -1; /* initially no nesting level. */
PRIVATE struct idf *
GetIdentifier()

View file

@ -44,7 +44,7 @@ int NoUnstack;
AtEoIT()
{
#ifndef NOPP
if (NoUnstack) lexerror("unexpected EOF");
if (NoUnstack) lexwarning("unexpected EOF");
DoUnstack();
#endif NOPP
return 0;
@ -52,6 +52,12 @@ AtEoIT()
AtEoIF()
{
if (NoUnstack) lexerror("unexpected EOF");
#ifndef NOPP
extern int nestlevel;
if (nestlevel != -1) lexwarning("missing #endif");
else
#endif NOPP
if (NoUnstack) lexwarning("unexpected EOF");
return 0;
}

View file

@ -67,10 +67,11 @@ getactuals(idef)
*/
lexwarning("argument mismatch, %s", idef->id_text);
while (++nr_of_params < acnt) {
while (nr_of_params < acnt) {
/* too few paraeters: remaining actuals are ""
*/
actparams[nr_of_params] = "";
nr_of_params++;
}
}
@ -113,16 +114,19 @@ copyact(ch1, ch2, level)
switch(ch) {
#ifdef __MATCHING_PAR__
case ')':
case '}':
case ']':
lexerror("unbalanced parenthesis");
break;
#endif __MATCHING_PAR__
case '(':
copyact('(', ')', level+1);
break;
#ifdef __MATCHING_PAR__
case '{':
/* example:
#define declare(v, t) t v
@ -134,6 +138,7 @@ copyact(ch1, ch2, level)
case '[':
copyact('[', ']', level+1);
break;
#endif __MATCHING_PAR__
case '\n':
while (LoadChar(ch), ch == '#') {